<ahref="presolve__util_8h.html">Go to the documentation of this file.</a><divclass="fragment"><divclass="line"><aid="l00001"name="l00001"></a><spanclass="lineno"> 1</span><spanclass="comment">// Copyright 2010-2021 Google LLC</span></div>
<divclass="line"><aid="l00002"name="l00002"></a><spanclass="lineno"> 2</span><spanclass="comment">// Licensed under the Apache License, Version 2.0 (the "License");</span></div>
<divclass="line"><aid="l00003"name="l00003"></a><spanclass="lineno"> 3</span><spanclass="comment">// you may not use this file except in compliance with the License.</span></div>
<divclass="line"><aid="l00004"name="l00004"></a><spanclass="lineno"> 4</span><spanclass="comment">// You may obtain a copy of the License at</span></div>
<divclass="line"><aid="l00008"name="l00008"></a><spanclass="lineno"> 8</span><spanclass="comment">// Unless required by applicable law or agreed to in writing, software</span></div>
<divclass="line"><aid="l00009"name="l00009"></a><spanclass="lineno"> 9</span><spanclass="comment">// distributed under the License is distributed on an "AS IS" BASIS,</span></div>
<divclass="line"><aid="l00010"name="l00010"></a><spanclass="lineno"> 10</span><spanclass="comment">// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span></div>
<divclass="line"><aid="l00011"name="l00011"></a><spanclass="lineno"> 11</span><spanclass="comment">// See the License for the specific language governing permissions and</span></div>
<divclass="line"><aid="l00012"name="l00012"></a><spanclass="lineno"> 12</span><spanclass="comment">// limitations under the License.</span></div>
<divclass="line"><aid="l00034"name="l00034"></a><spanclass="lineno"> 34</span><spanclass="comment">// If for each literal of a clause, we can infer a domain on an integer</span></div>
<divclass="line"><aid="l00035"name="l00035"></a><spanclass="lineno"> 35</span><spanclass="comment">// variable, then we know that this variable domain is included in the union of</span></div>
<divclass="line"><aid="l00036"name="l00036"></a><spanclass="lineno"> 36</span><spanclass="comment">// such infered domains.</span></div>
<divclass="line"><aid="l00038"name="l00038"></a><spanclass="lineno"> 38</span><spanclass="comment">// This allows to propagate "element" like constraints encoded as enforced</span></div>
<divclass="line"><aid="l00039"name="l00039"></a><spanclass="lineno"> 39</span><spanclass="comment">// linear relations, and other more general reasoning.</span></div>
<divclass="line"><aid="l00041"name="l00041"></a><spanclass="lineno"> 41</span><spanclass="comment">// TODO(user): Also use these "deductions" in the solver directly. This is done</span></div>
<divclass="line"><aid="l00042"name="l00042"></a><spanclass="lineno"> 42</span><spanclass="comment">// in good MIP solvers, and we should exploit them more.</span></div>
<divclass="line"><aid="l00045"name="l00045"></a><spanclass="lineno"> 45</span><spanclass="comment">// that with probing code? it might be costly to store all deduction done by</span></div>
<divclass="line"><aid="l00046"name="l00046"></a><spanclass="lineno"> 46</span><spanclass="comment">// probing though, but I think this is what MIP solver do.</span></div>
<divclass="line"><aid="l00049"name="l00049"></a><spanclass="lineno"> 49</span><spanclass="comment">// Adds the fact that enforcement => var \in domain.</span></div>
<divclass="line"><aid="l00051"name="l00051"></a><spanclass="lineno"> 51</span><spanclass="comment">// Important: No need to store any deductions where the domain is a superset</span></div>
<divclass="line"><aid="l00052"name="l00052"></a><spanclass="lineno"> 52</span><spanclass="comment">// of the current variable domain.</span></div>
<divclass="line"><aid="l00055"name="l00055"></a><spanclass="lineno"> 55</span><spanclass="comment">// Returns list of (var, domain) that were deduced because:</span></div>
<divclass="line"><aid="l00056"name="l00056"></a><spanclass="lineno"> 56</span><spanclass="comment">// 1/ We have a domain deduction for var and all literal from the clause</span></div>
<divclass="line"><aid="l00057"name="l00057"></a><spanclass="lineno"> 57</span><spanclass="comment">// 2/ So we can take the union of all the deduced domains.</span></div>
<divclass="line"><aid="l00059"name="l00059"></a><spanclass="lineno"> 59</span><spanclass="comment">// TODO(user): We could probably be even more efficient. We could also</span></div>
<divclass="line"><aid="l00060"name="l00060"></a><spanclass="lineno"> 60</span><spanclass="comment">// compute exactly what clauses need to be "waked up" as new deductions are</span></div>
<divclass="line"><aid="l00065"name="l00065"></a><spanclass="lineno"> 65</span><spanclass="comment">// Optimization. Any following ProcessClause() will be fast if no more</span></div>
<divclass="line"><aid="l00066"name="l00066"></a><spanclass="lineno"> 66</span><spanclass="comment">// deduction touching that clause are added.</span></div>
<divclass="line"><aid="l00071"name="l00071"></a><spanclass="lineno"> 71</span><spanclass="comment">// Returns the total number of "deductions" stored by this class.</span></div>
<divclass="line"><aid="l00087"name="l00087"></a><spanclass="lineno"> 87</span><spanclass="comment">// Replaces the variable var in ct using the definition constraint.</span></div>
<divclass="line"><aid="l00088"name="l00088"></a><spanclass="lineno"> 88</span><spanclass="comment">// Currently the coefficient in the definition must be 1 or -1.</span></div>
<divclass="ttc"id="aclassoperations__research_1_1_domain_html"><divclass="ttname"><ahref="classoperations__research_1_1_domain.html">operations_research::Domain</a></div><divclass="ttdoc">We call domain any subset of Int64 = [kint64min, kint64max].</div><divclass="ttdef"><b>Definition:</b><ahref="sorted__interval__list_8h_source.html#l00081">sorted_interval_list.h:81</a></div></div>
<divclass="ttc"id="aclassoperations__research_1_1sat_1_1_domain_deductions_html_ae69f83e1bf5e9a4e729840d31078cdbd"><divclass="ttname"><ahref="classoperations__research_1_1sat_1_1_domain_deductions.html#ae69f83e1bf5e9a4e729840d31078cdbd">operations_research::sat::DomainDeductions::AddDeduction</a></div><divclass="ttdeci">void AddDeduction(int literal_ref, int var, Domain domain)</div><divclass="ttdef"><b>Definition:</b><ahref="presolve__util_8cc_source.html#l00024">presolve_util.cc:24</a></div></div>
<divclass="ttc"id="anamespaceoperations__research_1_1sat_html_a62adf82ba94a3431e4e547a563f06d81"><divclass="ttname"><ahref="namespaceoperations__research_1_1sat.html#a62adf82ba94a3431e4e547a563f06d81">operations_research::sat::SubstituteVariable</a></div><divclass="ttdeci">void SubstituteVariable(int var, int64_t var_coeff_in_definition, const ConstraintProto &definition, ConstraintProto *ct)</div><divclass="ttdef"><b>Definition:</b><ahref="presolve__util_8cc_source.html#l00184">presolve_util.cc:184</a></div></div>
<divclass="ttc"id="anamespaceoperations__research_html"><divclass="ttname"><ahref="namespaceoperations__research.html">operations_research</a></div><divclass="ttdoc">Collection of objects used to extend the Constraint Solver library.</div><divclass="ttdef"><b>Definition:</b><ahref="dense__doubly__linked__list_8h_source.html#l00021">dense_doubly_linked_list.h:21</a></div></div>