Files
ortools-clone/docs/cpp/pseudo__costs_8cc_source.html
2021-02-26 14:48:18 +01:00

261 lines
40 KiB
HTML

<!-- HTML header for doxygen 1.8.18-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>OR-Tools: pseudo_costs.cc Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="styleSheet.tmp.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectlogo"><img alt="Logo" src="orLogo.png"/></td>
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">OR-Tools
&#160;<span id="projectnumber">8.2</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.1 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('pseudo__costs_8cc_source.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="header">
<div class="headertitle">
<div class="title">pseudo_costs.cc</div> </div>
</div><!--header-->
<div class="contents">
<a href="pseudo__costs_8cc.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span>&#160;<span class="comment">// Copyright 2010-2018 Google LLC</span></div>
<div class="line"><a name="l00002"></a><span class="lineno"> 2</span>&#160;<span class="comment">// Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);</span></div>
<div class="line"><a name="l00003"></a><span class="lineno"> 3</span>&#160;<span class="comment">// you may not use this file except in compliance with the License.</span></div>
<div class="line"><a name="l00004"></a><span class="lineno"> 4</span>&#160;<span class="comment">// You may obtain a copy of the License at</span></div>
<div class="line"><a name="l00005"></a><span class="lineno"> 5</span>&#160;<span class="comment">//</span></div>
<div class="line"><a name="l00006"></a><span class="lineno"> 6</span>&#160;<span class="comment">// http://www.apache.org/licenses/LICENSE-2.0</span></div>
<div class="line"><a name="l00007"></a><span class="lineno"> 7</span>&#160;<span class="comment">//</span></div>
<div class="line"><a name="l00008"></a><span class="lineno"> 8</span>&#160;<span class="comment">// Unless required by applicable law or agreed to in writing, software</span></div>
<div class="line"><a name="l00009"></a><span class="lineno"> 9</span>&#160;<span class="comment">// distributed under the License is distributed on an &quot;AS IS&quot; BASIS,</span></div>
<div class="line"><a name="l00010"></a><span class="lineno"> 10</span>&#160;<span class="comment">// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span></div>
<div class="line"><a name="l00011"></a><span class="lineno"> 11</span>&#160;<span class="comment">// See the License for the specific language governing permissions and</span></div>
<div class="line"><a name="l00012"></a><span class="lineno"> 12</span>&#160;<span class="comment">// limitations under the License.</span></div>
<div class="line"><a name="l00013"></a><span class="lineno"> 13</span>&#160; </div>
<div class="line"><a name="l00014"></a><span class="lineno"> 14</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="pseudo__costs_8h.html">ortools/sat/pseudo_costs.h</a>&quot;</span></div>
<div class="line"><a name="l00015"></a><span class="lineno"> 15</span>&#160; </div>
<div class="line"><a name="l00016"></a><span class="lineno"> 16</span>&#160;<span class="preprocessor">#include &lt;cmath&gt;</span></div>
<div class="line"><a name="l00017"></a><span class="lineno"> 17</span>&#160;<span class="preprocessor">#include &lt;vector&gt;</span></div>
<div class="line"><a name="l00018"></a><span class="lineno"> 18</span>&#160; </div>
<div class="line"><a name="l00019"></a><span class="lineno"> 19</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="integer_8h.html">ortools/sat/integer.h</a>&quot;</span></div>
<div class="line"><a name="l00020"></a><span class="lineno"> 20</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="sat__decision_8h.html">ortools/sat/sat_decision.h</a>&quot;</span></div>
<div class="line"><a name="l00021"></a><span class="lineno"> 21</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="sat__parameters_8pb_8h.html">ortools/sat/sat_parameters.pb.h</a>&quot;</span></div>
<div class="line"><a name="l00022"></a><span class="lineno"> 22</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="sat_2util_8h.html">ortools/sat/util.h</a>&quot;</span></div>
<div class="line"><a name="l00023"></a><span class="lineno"> 23</span>&#160; </div>
<div class="line"><a name="l00024"></a><span class="lineno"> 24</span>&#160;<span class="keyword">namespace </span><a class="code" href="namespaceoperations__research.html">operations_research</a> {</div>
<div class="line"><a name="l00025"></a><span class="lineno"> 25</span>&#160;<span class="keyword">namespace </span>sat {</div>
<div class="line"><a name="l00026"></a><span class="lineno"> 26</span>&#160; </div>
<div class="line"><a name="l00027"></a><span class="lineno"><a class="line" href="classoperations__research_1_1sat_1_1_pseudo_costs.html#a6ac2fad8756d6aaaf1df8e38dac544a4"> 27</a></span>&#160;<a class="code" href="classoperations__research_1_1sat_1_1_pseudo_costs.html#a6ac2fad8756d6aaaf1df8e38dac544a4">PseudoCosts::PseudoCosts</a>(<a class="code" href="classoperations__research_1_1sat_1_1_model.html">Model</a>* <a class="code" href="gurobi__interface_8cc.html#a0728f23c9a47655d38e0bf1a2f200bcf">model</a>)</div>
<div class="line"><a name="l00028"></a><span class="lineno"> 28</span>&#160; : integer_trail_(*<a class="code" href="gurobi__interface_8cc.html#a0728f23c9a47655d38e0bf1a2f200bcf">model</a>-&gt;GetOrCreate&lt;<a class="code" href="classoperations__research_1_1sat_1_1_integer_trail.html">IntegerTrail</a>&gt;()),</div>
<div class="line"><a name="l00029"></a><span class="lineno"> 29</span>&#160; parameters_(*<a class="code" href="gurobi__interface_8cc.html#a0728f23c9a47655d38e0bf1a2f200bcf">model</a>-&gt;GetOrCreate&lt;SatParameters&gt;()) {</div>
<div class="line"><a name="l00030"></a><span class="lineno"> 30</span>&#160; <span class="keyword">const</span> <span class="keywordtype">int</span> num_vars = integer_trail_.<a class="code" href="classoperations__research_1_1sat_1_1_integer_trail.html#af88a18429909498405c450015f0a223a">NumIntegerVariables</a>().value();</div>
<div class="line"><a name="l00031"></a><span class="lineno"> 31</span>&#160; pseudo_costs_.resize(num_vars);</div>
<div class="line"><a name="l00032"></a><span class="lineno"> 32</span>&#160;}</div>
<div class="line"><a name="l00033"></a><span class="lineno"> 33</span>&#160; </div>
<div class="line"><a name="l00034"></a><span class="lineno"> 34</span>&#160;<span class="keywordtype">void</span> PseudoCosts::UpdateCostForVar(IntegerVariable <a class="code" href="expr__array_8cc.html#a472a99923cbe11ae7b5a5d157d9ad465">var</a>, <span class="keywordtype">double</span> new_cost) {</div>
<div class="line"><a name="l00035"></a><span class="lineno"> 35</span>&#160; <span class="keywordflow">if</span> (<a class="code" href="expr__array_8cc.html#a472a99923cbe11ae7b5a5d157d9ad465">var</a> &gt;= pseudo_costs_.size()) {</div>
<div class="line"><a name="l00036"></a><span class="lineno"> 36</span>&#160; <span class="comment">// Create space for new variable and its negation.</span></div>
<div class="line"><a name="l00037"></a><span class="lineno"> 37</span>&#160; <span class="keyword">const</span> <span class="keywordtype">int</span> new_size = <a class="code" href="alldiff__cst_8cc.html#a9d0c202d5fdd62f4fa2c613339ff168a">std::max</a>(<a class="code" href="expr__array_8cc.html#a472a99923cbe11ae7b5a5d157d9ad465">var</a>, <a class="code" href="namespaceoperations__research_1_1sat.html#aae43e784db06c0974ce59ebbe8dd2b22">NegationOf</a>(<a class="code" href="expr__array_8cc.html#a472a99923cbe11ae7b5a5d157d9ad465">var</a>)).value() + 1;</div>
<div class="line"><a name="l00038"></a><span class="lineno"> 38</span>&#160; pseudo_costs_.resize(new_size, <a class="code" href="classoperations__research_1_1sat_1_1_incremental_average.html">IncrementalAverage</a>(0.0));</div>
<div class="line"><a name="l00039"></a><span class="lineno"> 39</span>&#160; }</div>
<div class="line"><a name="l00040"></a><span class="lineno"> 40</span>&#160; <a class="code" href="base_2logging_8h.html#ab62f5ed8f2d48e29802be0cbbcd1359a">DCHECK_LT</a>(<a class="code" href="expr__array_8cc.html#a472a99923cbe11ae7b5a5d157d9ad465">var</a>, pseudo_costs_.size());</div>
<div class="line"><a name="l00041"></a><span class="lineno"> 41</span>&#160; pseudo_costs_[<a class="code" href="expr__array_8cc.html#a472a99923cbe11ae7b5a5d157d9ad465">var</a>].AddData(new_cost);</div>
<div class="line"><a name="l00042"></a><span class="lineno"> 42</span>&#160;}</div>
<div class="line"><a name="l00043"></a><span class="lineno"> 43</span>&#160; </div>
<div class="line"><a name="l00044"></a><span class="lineno"><a class="line" href="classoperations__research_1_1sat_1_1_pseudo_costs.html#aa64c6ffef5c1b7402acad774c70bab08"> 44</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="classoperations__research_1_1sat_1_1_pseudo_costs.html#aa64c6ffef5c1b7402acad774c70bab08">PseudoCosts::UpdateCost</a>(</div>
<div class="line"><a name="l00045"></a><span class="lineno"> 45</span>&#160; <span class="keyword">const</span> std::vector&lt;VariableBoundChange&gt;&amp; bound_changes,</div>
<div class="line"><a name="l00046"></a><span class="lineno"> 46</span>&#160; <span class="keyword">const</span> IntegerValue obj_bound_improvement) {</div>
<div class="line"><a name="l00047"></a><span class="lineno"> 47</span>&#160; <a class="code" href="base_2logging_8h.html#aae2dc65d9ea248d54bf39daa986dd295">DCHECK_GE</a>(obj_bound_improvement, 0);</div>
<div class="line"><a name="l00048"></a><span class="lineno"> 48</span>&#160; <span class="keywordflow">if</span> (obj_bound_improvement == IntegerValue(0)) <span class="keywordflow">return</span>;</div>
<div class="line"><a name="l00049"></a><span class="lineno"> 49</span>&#160; </div>
<div class="line"><a name="l00050"></a><span class="lineno"> 50</span>&#160; <span class="keywordflow">for</span> (<span class="keyword">const</span> <a class="code" href="structoperations__research_1_1sat_1_1_pseudo_costs_1_1_variable_bound_change.html">VariableBoundChange</a>&amp; decision : bound_changes) {</div>
<div class="line"><a name="l00051"></a><span class="lineno"> 51</span>&#160; <span class="keywordflow">if</span> (integer_trail_.<a class="code" href="classoperations__research_1_1sat_1_1_integer_trail.html#a309d057e12c8d4d393f13975eea2e2a9">IsCurrentlyIgnored</a>(decision.var)) <span class="keywordflow">continue</span>;</div>
<div class="line"><a name="l00052"></a><span class="lineno"> 52</span>&#160; <span class="keywordflow">if</span> (decision.lower_bound_change == IntegerValue(0)) <span class="keywordflow">continue</span>;</div>
<div class="line"><a name="l00053"></a><span class="lineno"> 53</span>&#160; </div>
<div class="line"><a name="l00054"></a><span class="lineno"> 54</span>&#160; <span class="keyword">const</span> <span class="keywordtype">double</span> current_pseudo_cost =</div>
<div class="line"><a name="l00055"></a><span class="lineno"> 55</span>&#160; <a class="code" href="namespaceoperations__research_1_1sat.html#aed77a1a7675c2f8568529a5a16247ec1">ToDouble</a>(obj_bound_improvement) / <a class="code" href="namespaceoperations__research_1_1sat.html#aed77a1a7675c2f8568529a5a16247ec1">ToDouble</a>(decision.lower_bound_change);</div>
<div class="line"><a name="l00056"></a><span class="lineno"> 56</span>&#160; UpdateCostForVar(decision.var, current_pseudo_cost);</div>
<div class="line"><a name="l00057"></a><span class="lineno"> 57</span>&#160; }</div>
<div class="line"><a name="l00058"></a><span class="lineno"> 58</span>&#160;}</div>
<div class="line"><a name="l00059"></a><span class="lineno"> 59</span>&#160; </div>
<div class="line"><a name="l00060"></a><span class="lineno"><a class="line" href="classoperations__research_1_1sat_1_1_pseudo_costs.html#a00b4cae523b9f6efc893ef55e1d76848"> 60</a></span>&#160;IntegerVariable <a class="code" href="classoperations__research_1_1sat_1_1_pseudo_costs.html#a00b4cae523b9f6efc893ef55e1d76848">PseudoCosts::GetBestDecisionVar</a>() {</div>
<div class="line"><a name="l00061"></a><span class="lineno"> 61</span>&#160; <span class="keywordflow">if</span> (pseudo_costs_.empty()) <span class="keywordflow">return</span> <a class="code" href="namespaceoperations__research_1_1sat.html#a5bd8c44473618b7eafd33ba978db2f06">kNoIntegerVariable</a>;</div>
<div class="line"><a name="l00062"></a><span class="lineno"> 62</span>&#160; </div>
<div class="line"><a name="l00063"></a><span class="lineno"> 63</span>&#160; <span class="keyword">const</span> <span class="keywordtype">double</span> epsilon = 1e-6;</div>
<div class="line"><a name="l00064"></a><span class="lineno"> 64</span>&#160; </div>
<div class="line"><a name="l00065"></a><span class="lineno"> 65</span>&#160; <span class="keywordtype">double</span> best_cost = -std::numeric_limits&lt;double&gt;::infinity();</div>
<div class="line"><a name="l00066"></a><span class="lineno"> 66</span>&#160; IntegerVariable chosen_var = <a class="code" href="namespaceoperations__research_1_1sat.html#a5bd8c44473618b7eafd33ba978db2f06">kNoIntegerVariable</a>;</div>
<div class="line"><a name="l00067"></a><span class="lineno"> 67</span>&#160; </div>
<div class="line"><a name="l00068"></a><span class="lineno"> 68</span>&#160; <span class="keywordflow">for</span> (IntegerVariable positive_var(0); positive_var &lt; pseudo_costs_.size();</div>
<div class="line"><a name="l00069"></a><span class="lineno"> 69</span>&#160; positive_var += 2) {</div>
<div class="line"><a name="l00070"></a><span class="lineno"> 70</span>&#160; <span class="keyword">const</span> IntegerVariable negative_var = <a class="code" href="namespaceoperations__research_1_1sat.html#aae43e784db06c0974ce59ebbe8dd2b22">NegationOf</a>(positive_var);</div>
<div class="line"><a name="l00071"></a><span class="lineno"> 71</span>&#160; <span class="keywordflow">if</span> (integer_trail_.<a class="code" href="classoperations__research_1_1sat_1_1_integer_trail.html#a309d057e12c8d4d393f13975eea2e2a9">IsCurrentlyIgnored</a>(positive_var)) <span class="keywordflow">continue</span>;</div>
<div class="line"><a name="l00072"></a><span class="lineno"> 72</span>&#160; <span class="keyword">const</span> IntegerValue lb = integer_trail_.<a class="code" href="classoperations__research_1_1sat_1_1_integer_trail.html#ab857cd2aead68952d9fe92a8ad8d3ac9">LowerBound</a>(positive_var);</div>
<div class="line"><a name="l00073"></a><span class="lineno"> 73</span>&#160; <span class="keyword">const</span> IntegerValue ub = integer_trail_.<a class="code" href="classoperations__research_1_1sat_1_1_integer_trail.html#a8b6d5a25e6ad3d28a85b1924471e2cac">UpperBound</a>(positive_var);</div>
<div class="line"><a name="l00074"></a><span class="lineno"> 74</span>&#160; <span class="keywordflow">if</span> (lb &gt;= ub) <span class="keywordflow">continue</span>;</div>
<div class="line"><a name="l00075"></a><span class="lineno"> 75</span>&#160; <span class="keywordflow">if</span> (<a class="code" href="classoperations__research_1_1sat_1_1_pseudo_costs.html#a039f2246b9fc08fc5f585cfb8d661b19">GetRecordings</a>(positive_var) + <a class="code" href="classoperations__research_1_1sat_1_1_pseudo_costs.html#a039f2246b9fc08fc5f585cfb8d661b19">GetRecordings</a>(negative_var) &lt;</div>
<div class="line"><a name="l00076"></a><span class="lineno"> 76</span>&#160; parameters_.pseudo_cost_reliability_threshold()) {</div>
<div class="line"><a name="l00077"></a><span class="lineno"> 77</span>&#160; <span class="keywordflow">continue</span>;</div>
<div class="line"><a name="l00078"></a><span class="lineno"> 78</span>&#160; }</div>
<div class="line"><a name="l00079"></a><span class="lineno"> 79</span>&#160; </div>
<div class="line"><a name="l00080"></a><span class="lineno"> 80</span>&#160; <span class="comment">// TODO(user): Experiment with different ways to merge the costs.</span></div>
<div class="line"><a name="l00081"></a><span class="lineno"> 81</span>&#160; <span class="keyword">const</span> <span class="keywordtype">double</span> current_merged_cost =</div>
<div class="line"><a name="l00082"></a><span class="lineno"> 82</span>&#160; <a class="code" href="alldiff__cst_8cc.html#a9d0c202d5fdd62f4fa2c613339ff168a">std::max</a>(<a class="code" href="classoperations__research_1_1sat_1_1_pseudo_costs.html#acf4e4390ebb348125b8300b3d065ddd5">GetCost</a>(positive_var), epsilon) *</div>
<div class="line"><a name="l00083"></a><span class="lineno"> 83</span>&#160; <a class="code" href="alldiff__cst_8cc.html#a9d0c202d5fdd62f4fa2c613339ff168a">std::max</a>(<a class="code" href="classoperations__research_1_1sat_1_1_pseudo_costs.html#acf4e4390ebb348125b8300b3d065ddd5">GetCost</a>(negative_var), epsilon);</div>
<div class="line"><a name="l00084"></a><span class="lineno"> 84</span>&#160; </div>
<div class="line"><a name="l00085"></a><span class="lineno"> 85</span>&#160; <span class="keywordflow">if</span> (current_merged_cost &gt; best_cost) {</div>
<div class="line"><a name="l00086"></a><span class="lineno"> 86</span>&#160; chosen_var = positive_var;</div>
<div class="line"><a name="l00087"></a><span class="lineno"> 87</span>&#160; best_cost = current_merged_cost;</div>
<div class="line"><a name="l00088"></a><span class="lineno"> 88</span>&#160; }</div>
<div class="line"><a name="l00089"></a><span class="lineno"> 89</span>&#160; }</div>
<div class="line"><a name="l00090"></a><span class="lineno"> 90</span>&#160; </div>
<div class="line"><a name="l00091"></a><span class="lineno"> 91</span>&#160; <span class="comment">// Pick the direction with best pseudo cost.</span></div>
<div class="line"><a name="l00092"></a><span class="lineno"> 92</span>&#160; <span class="keywordflow">if</span> (chosen_var != <a class="code" href="namespaceoperations__research_1_1sat.html#a5bd8c44473618b7eafd33ba978db2f06">kNoIntegerVariable</a> &amp;&amp;</div>
<div class="line"><a name="l00093"></a><span class="lineno"> 93</span>&#160; <a class="code" href="classoperations__research_1_1sat_1_1_pseudo_costs.html#acf4e4390ebb348125b8300b3d065ddd5">GetCost</a>(chosen_var) &lt; <a class="code" href="classoperations__research_1_1sat_1_1_pseudo_costs.html#acf4e4390ebb348125b8300b3d065ddd5">GetCost</a>(<a class="code" href="namespaceoperations__research_1_1sat.html#aae43e784db06c0974ce59ebbe8dd2b22">NegationOf</a>(chosen_var))) {</div>
<div class="line"><a name="l00094"></a><span class="lineno"> 94</span>&#160; chosen_var = <a class="code" href="namespaceoperations__research_1_1sat.html#aae43e784db06c0974ce59ebbe8dd2b22">NegationOf</a>(chosen_var);</div>
<div class="line"><a name="l00095"></a><span class="lineno"> 95</span>&#160; }</div>
<div class="line"><a name="l00096"></a><span class="lineno"> 96</span>&#160; <span class="keywordflow">return</span> chosen_var;</div>
<div class="line"><a name="l00097"></a><span class="lineno"> 97</span>&#160;}</div>
<div class="line"><a name="l00098"></a><span class="lineno"> 98</span>&#160; </div>
<div class="line"><a name="l00099"></a><span class="lineno"><a class="line" href="namespaceoperations__research_1_1sat.html#a98bb3bb08c5a9f5c119cf0973bbe5cf8"> 99</a></span>&#160;std::vector&lt;PseudoCosts::VariableBoundChange&gt; <a class="code" href="namespaceoperations__research_1_1sat.html#a98bb3bb08c5a9f5c119cf0973bbe5cf8">GetBoundChanges</a>(</div>
<div class="line"><a name="l00100"></a><span class="lineno"> 100</span>&#160; LiteralIndex decision, <a class="code" href="classoperations__research_1_1sat_1_1_model.html">Model</a>* <a class="code" href="gurobi__interface_8cc.html#a0728f23c9a47655d38e0bf1a2f200bcf">model</a>) {</div>
<div class="line"><a name="l00101"></a><span class="lineno"> 101</span>&#160; std::vector&lt;PseudoCosts::VariableBoundChange&gt; bound_changes;</div>
<div class="line"><a name="l00102"></a><span class="lineno"> 102</span>&#160; <span class="keywordflow">if</span> (decision == <a class="code" href="namespaceoperations__research_1_1sat.html#a2dbcb7017d468a17bdb30252af5c6c31">kNoLiteralIndex</a>) <span class="keywordflow">return</span> bound_changes;</div>
<div class="line"><a name="l00103"></a><span class="lineno"> 103</span>&#160; <span class="keyword">auto</span>* encoder = <a class="code" href="gurobi__interface_8cc.html#a0728f23c9a47655d38e0bf1a2f200bcf">model</a>-&gt;GetOrCreate&lt;<a class="code" href="classoperations__research_1_1sat_1_1_integer_encoder.html">IntegerEncoder</a>&gt;();</div>
<div class="line"><a name="l00104"></a><span class="lineno"> 104</span>&#160; <span class="keyword">auto</span>* integer_trail = <a class="code" href="gurobi__interface_8cc.html#a0728f23c9a47655d38e0bf1a2f200bcf">model</a>-&gt;GetOrCreate&lt;<a class="code" href="classoperations__research_1_1sat_1_1_integer_trail.html">IntegerTrail</a>&gt;();</div>
<div class="line"><a name="l00105"></a><span class="lineno"> 105</span>&#160; <span class="comment">// NOTE: We ignore negation of equality decisions.</span></div>
<div class="line"><a name="l00106"></a><span class="lineno"> 106</span>&#160; <span class="keywordflow">for</span> (<span class="keyword">const</span> <a class="code" href="structoperations__research_1_1sat_1_1_integer_literal.html">IntegerLiteral</a> l :</div>
<div class="line"><a name="l00107"></a><span class="lineno"> 107</span>&#160; encoder-&gt;GetAllIntegerLiterals(<a class="code" href="classoperations__research_1_1sat_1_1_literal.html">Literal</a>(decision))) {</div>
<div class="line"><a name="l00108"></a><span class="lineno"> 108</span>&#160; <span class="keywordflow">if</span> (l.var == <a class="code" href="namespaceoperations__research_1_1sat.html#a5bd8c44473618b7eafd33ba978db2f06">kNoIntegerVariable</a>) <span class="keywordflow">continue</span>;</div>
<div class="line"><a name="l00109"></a><span class="lineno"> 109</span>&#160; <span class="keywordflow">if</span> (integer_trail-&gt;IsCurrentlyIgnored(l.var)) <span class="keywordflow">continue</span>;</div>
<div class="line"><a name="l00110"></a><span class="lineno"> 110</span>&#160; <a class="code" href="structoperations__research_1_1sat_1_1_pseudo_costs_1_1_variable_bound_change.html">PseudoCosts::VariableBoundChange</a> var_bound_change;</div>
<div class="line"><a name="l00111"></a><span class="lineno"> 111</span>&#160; var_bound_change.<a class="code" href="structoperations__research_1_1sat_1_1_pseudo_costs_1_1_variable_bound_change.html#ab6516f556b715738034b30d290c40214">var</a> = l.var;</div>
<div class="line"><a name="l00112"></a><span class="lineno"> 112</span>&#160; var_bound_change.<a class="code" href="structoperations__research_1_1sat_1_1_pseudo_costs_1_1_variable_bound_change.html#a5fcd8a2a6dc182482852a554e9d73af9">lower_bound_change</a> =</div>
<div class="line"><a name="l00113"></a><span class="lineno"> 113</span>&#160; l.bound - integer_trail-&gt;LowerBound(l.var);</div>
<div class="line"><a name="l00114"></a><span class="lineno"> 114</span>&#160; bound_changes.push_back(var_bound_change);</div>
<div class="line"><a name="l00115"></a><span class="lineno"> 115</span>&#160; }</div>
<div class="line"><a name="l00116"></a><span class="lineno"> 116</span>&#160; </div>
<div class="line"><a name="l00117"></a><span class="lineno"> 117</span>&#160; <span class="keywordflow">return</span> bound_changes;</div>
<div class="line"><a name="l00118"></a><span class="lineno"> 118</span>&#160;}</div>
<div class="line"><a name="l00119"></a><span class="lineno"> 119</span>&#160; </div>
<div class="line"><a name="l00120"></a><span class="lineno"> 120</span>&#160;} <span class="comment">// namespace sat</span></div>
<div class="line"><a name="l00121"></a><span class="lineno"> 121</span>&#160;} <span class="comment">// namespace operations_research</span></div>
<div class="ttc" id="aalldiff__cst_8cc_html_a9d0c202d5fdd62f4fa2c613339ff168a"><div class="ttname"><a href="alldiff__cst_8cc.html#a9d0c202d5fdd62f4fa2c613339ff168a">max</a></div><div class="ttdeci">int64 max</div><div class="ttdef"><b>Definition:</b> <a href="alldiff__cst_8cc_source.html#l00139">alldiff_cst.cc:139</a></div></div>
<div class="ttc" id="abase_2logging_8h_html_aae2dc65d9ea248d54bf39daa986dd295"><div class="ttname"><a href="base_2logging_8h.html#aae2dc65d9ea248d54bf39daa986dd295">DCHECK_GE</a></div><div class="ttdeci">#define DCHECK_GE(val1, val2)</div><div class="ttdef"><b>Definition:</b> <a href="base_2logging_8h_source.html#l00889">base/logging.h:889</a></div></div>
<div class="ttc" id="abase_2logging_8h_html_ab62f5ed8f2d48e29802be0cbbcd1359a"><div class="ttname"><a href="base_2logging_8h.html#ab62f5ed8f2d48e29802be0cbbcd1359a">DCHECK_LT</a></div><div class="ttdeci">#define DCHECK_LT(val1, val2)</div><div class="ttdef"><b>Definition:</b> <a href="base_2logging_8h_source.html#l00888">base/logging.h:888</a></div></div>
<div class="ttc" id="aclassoperations__research_1_1sat_1_1_incremental_average_html"><div class="ttname"><a href="classoperations__research_1_1sat_1_1_incremental_average.html">operations_research::sat::IncrementalAverage</a></div><div class="ttdef"><b>Definition:</b> <a href="sat_2util_8h_source.html#l00127">sat/util.h:127</a></div></div>
<div class="ttc" id="aclassoperations__research_1_1sat_1_1_integer_encoder_html"><div class="ttname"><a href="classoperations__research_1_1sat_1_1_integer_encoder.html">operations_research::sat::IntegerEncoder</a></div><div class="ttdef"><b>Definition:</b> <a href="integer_8h_source.html#l00276">integer.h:276</a></div></div>
<div class="ttc" id="aclassoperations__research_1_1sat_1_1_integer_trail_html"><div class="ttname"><a href="classoperations__research_1_1sat_1_1_integer_trail.html">operations_research::sat::IntegerTrail</a></div><div class="ttdef"><b>Definition:</b> <a href="integer_8h_source.html#l00540">integer.h:540</a></div></div>
<div class="ttc" id="aclassoperations__research_1_1sat_1_1_integer_trail_html_a309d057e12c8d4d393f13975eea2e2a9"><div class="ttname"><a href="classoperations__research_1_1sat_1_1_integer_trail.html#a309d057e12c8d4d393f13975eea2e2a9">operations_research::sat::IntegerTrail::IsCurrentlyIgnored</a></div><div class="ttdeci">bool IsCurrentlyIgnored(IntegerVariable i) const</div><div class="ttdef"><b>Definition:</b> <a href="integer_8h_source.html#l00625">integer.h:625</a></div></div>
<div class="ttc" id="aclassoperations__research_1_1sat_1_1_integer_trail_html_a8b6d5a25e6ad3d28a85b1924471e2cac"><div class="ttname"><a href="classoperations__research_1_1sat_1_1_integer_trail.html#a8b6d5a25e6ad3d28a85b1924471e2cac">operations_research::sat::IntegerTrail::UpperBound</a></div><div class="ttdeci">IntegerValue UpperBound(IntegerVariable i) const</div><div class="ttdef"><b>Definition:</b> <a href="integer_8h_source.html#l01304">integer.h:1304</a></div></div>
<div class="ttc" id="aclassoperations__research_1_1sat_1_1_integer_trail_html_ab857cd2aead68952d9fe92a8ad8d3ac9"><div class="ttname"><a href="classoperations__research_1_1sat_1_1_integer_trail.html#ab857cd2aead68952d9fe92a8ad8d3ac9">operations_research::sat::IntegerTrail::LowerBound</a></div><div class="ttdeci">IntegerValue LowerBound(IntegerVariable i) const</div><div class="ttdef"><b>Definition:</b> <a href="integer_8h_source.html#l01300">integer.h:1300</a></div></div>
<div class="ttc" id="aclassoperations__research_1_1sat_1_1_integer_trail_html_af88a18429909498405c450015f0a223a"><div class="ttname"><a href="classoperations__research_1_1sat_1_1_integer_trail.html#af88a18429909498405c450015f0a223a">operations_research::sat::IntegerTrail::NumIntegerVariables</a></div><div class="ttdeci">IntegerVariable NumIntegerVariables() const</div><div class="ttdef"><b>Definition:</b> <a href="integer_8h_source.html#l00565">integer.h:565</a></div></div>
<div class="ttc" id="aclassoperations__research_1_1sat_1_1_literal_html"><div class="ttname"><a href="classoperations__research_1_1sat_1_1_literal.html">operations_research::sat::Literal</a></div><div class="ttdef"><b>Definition:</b> <a href="sat__base_8h_source.html#l00064">sat_base.h:64</a></div></div>
<div class="ttc" id="aclassoperations__research_1_1sat_1_1_model_html"><div class="ttname"><a href="classoperations__research_1_1sat_1_1_model.html">operations_research::sat::Model</a></div><div class="ttdoc">Class that owns everything related to a particular optimization model.</div><div class="ttdef"><b>Definition:</b> <a href="sat_2model_8h_source.html#l00038">sat/model.h:38</a></div></div>
<div class="ttc" id="aclassoperations__research_1_1sat_1_1_pseudo_costs_html_a00b4cae523b9f6efc893ef55e1d76848"><div class="ttname"><a href="classoperations__research_1_1sat_1_1_pseudo_costs.html#a00b4cae523b9f6efc893ef55e1d76848">operations_research::sat::PseudoCosts::GetBestDecisionVar</a></div><div class="ttdeci">IntegerVariable GetBestDecisionVar()</div><div class="ttdef"><b>Definition:</b> <a href="pseudo__costs_8cc_source.html#l00060">pseudo_costs.cc:60</a></div></div>
<div class="ttc" id="aclassoperations__research_1_1sat_1_1_pseudo_costs_html_a039f2246b9fc08fc5f585cfb8d661b19"><div class="ttname"><a href="classoperations__research_1_1sat_1_1_pseudo_costs.html#a039f2246b9fc08fc5f585cfb8d661b19">operations_research::sat::PseudoCosts::GetRecordings</a></div><div class="ttdeci">int GetRecordings(IntegerVariable var) const</div><div class="ttdef"><b>Definition:</b> <a href="pseudo__costs_8h_source.html#l00053">pseudo_costs.h:53</a></div></div>
<div class="ttc" id="aclassoperations__research_1_1sat_1_1_pseudo_costs_html_a6ac2fad8756d6aaaf1df8e38dac544a4"><div class="ttname"><a href="classoperations__research_1_1sat_1_1_pseudo_costs.html#a6ac2fad8756d6aaaf1df8e38dac544a4">operations_research::sat::PseudoCosts::PseudoCosts</a></div><div class="ttdeci">PseudoCosts(Model *model)</div><div class="ttdef"><b>Definition:</b> <a href="pseudo__costs_8cc_source.html#l00027">pseudo_costs.cc:27</a></div></div>
<div class="ttc" id="aclassoperations__research_1_1sat_1_1_pseudo_costs_html_aa64c6ffef5c1b7402acad774c70bab08"><div class="ttname"><a href="classoperations__research_1_1sat_1_1_pseudo_costs.html#aa64c6ffef5c1b7402acad774c70bab08">operations_research::sat::PseudoCosts::UpdateCost</a></div><div class="ttdeci">void UpdateCost(const std::vector&lt; VariableBoundChange &gt; &amp;bound_changes, IntegerValue obj_bound_improvement)</div><div class="ttdef"><b>Definition:</b> <a href="pseudo__costs_8cc_source.html#l00044">pseudo_costs.cc:44</a></div></div>
<div class="ttc" id="aclassoperations__research_1_1sat_1_1_pseudo_costs_html_acf4e4390ebb348125b8300b3d065ddd5"><div class="ttname"><a href="classoperations__research_1_1sat_1_1_pseudo_costs.html#acf4e4390ebb348125b8300b3d065ddd5">operations_research::sat::PseudoCosts::GetCost</a></div><div class="ttdeci">double GetCost(IntegerVariable var) const</div><div class="ttdef"><b>Definition:</b> <a href="pseudo__costs_8h_source.html#l00046">pseudo_costs.h:46</a></div></div>
<div class="ttc" id="aexpr__array_8cc_html_a472a99923cbe11ae7b5a5d157d9ad465"><div class="ttname"><a href="expr__array_8cc.html#a472a99923cbe11ae7b5a5d157d9ad465">var</a></div><div class="ttdeci">IntVar * var</div><div class="ttdef"><b>Definition:</b> <a href="expr__array_8cc_source.html#l01858">expr_array.cc:1858</a></div></div>
<div class="ttc" id="agurobi__interface_8cc_html_a0728f23c9a47655d38e0bf1a2f200bcf"><div class="ttname"><a href="gurobi__interface_8cc.html#a0728f23c9a47655d38e0bf1a2f200bcf">model</a></div><div class="ttdeci">GRBmodel * model</div><div class="ttdef"><b>Definition:</b> <a href="gurobi__interface_8cc_source.html#l00272">gurobi_interface.cc:272</a></div></div>
<div class="ttc" id="ainteger_8h_html"><div class="ttname"><a href="integer_8h.html">integer.h</a></div></div>
<div class="ttc" id="anamespaceoperations__research_1_1sat_html_a2dbcb7017d468a17bdb30252af5c6c31"><div class="ttname"><a href="namespaceoperations__research_1_1sat.html#a2dbcb7017d468a17bdb30252af5c6c31">operations_research::sat::kNoLiteralIndex</a></div><div class="ttdeci">const LiteralIndex kNoLiteralIndex(-1)</div></div>
<div class="ttc" id="anamespaceoperations__research_1_1sat_html_a5bd8c44473618b7eafd33ba978db2f06"><div class="ttname"><a href="namespaceoperations__research_1_1sat.html#a5bd8c44473618b7eafd33ba978db2f06">operations_research::sat::kNoIntegerVariable</a></div><div class="ttdeci">const IntegerVariable kNoIntegerVariable(-1)</div></div>
<div class="ttc" id="anamespaceoperations__research_1_1sat_html_a98bb3bb08c5a9f5c119cf0973bbe5cf8"><div class="ttname"><a href="namespaceoperations__research_1_1sat.html#a98bb3bb08c5a9f5c119cf0973bbe5cf8">operations_research::sat::GetBoundChanges</a></div><div class="ttdeci">std::vector&lt; PseudoCosts::VariableBoundChange &gt; GetBoundChanges(LiteralIndex decision, Model *model)</div><div class="ttdef"><b>Definition:</b> <a href="pseudo__costs_8cc_source.html#l00099">pseudo_costs.cc:99</a></div></div>
<div class="ttc" id="anamespaceoperations__research_1_1sat_html_aae43e784db06c0974ce59ebbe8dd2b22"><div class="ttname"><a href="namespaceoperations__research_1_1sat.html#aae43e784db06c0974ce59ebbe8dd2b22">operations_research::sat::NegationOf</a></div><div class="ttdeci">std::vector&lt; IntegerVariable &gt; NegationOf(const std::vector&lt; IntegerVariable &gt; &amp;vars)</div><div class="ttdef"><b>Definition:</b> <a href="integer_8cc_source.html#l00027">integer.cc:27</a></div></div>
<div class="ttc" id="anamespaceoperations__research_1_1sat_html_aed77a1a7675c2f8568529a5a16247ec1"><div class="ttname"><a href="namespaceoperations__research_1_1sat.html#aed77a1a7675c2f8568529a5a16247ec1">operations_research::sat::ToDouble</a></div><div class="ttdeci">double ToDouble(IntegerValue value)</div><div class="ttdef"><b>Definition:</b> <a href="integer_8h_source.html#l00069">integer.h:69</a></div></div>
<div class="ttc" id="anamespaceoperations__research_html"><div class="ttname"><a href="namespaceoperations__research.html">operations_research</a></div><div class="ttdoc">The vehicle routing library lets one model and solve generic vehicle routing problems ranging from th...</div><div class="ttdef"><b>Definition:</b> <a href="dense__doubly__linked__list_8h_source.html#l00021">dense_doubly_linked_list.h:21</a></div></div>
<div class="ttc" id="apseudo__costs_8h_html"><div class="ttname"><a href="pseudo__costs_8h.html">pseudo_costs.h</a></div></div>
<div class="ttc" id="asat_2util_8h_html"><div class="ttname"><a href="sat_2util_8h.html">util.h</a></div></div>
<div class="ttc" id="asat__decision_8h_html"><div class="ttname"><a href="sat__decision_8h.html">sat_decision.h</a></div></div>
<div class="ttc" id="asat__parameters_8pb_8h_html"><div class="ttname"><a href="sat__parameters_8pb_8h.html">sat_parameters.pb.h</a></div></div>
<div class="ttc" id="astructoperations__research_1_1sat_1_1_integer_literal_html"><div class="ttname"><a href="structoperations__research_1_1sat_1_1_integer_literal.html">operations_research::sat::IntegerLiteral</a></div><div class="ttdef"><b>Definition:</b> <a href="integer_8h_source.html#l00153">integer.h:153</a></div></div>
<div class="ttc" id="astructoperations__research_1_1sat_1_1_pseudo_costs_1_1_variable_bound_change_html"><div class="ttname"><a href="structoperations__research_1_1sat_1_1_pseudo_costs_1_1_variable_bound_change.html">operations_research::sat::PseudoCosts::VariableBoundChange</a></div><div class="ttdef"><b>Definition:</b> <a href="pseudo__costs_8h_source.html#l00032">pseudo_costs.h:32</a></div></div>
<div class="ttc" id="astructoperations__research_1_1sat_1_1_pseudo_costs_1_1_variable_bound_change_html_a5fcd8a2a6dc182482852a554e9d73af9"><div class="ttname"><a href="structoperations__research_1_1sat_1_1_pseudo_costs_1_1_variable_bound_change.html#a5fcd8a2a6dc182482852a554e9d73af9">operations_research::sat::PseudoCosts::VariableBoundChange::lower_bound_change</a></div><div class="ttdeci">IntegerValue lower_bound_change</div><div class="ttdef"><b>Definition:</b> <a href="pseudo__costs_8h_source.html#l00034">pseudo_costs.h:34</a></div></div>
<div class="ttc" id="astructoperations__research_1_1sat_1_1_pseudo_costs_1_1_variable_bound_change_html_ab6516f556b715738034b30d290c40214"><div class="ttname"><a href="structoperations__research_1_1sat_1_1_pseudo_costs_1_1_variable_bound_change.html#ab6516f556b715738034b30d290c40214">operations_research::sat::PseudoCosts::VariableBoundChange::var</a></div><div class="ttdeci">IntegerVariable var</div><div class="ttdef"><b>Definition:</b> <a href="pseudo__costs_8h_source.html#l00033">pseudo_costs.h:33</a></div></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<!-- HTML footer for doxygen 1.8.18-->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="dir_a7cc1eeded8f693d0da6c729bc88c45a.html">ortools</a></li><li class="navelem"><a class="el" href="dir_dddac007a45022d9da6ea1dee012c3b9.html">sat</a></li><li class="navelem"><a class="el" href="pseudo__costs_8cc.html">pseudo_costs.cc</a></li>
<li class="footer">Generated by
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.9.1 </li>
</ul>
</div>
</body>
</html>