<ahref="cp__model__loader_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="l00039"name="l00039"></a><spanclass="lineno"> 39</span><spanclass="comment">// Extracts all the used variables in the CpModelProto and creates a</span></div>
<divclass="line"><aid="l00040"name="l00040"></a><spanclass="lineno"> 40</span><spanclass="comment">// sat::Model representation for them. More precisely</span></div>
<divclass="line"><aid="l00041"name="l00041"></a><spanclass="lineno"> 41</span><spanclass="comment">// - All Boolean variables will be mapped.</span></div>
<divclass="line"><aid="l00042"name="l00042"></a><spanclass="lineno"> 42</span><spanclass="comment">// - All Interval variables will be mapped.</span></div>
<divclass="line"><aid="l00043"name="l00043"></a><spanclass="lineno"> 43</span><spanclass="comment">// - All non-Boolean variable will have a corresponding IntegerVariable, and</span></div>
<divclass="line"><aid="l00044"name="l00044"></a><spanclass="lineno"> 44</span><spanclass="comment">// depending on the view_all_booleans_as_integers, some or all of the</span></div>
<divclass="line"><aid="l00045"name="l00045"></a><spanclass="lineno"> 45</span><spanclass="comment">// BooleanVariable will also have an IntegerVariable corresponding to its</span></div>
<divclass="line"><aid="l00048"name="l00048"></a><spanclass="lineno"> 48</span><spanclass="comment">// Note(user): We could create IntegerVariable on the fly as they are needed,</span></div>
<divclass="line"><aid="l00049"name="l00049"></a><spanclass="lineno"> 49</span><spanclass="comment">// but that loose the original variable order which might be useful in</span></div>
<divclass="line"><aid="l00057"name="l00057"></a><spanclass="lineno"> 57</span><spanclass="comment">// Experimental. Loads the symmetry form the proto symmetry field, as long as</span></div>
<divclass="line"><aid="l00058"name="l00058"></a><spanclass="lineno"> 58</span><spanclass="comment">// they only involve Booleans.</span></div>
<divclass="line"><aid="l00060"name="l00060"></a><spanclass="lineno"> 60</span><spanclass="comment">// TODO(user): We currently only have the code for Booleans, it is why we</span></div>
<divclass="line"><aid="l00061"name="l00061"></a><spanclass="lineno"> 61</span><spanclass="comment">// currently ignore symmetries involving integer variables.</span></div>
<divclass="line"><aid="l00064"name="l00064"></a><spanclass="lineno"> 64</span><spanclass="comment">// Extract the encodings (IntegerVariable <-> Booleans) present in the model.</span></div>
<divclass="line"><aid="l00065"name="l00065"></a><spanclass="lineno"> 65</span><spanclass="comment">// This effectively load some linear constraints of size 1 that will be marked</span></div>
<divclass="line"><aid="l00066"name="l00066"></a><spanclass="lineno"> 66</span><spanclass="comment">// as already loaded.</span></div>
<divclass="line"><aid="l00069"name="l00069"></a><spanclass="lineno"> 69</span><spanclass="comment">// Extract element encodings from exactly_one constraints and</span></div>
<divclass="line"><aid="l00070"name="l00070"></a><spanclass="lineno"> 70</span><spanclass="comment">// lit => var == value constraints.</span></div>
<divclass="line"><aid="l00071"name="l00071"></a><spanclass="lineno"> 71</span><spanclass="comment">// This function must be called after ExtractEncoding() has been called.</span></div>
<divclass="line"><aid="l00074"name="l00074"></a><spanclass="lineno"> 74</span><spanclass="comment">// Process all affine relations of the form a*X + b*Y == cte. For each</span></div>
<divclass="line"><aid="l00075"name="l00075"></a><spanclass="lineno"> 75</span><spanclass="comment">// literals associated to (X >= bound) or (X == value) associate it to its</span></div>
<divclass="line"><aid="l00076"name="l00076"></a><spanclass="lineno"> 76</span><spanclass="comment">// corresponding relation on Y. Also do the other side.</span></div>
<divclass="line"><aid="l00078"name="l00078"></a><spanclass="lineno"> 78</span><spanclass="comment">// TODO(user): In an ideal world, all affine relations like this should be</span></div>
<divclass="line"><aid="l00079"name="l00079"></a><spanclass="lineno"> 79</span><spanclass="comment">// removed in the presolve.</span></div>
<divclass="line"><aid="l00083"name="l00083"></a><spanclass="lineno"> 83</span><spanclass="comment">// Inspect the search strategy stored in the model, and adds a full encoding to</span></div>
<divclass="line"><aid="l00084"name="l00084"></a><spanclass="lineno"> 84</span><spanclass="comment">// variables appearing in a SELECT_MEDIAN_VALUE search strategy if the search</span></div>
<divclass="line"><aid="l00085"name="l00085"></a><spanclass="lineno"> 85</span><spanclass="comment">// branching is set to FIXED_SEARCH.</span></div>
<divclass="line"><aid="l00089"name="l00089"></a><spanclass="lineno"> 89</span><spanclass="comment">// Calls one of the functions below.</span></div>
<divclass="line"><aid="l00090"name="l00090"></a><spanclass="lineno"> 90</span><spanclass="comment">// Returns false if we do not know how to load the given constraints.</span></div>
<divclass="ttc"id="aclassoperations__research_1_1sat_1_1_model_html"><divclass="ttname"><ahref="classoperations__research_1_1sat_1_1_model.html">operations_research::sat::Model</a></div><divclass="ttdoc">Class that owns everything related to a particular optimization model.</div><divclass="ttdef"><b>Definition:</b><ahref="sat_2model_8h_source.html#l00038">sat/model.h:38</a></div></div>
<divclass="ttc"id="anamespaceoperations__research_1_1sat_html_a0a1b3ad033e2499a4d815f4e98eba795"><divclass="ttname"><ahref="namespaceoperations__research_1_1sat.html#a0a1b3ad033e2499a4d815f4e98eba795">operations_research::sat::LoadCircuitCoveringConstraint</a></div><divclass="ttdeci">void LoadCircuitCoveringConstraint(const ConstraintProto &ct, Model *m)</div></div>
<divclass="ttc"id="anamespaceoperations__research_1_1sat_html_a1537797d4a741397c8630b739c021ddd"><divclass="ttname"><ahref="namespaceoperations__research_1_1sat.html#a1537797d4a741397c8630b739c021ddd">operations_research::sat::LoadExactlyOneConstraint</a></div><divclass="ttdeci">void LoadExactlyOneConstraint(const ConstraintProto &ct, Model *m)</div><divclass="ttdef"><b>Definition:</b><ahref="cp__model__loader_8cc_source.html#l00893">cp_model_loader.cc:893</a></div></div>
<divclass="ttc"id="anamespaceoperations__research_1_1sat_html_a1a6eefe7a5bfd8bdf83407c9e6af56f5"><divclass="ttname"><ahref="namespaceoperations__research_1_1sat.html#a1a6eefe7a5bfd8bdf83407c9e6af56f5">operations_research::sat::LoadVariables</a></div><divclass="ttdeci">void LoadVariables(const CpModelProto &model_proto, bool view_all_booleans_as_integers, Model *m)</div><divclass="ttdef"><b>Definition:</b><ahref="cp__model__loader_8cc_source.html#l00119">cp_model_loader.cc:119</a></div></div>
<divclass="ttc"id="anamespaceoperations__research_1_1sat_html_a1bf9586612493e7cfcc892c54fecf49a"><divclass="ttname"><ahref="namespaceoperations__research_1_1sat.html#a1bf9586612493e7cfcc892c54fecf49a">operations_research::sat::LoadIntProdConstraint</a></div><divclass="ttdeci">void LoadIntProdConstraint(const ConstraintProto &ct, Model *m)</div><divclass="ttdef"><b>Definition:</b><ahref="cp__model__loader_8cc_source.html#l01140">cp_model_loader.cc:1140</a></div></div>
<divclass="ttc"id="anamespaceoperations__research_1_1sat_html_a1c3fa75911c74ce485e62814484c7ae7"><divclass="ttname"><ahref="namespaceoperations__research_1_1sat.html#a1c3fa75911c74ce485e62814484c7ae7">operations_research::sat::LoadConstraint</a></div><divclass="ttdeci">bool LoadConstraint(const ConstraintProto &ct, Model *m)</div><divclass="ttdef"><b>Definition:</b><ahref="cp__model__loader_8cc_source.html#l01259">cp_model_loader.cc:1259</a></div></div>
<divclass="ttc"id="anamespaceoperations__research_1_1sat_html_a1e0082b201a54cee7bf210998888c328"><divclass="ttname"><ahref="namespaceoperations__research_1_1sat.html#a1e0082b201a54cee7bf210998888c328">operations_research::sat::LoadBoolOrConstraint</a></div><divclass="ttdeci">void LoadBoolOrConstraint(const ConstraintProto &ct, Model *m)</div><divclass="ttdef"><b>Definition:</b><ahref="cp__model__loader_8cc_source.html#l00864">cp_model_loader.cc:864</a></div></div>
<divclass="ttc"id="anamespaceoperations__research_1_1sat_html_a238dd948ee65a553d4617753c0d44d7b"><divclass="ttname"><ahref="namespaceoperations__research_1_1sat.html#a238dd948ee65a553d4617753c0d44d7b">operations_research::sat::ExtractElementEncoding</a></div><divclass="ttdeci">void ExtractElementEncoding(const CpModelProto &model_proto, Model *m)</div><divclass="ttdef"><b>Definition:</b><ahref="cp__model__loader_8cc_source.html#l00620">cp_model_loader.cc:620</a></div></div>
<divclass="ttc"id="anamespaceoperations__research_1_1sat_html_a4af0100d434de55ff841156fdac6d180"><divclass="ttname"><ahref="namespaceoperations__research_1_1sat.html#a4af0100d434de55ff841156fdac6d180">operations_research::sat::LoadBooleanSymmetries</a></div><divclass="ttdeci">void LoadBooleanSymmetries(const CpModelProto &model_proto, Model *m)</div><divclass="ttdef"><b>Definition:</b><ahref="cp__model__loader_8cc_source.html#l00261">cp_model_loader.cc:261</a></div></div>
<divclass="ttc"id="anamespaceoperations__research_1_1sat_html_a50082c82c7d605e10de47911f0485526"><divclass="ttname"><ahref="namespaceoperations__research_1_1sat.html#a50082c82c7d605e10de47911f0485526">operations_research::sat::LoadCumulativeConstraint</a></div><divclass="ttdeci">void LoadCumulativeConstraint(const ConstraintProto &ct, Model *m)</div><divclass="ttdef"><b>Definition:</b><ahref="cp__model__loader_8cc_source.html#l01224">cp_model_loader.cc:1224</a></div></div>
<divclass="ttc"id="anamespaceoperations__research_1_1sat_html_a5190bd84fe4e628ebde4007e970f84ce"><divclass="ttname"><ahref="namespaceoperations__research_1_1sat.html#a5190bd84fe4e628ebde4007e970f84ce">operations_research::sat::LoadRoutesConstraint</a></div><divclass="ttdeci">void LoadRoutesConstraint(const ConstraintProto &ct, Model *m)</div><divclass="ttdef"><b>Definition:</b><ahref="cp__model__loader_8cc_source.html#l01246">cp_model_loader.cc:1246</a></div></div>
<divclass="ttc"id="anamespaceoperations__research_1_1sat_html_a55c57c1725f5333ffe73f0fefc377bb8"><divclass="ttname"><ahref="namespaceoperations__research_1_1sat.html#a55c57c1725f5333ffe73f0fefc377bb8">operations_research::sat::LoadBoolAndConstraint</a></div><divclass="ttdeci">void LoadBoolAndConstraint(const ConstraintProto &ct, Model *m)</div><divclass="ttdef"><b>Definition:</b><ahref="cp__model__loader_8cc_source.html#l00873">cp_model_loader.cc:873</a></div></div>
<divclass="ttc"id="anamespaceoperations__research_1_1sat_html_a596a1b4122eff430a59beb743ed942cd"><divclass="ttname"><ahref="namespaceoperations__research_1_1sat.html#a596a1b4122eff430a59beb743ed942cd">operations_research::sat::LoadLinMaxConstraint</a></div><divclass="ttdeci">void LoadLinMaxConstraint(const ConstraintProto &ct, Model *m)</div><divclass="ttdef"><b>Definition:</b><ahref="cp__model__loader_8cc_source.html#l01188">cp_model_loader.cc:1188</a></div></div>
<divclass="ttc"id="anamespaceoperations__research_1_1sat_html_a59ba67bcf20a8657c8d0e6c3f120121f"><divclass="ttname"><ahref="namespaceoperations__research_1_1sat.html#a59ba67bcf20a8657c8d0e6c3f120121f">operations_research::sat::LoadBoolXorConstraint</a></div><divclass="ttdeci">void LoadBoolXorConstraint(const ConstraintProto &ct, Model *m)</div><divclass="ttdef"><b>Definition:</b><ahref="cp__model__loader_8cc_source.html#l00899">cp_model_loader.cc:899</a></div></div>
<divclass="ttc"id="anamespaceoperations__research_1_1sat_html_a6bded303c37dabc35958dcc4a22d4949"><divclass="ttname"><ahref="namespaceoperations__research_1_1sat.html#a6bded303c37dabc35958dcc4a22d4949">operations_research::sat::LoadIntDivConstraint</a></div><divclass="ttdeci">void LoadIntDivConstraint(const ConstraintProto &ct, Model *m)</div><divclass="ttdef"><b>Definition:</b><ahref="cp__model__loader_8cc_source.html#l01157">cp_model_loader.cc:1157</a></div></div>
<divclass="ttc"id="anamespaceoperations__research_1_1sat_html_a85f779432cdf63a07905deaae7fd0041"><divclass="ttname"><ahref="namespaceoperations__research_1_1sat.html#a85f779432cdf63a07905deaae7fd0041">operations_research::sat::LoadLinearConstraint</a></div><divclass="ttdeci">void LoadLinearConstraint(const ConstraintProto &ct, Model *m)</div><divclass="ttdef"><b>Definition:</b><ahref="cp__model__loader_8cc_source.html#l00979">cp_model_loader.cc:979</a></div></div>
<divclass="ttc"id="anamespaceoperations__research_1_1sat_html_a8c1f1cd3466f640c86fd2df798db0198"><divclass="ttname"><ahref="namespaceoperations__research_1_1sat.html#a8c1f1cd3466f640c86fd2df798db0198">operations_research::sat::LoadIntMinConstraint</a></div><divclass="ttdeci">void LoadIntMinConstraint(const ConstraintProto &ct, Model *m)</div></div>
<divclass="ttc"id="anamespaceoperations__research_1_1sat_html_a9a75e5a5c8a2be39edaf66f75618704a"><divclass="ttname"><ahref="namespaceoperations__research_1_1sat.html#a9a75e5a5c8a2be39edaf66f75618704a">operations_research::sat::LoadAtMostOneConstraint</a></div><divclass="ttdeci">void LoadAtMostOneConstraint(const ConstraintProto &ct, Model *m)</div><divclass="ttdef"><b>Definition:</b><ahref="cp__model__loader_8cc_source.html#l00887">cp_model_loader.cc:887</a></div></div>
<divclass="ttc"id="anamespaceoperations__research_1_1sat_html_a9e9bd05a784d4b295ed4da47278990e1"><divclass="ttname"><ahref="namespaceoperations__research_1_1sat.html#a9e9bd05a784d4b295ed4da47278990e1">operations_research::sat::LoadCircuitConstraint</a></div><divclass="ttdeci">void LoadCircuitConstraint(const ConstraintProto &ct, Model *m)</div><divclass="ttdef"><b>Definition:</b><ahref="cp__model__loader_8cc_source.html#l01234">cp_model_loader.cc:1234</a></div></div>
<divclass="ttc"id="anamespaceoperations__research_1_1sat_html_a9f7dc553b18e0a44b713b2513f29a26f"><divclass="ttname"><ahref="namespaceoperations__research_1_1sat.html#a9f7dc553b18e0a44b713b2513f29a26f">operations_research::sat::LoadNoOverlapConstraint</a></div><divclass="ttdeci">void LoadNoOverlapConstraint(const ConstraintProto &ct, Model *m)</div><divclass="ttdef"><b>Definition:</b><ahref="cp__model__loader_8cc_source.html#l01206">cp_model_loader.cc:1206</a></div></div>
<divclass="ttc"id="anamespaceoperations__research_1_1sat_html_aa3361a48335b9de95fcefa9dc5dc3e22"><divclass="ttname"><ahref="namespaceoperations__research_1_1sat.html#aa3361a48335b9de95fcefa9dc5dc3e22">operations_research::sat::DetectOptionalVariables</a></div><divclass="ttdeci">void DetectOptionalVariables(const CpModelProto &model_proto, Model *m)</div><divclass="ttdef"><b>Definition:</b><ahref="cp__model__loader_8cc_source.html#l00761">cp_model_loader.cc:761</a></div></div>
<divclass="ttc"id="anamespaceoperations__research_1_1sat_html_aa5832284102731626af241e30ed9134f"><divclass="ttname"><ahref="namespaceoperations__research_1_1sat.html#aa5832284102731626af241e30ed9134f">operations_research::sat::LoadAllDiffConstraint</a></div><divclass="ttdeci">void LoadAllDiffConstraint(const ConstraintProto &ct, Model *m)</div><divclass="ttdef"><b>Definition:</b><ahref="cp__model__loader_8cc_source.html#l01133">cp_model_loader.cc:1133</a></div></div>
<divclass="ttc"id="anamespaceoperations__research_1_1sat_html_ab716457062d8500d7315cfe29646de6b"><divclass="ttname"><ahref="namespaceoperations__research_1_1sat.html#ab716457062d8500d7315cfe29646de6b">operations_research::sat::LoadNoOverlap2dConstraint</a></div><divclass="ttdeci">void LoadNoOverlap2dConstraint(const ConstraintProto &ct, Model *m)</div><divclass="ttdef"><b>Definition:</b><ahref="cp__model__loader_8cc_source.html#l01211">cp_model_loader.cc:1211</a></div></div>
<divclass="ttc"id="anamespaceoperations__research_1_1sat_html_aca7fee6509920049d61a48cbd0edf30a"><divclass="ttname"><ahref="namespaceoperations__research_1_1sat.html#aca7fee6509920049d61a48cbd0edf30a">operations_research::sat::LoadIntMaxConstraint</a></div><divclass="ttdeci">void LoadIntMaxConstraint(const ConstraintProto &ct, Model *m)</div></div>
<divclass="ttc"id="anamespaceoperations__research_1_1sat_html_acbee1df94bc06fb7ca19708cd82a21e3"><divclass="ttname"><ahref="namespaceoperations__research_1_1sat.html#acbee1df94bc06fb7ca19708cd82a21e3">operations_research::sat::AddFullEncodingFromSearchBranching</a></div><divclass="ttdeci">void AddFullEncodingFromSearchBranching(const CpModelProto &model_proto, Model *m)</div><divclass="ttdef"><b>Definition:</b><ahref="cp__model__loader_8cc_source.html#l00840">cp_model_loader.cc:840</a></div></div>
<divclass="ttc"id="anamespaceoperations__research_1_1sat_html_ad78bf6fcea4b54f750e2457e47b4f46a"><divclass="ttname"><ahref="namespaceoperations__research_1_1sat.html#ad78bf6fcea4b54f750e2457e47b4f46a">operations_research::sat::ExtractEncoding</a></div><divclass="ttdeci">void ExtractEncoding(const CpModelProto &model_proto, Model *m)</div><divclass="ttdef"><b>Definition:</b><ahref="cp__model__loader_8cc_source.html#l00351">cp_model_loader.cc:351</a></div></div>
<divclass="ttc"id="anamespaceoperations__research_1_1sat_html_adfbeb7391a9578a4cdba60c46b05e19e"><divclass="ttname"><ahref="namespaceoperations__research_1_1sat.html#adfbeb7391a9578a4cdba60c46b05e19e">operations_research::sat::PropagateEncodingFromEquivalenceRelations</a></div><divclass="ttdeci">void PropagateEncodingFromEquivalenceRelations(const CpModelProto &model_proto, Model *m)</div><divclass="ttdef"><b>Definition:</b><ahref="cp__model__loader_8cc_source.html#l00677">cp_model_loader.cc:677</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>