Files
ortools-clone/docs/cpp/proto__utils_8cc_source.html
Mizux Seiha 3b81c981c2 Update doc
2022-03-04 00:19:15 +01:00

221 lines
38 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.3"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>OR-Tools: proto_utils.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">9.3</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.3 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search",'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:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(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:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(document).ready(function(){initNavTree('proto__utils_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">proto_utils.cc</div></div>
</div><!--header-->
<div class="contents">
<a href="proto__utils_8cc.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno"> 1</span><span class="comment">// Copyright 2010-2021 Google LLC</span></div>
<div class="line"><a id="l00002" name="l00002"></a><span class="lineno"> 2</span><span class="comment">// Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);</span></div>
<div class="line"><a id="l00003" name="l00003"></a><span class="lineno"> 3</span><span class="comment">// you may not use this file except in compliance with the License.</span></div>
<div class="line"><a id="l00004" name="l00004"></a><span class="lineno"> 4</span><span class="comment">// You may obtain a copy of the License at</span></div>
<div class="line"><a id="l00005" name="l00005"></a><span class="lineno"> 5</span><span class="comment">//</span></div>
<div class="line"><a id="l00006" name="l00006"></a><span class="lineno"> 6</span><span class="comment">// http://www.apache.org/licenses/LICENSE-2.0</span></div>
<div class="line"><a id="l00007" name="l00007"></a><span class="lineno"> 7</span><span class="comment">//</span></div>
<div class="line"><a id="l00008" name="l00008"></a><span class="lineno"> 8</span><span class="comment">// Unless required by applicable law or agreed to in writing, software</span></div>
<div class="line"><a id="l00009" name="l00009"></a><span class="lineno"> 9</span><span class="comment">// distributed under the License is distributed on an &quot;AS IS&quot; BASIS,</span></div>
<div class="line"><a id="l00010" name="l00010"></a><span class="lineno"> 10</span><span class="comment">// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span></div>
<div class="line"><a id="l00011" name="l00011"></a><span class="lineno"> 11</span><span class="comment">// See the License for the specific language governing permissions and</span></div>
<div class="line"><a id="l00012" name="l00012"></a><span class="lineno"> 12</span><span class="comment">// limitations under the License.</span></div>
<div class="line"><a id="l00013" name="l00013"></a><span class="lineno"> 13</span> </div>
<div class="line"><a id="l00014" name="l00014"></a><span class="lineno"> 14</span><span class="preprocessor">#include &quot;<a class="code" href="lp__data_2proto__utils_8h.html">ortools/lp_data/proto_utils.h</a>&quot;</span></div>
<div class="line"><a id="l00015" name="l00015"></a><span class="lineno"> 15</span> </div>
<div class="line"><a id="l00016" name="l00016"></a><span class="lineno"> 16</span><span class="keyword">namespace </span><a class="code hl_namespace" href="namespaceoperations__research.html">operations_research</a> {</div>
<div class="line"><a id="l00017" name="l00017"></a><span class="lineno"> 17</span><span class="keyword">namespace </span>glop {</div>
<div class="line"><a id="l00018" name="l00018"></a><span class="lineno"> 18</span> </div>
<div class="line"><a id="l00019" name="l00019"></a><span class="lineno"> 19</span><span class="comment">// Converts a LinearProgram to a MPModelProto.</span></div>
<div class="line"><a id="l00020" name="l00020"></a><span class="lineno"><a class="line" href="namespaceoperations__research_1_1glop.html#a8750840afdd5774223821fd504df04c5"> 20</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="namespaceoperations__research_1_1glop.html#a8750840afdd5774223821fd504df04c5">LinearProgramToMPModelProto</a>(<span class="keyword">const</span> <a class="code hl_class" href="classoperations__research_1_1glop_1_1_linear_program.html">LinearProgram</a>&amp; <a class="code hl_function" href="parser_8yy_8cc.html#a5a634cf4429798b1c921a81de8250051">input</a>,</div>
<div class="line"><a id="l00021" name="l00021"></a><span class="lineno"> 21</span> MPModelProto* output) {</div>
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno"> 22</span> output-&gt;Clear();</div>
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno"> 23</span> output-&gt;set_name(<a class="code hl_function" href="parser_8yy_8cc.html#a5a634cf4429798b1c921a81de8250051">input</a>.name());</div>
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno"> 24</span> output-&gt;set_maximize(<a class="code hl_function" href="parser_8yy_8cc.html#a5a634cf4429798b1c921a81de8250051">input</a>.IsMaximizationProblem());</div>
<div class="line"><a id="l00025" name="l00025"></a><span class="lineno"> 25</span> output-&gt;set_objective_offset(<a class="code hl_function" href="parser_8yy_8cc.html#a5a634cf4429798b1c921a81de8250051">input</a>.objective_offset());</div>
<div class="line"><a id="l00026" name="l00026"></a><span class="lineno"> 26</span> <span class="keywordflow">for</span> (ColIndex <a class="code hl_variable" href="markowitz_8cc.html#aa9d6c98fdf8d89b0e2321fda02adc82c">col</a>(0); <a class="code hl_variable" href="markowitz_8cc.html#aa9d6c98fdf8d89b0e2321fda02adc82c">col</a> &lt; <a class="code hl_function" href="parser_8yy_8cc.html#a5a634cf4429798b1c921a81de8250051">input</a>.num_variables(); ++<a class="code hl_variable" href="markowitz_8cc.html#aa9d6c98fdf8d89b0e2321fda02adc82c">col</a>) {</div>
<div class="line"><a id="l00027" name="l00027"></a><span class="lineno"> 27</span> MPVariableProto* variable = output-&gt;add_variable();</div>
<div class="line"><a id="l00028" name="l00028"></a><span class="lineno"> 28</span> variable-&gt;set_lower_bound(<a class="code hl_function" href="parser_8yy_8cc.html#a5a634cf4429798b1c921a81de8250051">input</a>.variable_lower_bounds()[<a class="code hl_variable" href="markowitz_8cc.html#aa9d6c98fdf8d89b0e2321fda02adc82c">col</a>]);</div>
<div class="line"><a id="l00029" name="l00029"></a><span class="lineno"> 29</span> variable-&gt;set_upper_bound(<a class="code hl_function" href="parser_8yy_8cc.html#a5a634cf4429798b1c921a81de8250051">input</a>.variable_upper_bounds()[<a class="code hl_variable" href="markowitz_8cc.html#aa9d6c98fdf8d89b0e2321fda02adc82c">col</a>]);</div>
<div class="line"><a id="l00030" name="l00030"></a><span class="lineno"> 30</span> variable-&gt;set_name(<a class="code hl_function" href="parser_8yy_8cc.html#a5a634cf4429798b1c921a81de8250051">input</a>.GetVariableName(<a class="code hl_variable" href="markowitz_8cc.html#aa9d6c98fdf8d89b0e2321fda02adc82c">col</a>));</div>
<div class="line"><a id="l00031" name="l00031"></a><span class="lineno"> 31</span> variable-&gt;set_is_integer(<a class="code hl_function" href="parser_8yy_8cc.html#a5a634cf4429798b1c921a81de8250051">input</a>.IsVariableInteger(<a class="code hl_variable" href="markowitz_8cc.html#aa9d6c98fdf8d89b0e2321fda02adc82c">col</a>));</div>
<div class="line"><a id="l00032" name="l00032"></a><span class="lineno"> 32</span> variable-&gt;set_objective_coefficient(<a class="code hl_function" href="parser_8yy_8cc.html#a5a634cf4429798b1c921a81de8250051">input</a>.objective_coefficients()[<a class="code hl_variable" href="markowitz_8cc.html#aa9d6c98fdf8d89b0e2321fda02adc82c">col</a>]);</div>
<div class="line"><a id="l00033" name="l00033"></a><span class="lineno"> 33</span> }</div>
<div class="line"><a id="l00034" name="l00034"></a><span class="lineno"> 34</span> <span class="comment">// We need the matrix transpose because a LinearProgram stores the data</span></div>
<div class="line"><a id="l00035" name="l00035"></a><span class="lineno"> 35</span> <span class="comment">// column-wise but the MPModelProto uses a row-wise format.</span></div>
<div class="line"><a id="l00036" name="l00036"></a><span class="lineno"> 36</span> <a class="code hl_class" href="classoperations__research_1_1glop_1_1_sparse_matrix.html">SparseMatrix</a> transpose;</div>
<div class="line"><a id="l00037" name="l00037"></a><span class="lineno"> 37</span> transpose.<a class="code hl_function" href="classoperations__research_1_1glop_1_1_sparse_matrix.html#a2fe6f7470512f5301031480737375c88">PopulateFromTranspose</a>(<a class="code hl_function" href="parser_8yy_8cc.html#a5a634cf4429798b1c921a81de8250051">input</a>.GetSparseMatrix());</div>
<div class="line"><a id="l00038" name="l00038"></a><span class="lineno"> 38</span> <span class="keywordflow">for</span> (RowIndex <a class="code hl_variable" href="markowitz_8cc.html#aea35f36ba98d5bbd8d033382f50c9e52">row</a>(0); <a class="code hl_variable" href="markowitz_8cc.html#aea35f36ba98d5bbd8d033382f50c9e52">row</a> &lt; <a class="code hl_function" href="parser_8yy_8cc.html#a5a634cf4429798b1c921a81de8250051">input</a>.num_constraints(); ++<a class="code hl_variable" href="markowitz_8cc.html#aea35f36ba98d5bbd8d033382f50c9e52">row</a>) {</div>
<div class="line"><a id="l00039" name="l00039"></a><span class="lineno"> 39</span> MPConstraintProto* constraint = output-&gt;add_constraint();</div>
<div class="line"><a id="l00040" name="l00040"></a><span class="lineno"> 40</span> constraint-&gt;set_lower_bound(<a class="code hl_function" href="parser_8yy_8cc.html#a5a634cf4429798b1c921a81de8250051">input</a>.constraint_lower_bounds()[<a class="code hl_variable" href="markowitz_8cc.html#aea35f36ba98d5bbd8d033382f50c9e52">row</a>]);</div>
<div class="line"><a id="l00041" name="l00041"></a><span class="lineno"> 41</span> constraint-&gt;set_upper_bound(<a class="code hl_function" href="parser_8yy_8cc.html#a5a634cf4429798b1c921a81de8250051">input</a>.constraint_upper_bounds()[<a class="code hl_variable" href="markowitz_8cc.html#aea35f36ba98d5bbd8d033382f50c9e52">row</a>]);</div>
<div class="line"><a id="l00042" name="l00042"></a><span class="lineno"> 42</span> constraint-&gt;set_name(<a class="code hl_function" href="parser_8yy_8cc.html#a5a634cf4429798b1c921a81de8250051">input</a>.GetConstraintName(<a class="code hl_variable" href="markowitz_8cc.html#aea35f36ba98d5bbd8d033382f50c9e52">row</a>));</div>
<div class="line"><a id="l00043" name="l00043"></a><span class="lineno"> 43</span> <span class="keywordflow">for</span> (<span class="keyword">const</span> <a class="code hl_typedef" href="classoperations__research_1_1glop_1_1_sparse_vector.html#ab38326ea6cb6187267665dd8b2748f3d">SparseColumn::Entry</a> e : transpose.<a class="code hl_function" href="classoperations__research_1_1glop_1_1_sparse_matrix.html#a7273cc492a51a1c5d45c620b32fce502">column</a>(<a class="code hl_function" href="namespaceoperations__research_1_1glop.html#a8fbc9efd86a3cc862a9079d86ab8b524">RowToColIndex</a>(<a class="code hl_variable" href="markowitz_8cc.html#aea35f36ba98d5bbd8d033382f50c9e52">row</a>))) {</div>
<div class="line"><a id="l00044" name="l00044"></a><span class="lineno"> 44</span> constraint-&gt;add_var_index(e.row().value());</div>
<div class="line"><a id="l00045" name="l00045"></a><span class="lineno"> 45</span> constraint-&gt;add_coefficient(e.coefficient());</div>
<div class="line"><a id="l00046" name="l00046"></a><span class="lineno"> 46</span> }</div>
<div class="line"><a id="l00047" name="l00047"></a><span class="lineno"> 47</span> }</div>
<div class="line"><a id="l00048" name="l00048"></a><span class="lineno"> 48</span>}</div>
<div class="line"><a id="l00049" name="l00049"></a><span class="lineno"> 49</span> </div>
<div class="line"><a id="l00050" name="l00050"></a><span class="lineno"> 50</span><span class="comment">// Converts a MPModelProto to a LinearProgram.</span></div>
<div class="line"><a id="l00051" name="l00051"></a><span class="lineno"><a class="line" href="namespaceoperations__research_1_1glop.html#a4066bdd6e74f798c189fa8e830fcd37b"> 51</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="namespaceoperations__research_1_1glop.html#a4066bdd6e74f798c189fa8e830fcd37b">MPModelProtoToLinearProgram</a>(<span class="keyword">const</span> MPModelProto&amp; <a class="code hl_function" href="parser_8yy_8cc.html#a5a634cf4429798b1c921a81de8250051">input</a>,</div>
<div class="line"><a id="l00052" name="l00052"></a><span class="lineno"> 52</span> <a class="code hl_class" href="classoperations__research_1_1glop_1_1_linear_program.html">LinearProgram</a>* output) {</div>
<div class="line"><a id="l00053" name="l00053"></a><span class="lineno"> 53</span> output-&gt;<a class="code hl_function" href="classoperations__research_1_1glop_1_1_linear_program.html#aa71d36872f416feaa853788a7a7a7ef8">Clear</a>();</div>
<div class="line"><a id="l00054" name="l00054"></a><span class="lineno"> 54</span> output-&gt;<a class="code hl_function" href="classoperations__research_1_1glop_1_1_linear_program.html#a940d484bb6523277e1d2c742f4f534a4">SetName</a>(<a class="code hl_function" href="parser_8yy_8cc.html#a5a634cf4429798b1c921a81de8250051">input</a>.name());</div>
<div class="line"><a id="l00055" name="l00055"></a><span class="lineno"> 55</span> output-&gt;<a class="code hl_function" href="classoperations__research_1_1glop_1_1_linear_program.html#ae3201a343d8df987411b55830bff7fa3">SetMaximizationProblem</a>(<a class="code hl_function" href="parser_8yy_8cc.html#a5a634cf4429798b1c921a81de8250051">input</a>.maximize());</div>
<div class="line"><a id="l00056" name="l00056"></a><span class="lineno"> 56</span> output-&gt;<a class="code hl_function" href="classoperations__research_1_1glop_1_1_linear_program.html#a2a29cc40908e09b0c565ceea15b77d89">SetObjectiveOffset</a>(<a class="code hl_function" href="parser_8yy_8cc.html#a5a634cf4429798b1c921a81de8250051">input</a>.objective_offset());</div>
<div class="line"><a id="l00057" name="l00057"></a><span class="lineno"> 57</span> <span class="comment">// TODO(user): clean up loops to use natural range iteration.</span></div>
<div class="line"><a id="l00058" name="l00058"></a><span class="lineno"> 58</span> <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; <a class="code hl_function" href="parser_8yy_8cc.html#a5a634cf4429798b1c921a81de8250051">input</a>.variable_size(); ++i) {</div>
<div class="line"><a id="l00059" name="l00059"></a><span class="lineno"> 59</span> <span class="keyword">const</span> MPVariableProto&amp; <a class="code hl_variable" href="expr__array_8cc.html#a472a99923cbe11ae7b5a5d157d9ad465">var</a> = <a class="code hl_function" href="parser_8yy_8cc.html#a5a634cf4429798b1c921a81de8250051">input</a>.variable(i);</div>
<div class="line"><a id="l00060" name="l00060"></a><span class="lineno"> 60</span> <span class="keyword">const</span> ColIndex <a class="code hl_variable" href="markowitz_8cc.html#aa9d6c98fdf8d89b0e2321fda02adc82c">col</a> = output-&gt;<a class="code hl_function" href="classoperations__research_1_1glop_1_1_linear_program.html#a695ac3d8db5a986f572711f2ef3a6a39">CreateNewVariable</a>();</div>
<div class="line"><a id="l00061" name="l00061"></a><span class="lineno"> 61</span> output-&gt;<a class="code hl_function" href="classoperations__research_1_1glop_1_1_linear_program.html#a45e12b3d1e2daa3e00bab9d7bf72f444">SetVariableName</a>(<a class="code hl_variable" href="markowitz_8cc.html#aa9d6c98fdf8d89b0e2321fda02adc82c">col</a>, <a class="code hl_variable" href="expr__array_8cc.html#a472a99923cbe11ae7b5a5d157d9ad465">var</a>.name());</div>
<div class="line"><a id="l00062" name="l00062"></a><span class="lineno"> 62</span> output-&gt;<a class="code hl_function" href="classoperations__research_1_1glop_1_1_linear_program.html#a0fe7ba825c8c6cd1efdcff6dec631093">SetVariableBounds</a>(<a class="code hl_variable" href="markowitz_8cc.html#aa9d6c98fdf8d89b0e2321fda02adc82c">col</a>, <a class="code hl_variable" href="expr__array_8cc.html#a472a99923cbe11ae7b5a5d157d9ad465">var</a>.lower_bound(), <a class="code hl_variable" href="expr__array_8cc.html#a472a99923cbe11ae7b5a5d157d9ad465">var</a>.upper_bound());</div>
<div class="line"><a id="l00063" name="l00063"></a><span class="lineno"> 63</span> output-&gt;<a class="code hl_function" href="classoperations__research_1_1glop_1_1_linear_program.html#ab5af7f232cddcd91f70be84c0d398ba9">SetObjectiveCoefficient</a>(<a class="code hl_variable" href="markowitz_8cc.html#aa9d6c98fdf8d89b0e2321fda02adc82c">col</a>, <a class="code hl_variable" href="expr__array_8cc.html#a472a99923cbe11ae7b5a5d157d9ad465">var</a>.objective_coefficient());</div>
<div class="line"><a id="l00064" name="l00064"></a><span class="lineno"> 64</span> <span class="keywordflow">if</span> (<a class="code hl_variable" href="expr__array_8cc.html#a472a99923cbe11ae7b5a5d157d9ad465">var</a>.is_integer()) {</div>
<div class="line"><a id="l00065" name="l00065"></a><span class="lineno"> 65</span> output-&gt;<a class="code hl_function" href="classoperations__research_1_1glop_1_1_linear_program.html#a7ddcdc56f25d075e18d62ddbcd3389b2">SetVariableType</a>(<a class="code hl_variable" href="markowitz_8cc.html#aa9d6c98fdf8d89b0e2321fda02adc82c">col</a>, <a class="code hl_enumvalue" href="classoperations__research_1_1glop_1_1_linear_program.html#ac62972ff1b21a037e56530cde67309aba5d5cd46919fa987731fb2edefe0f2a0c">LinearProgram::VariableType::INTEGER</a>);</div>
<div class="line"><a id="l00066" name="l00066"></a><span class="lineno"> 66</span> }</div>
<div class="line"><a id="l00067" name="l00067"></a><span class="lineno"> 67</span> }</div>
<div class="line"><a id="l00068" name="l00068"></a><span class="lineno"> 68</span> <span class="keywordflow">for</span> (<span class="keywordtype">int</span> j = 0; j &lt; <a class="code hl_function" href="parser_8yy_8cc.html#a5a634cf4429798b1c921a81de8250051">input</a>.constraint_size(); ++j) {</div>
<div class="line"><a id="l00069" name="l00069"></a><span class="lineno"> 69</span> <span class="keyword">const</span> MPConstraintProto&amp; cst = <a class="code hl_function" href="parser_8yy_8cc.html#a5a634cf4429798b1c921a81de8250051">input</a>.constraint(j);</div>
<div class="line"><a id="l00070" name="l00070"></a><span class="lineno"> 70</span> <span class="keyword">const</span> RowIndex <a class="code hl_variable" href="markowitz_8cc.html#aea35f36ba98d5bbd8d033382f50c9e52">row</a> = output-&gt;<a class="code hl_function" href="classoperations__research_1_1glop_1_1_linear_program.html#ad9d564651057c77b3f2ca1293134557f">CreateNewConstraint</a>();</div>
<div class="line"><a id="l00071" name="l00071"></a><span class="lineno"> 71</span> output-&gt;<a class="code hl_function" href="classoperations__research_1_1glop_1_1_linear_program.html#a1c4c019028d8b012b9d10e0a17bfaf4e">SetConstraintName</a>(<a class="code hl_variable" href="markowitz_8cc.html#aea35f36ba98d5bbd8d033382f50c9e52">row</a>, cst.name());</div>
<div class="line"><a id="l00072" name="l00072"></a><span class="lineno"> 72</span> output-&gt;<a class="code hl_function" href="classoperations__research_1_1glop_1_1_linear_program.html#a62b98dec38b6506442f9fc63f1a9b88f">SetConstraintBounds</a>(<a class="code hl_variable" href="markowitz_8cc.html#aea35f36ba98d5bbd8d033382f50c9e52">row</a>, cst.lower_bound(), cst.upper_bound());</div>
<div class="line"><a id="l00073" name="l00073"></a><span class="lineno"> 73</span> <span class="comment">// TODO(user): implement strong proto validation in the</span></div>
<div class="line"><a id="l00074" name="l00074"></a><span class="lineno"> 74</span> <span class="comment">// linear solver server and re-use it here.</span></div>
<div class="line"><a id="l00075" name="l00075"></a><span class="lineno"> 75</span> <a class="code hl_define" href="base_2logging_8h.html#a7c0ce053b28d53aa4eaf3eb7fb71663b">CHECK_EQ</a>(cst.var_index_size(), cst.coefficient_size());</div>
<div class="line"><a id="l00076" name="l00076"></a><span class="lineno"> 76</span> <span class="keywordflow">for</span> (<span class="keywordtype">int</span> k = 0; k &lt; cst.var_index_size(); ++k) {</div>
<div class="line"><a id="l00077" name="l00077"></a><span class="lineno"> 77</span> output-&gt;<a class="code hl_function" href="classoperations__research_1_1glop_1_1_linear_program.html#a2d695f450ae446d5d9c225b991f8d88e">SetCoefficient</a>(<a class="code hl_variable" href="markowitz_8cc.html#aea35f36ba98d5bbd8d033382f50c9e52">row</a>, ColIndex(cst.var_index(k)),</div>
<div class="line"><a id="l00078" name="l00078"></a><span class="lineno"> 78</span> cst.coefficient(k));</div>
<div class="line"><a id="l00079" name="l00079"></a><span class="lineno"> 79</span> }</div>
<div class="line"><a id="l00080" name="l00080"></a><span class="lineno"> 80</span> }</div>
<div class="line"><a id="l00081" name="l00081"></a><span class="lineno"> 81</span> output-&gt;<a class="code hl_function" href="classoperations__research_1_1glop_1_1_linear_program.html#abfc30f91ab75c6f4552003f777672e74">CleanUp</a>();</div>
<div class="line"><a id="l00082" name="l00082"></a><span class="lineno"> 82</span>}</div>
<div class="line"><a id="l00083" name="l00083"></a><span class="lineno"> 83</span> </div>
<div class="line"><a id="l00084" name="l00084"></a><span class="lineno"> 84</span>} <span class="comment">// namespace glop</span></div>
<div class="line"><a id="l00085" name="l00085"></a><span class="lineno"> 85</span>} <span class="comment">// namespace operations_research</span></div>
<div class="ttc" id="abase_2logging_8h_html_a7c0ce053b28d53aa4eaf3eb7fb71663b"><div class="ttname"><a href="base_2logging_8h.html#a7c0ce053b28d53aa4eaf3eb7fb71663b">CHECK_EQ</a></div><div class="ttdeci">#define CHECK_EQ(val1, val2)</div><div class="ttdef"><b>Definition:</b> <a href="base_2logging_8h_source.html#l00703">base/logging.h:703</a></div></div>
<div class="ttc" id="aclassoperations__research_1_1glop_1_1_linear_program_html"><div class="ttname"><a href="classoperations__research_1_1glop_1_1_linear_program.html">operations_research::glop::LinearProgram</a></div><div class="ttdef"><b>Definition:</b> <a href="lp__data_8h_source.html#l00055">lp_data.h:55</a></div></div>
<div class="ttc" id="aclassoperations__research_1_1glop_1_1_linear_program_html_a0fe7ba825c8c6cd1efdcff6dec631093"><div class="ttname"><a href="classoperations__research_1_1glop_1_1_linear_program.html#a0fe7ba825c8c6cd1efdcff6dec631093">operations_research::glop::LinearProgram::SetVariableBounds</a></div><div class="ttdeci">void SetVariableBounds(ColIndex col, Fractional lower_bound, Fractional upper_bound)</div><div class="ttdef"><b>Definition:</b> <a href="lp__data_8cc_source.html#l00249">lp_data.cc:249</a></div></div>
<div class="ttc" id="aclassoperations__research_1_1glop_1_1_linear_program_html_a1c4c019028d8b012b9d10e0a17bfaf4e"><div class="ttname"><a href="classoperations__research_1_1glop_1_1_linear_program.html#a1c4c019028d8b012b9d10e0a17bfaf4e">operations_research::glop::LinearProgram::SetConstraintName</a></div><div class="ttdeci">void SetConstraintName(RowIndex row, absl::string_view name)</div><div class="ttdef"><b>Definition:</b> <a href="lp__data_8cc_source.html#l00245">lp_data.cc:245</a></div></div>
<div class="ttc" id="aclassoperations__research_1_1glop_1_1_linear_program_html_a2a29cc40908e09b0c565ceea15b77d89"><div class="ttname"><a href="classoperations__research_1_1glop_1_1_linear_program.html#a2a29cc40908e09b0c565ceea15b77d89">operations_research::glop::LinearProgram::SetObjectiveOffset</a></div><div class="ttdeci">void SetObjectiveOffset(Fractional objective_offset)</div><div class="ttdef"><b>Definition:</b> <a href="lp__data_8cc_source.html#l00331">lp_data.cc:331</a></div></div>
<div class="ttc" id="aclassoperations__research_1_1glop_1_1_linear_program_html_a2d695f450ae446d5d9c225b991f8d88e"><div class="ttname"><a href="classoperations__research_1_1glop_1_1_linear_program.html#a2d695f450ae446d5d9c225b991f8d88e">operations_research::glop::LinearProgram::SetCoefficient</a></div><div class="ttdeci">void SetCoefficient(RowIndex row, ColIndex col, Fractional value)</div><div class="ttdef"><b>Definition:</b> <a href="lp__data_8cc_source.html#l00317">lp_data.cc:317</a></div></div>
<div class="ttc" id="aclassoperations__research_1_1glop_1_1_linear_program_html_a45e12b3d1e2daa3e00bab9d7bf72f444"><div class="ttname"><a href="classoperations__research_1_1glop_1_1_linear_program.html#a45e12b3d1e2daa3e00bab9d7bf72f444">operations_research::glop::LinearProgram::SetVariableName</a></div><div class="ttdeci">void SetVariableName(ColIndex col, absl::string_view name)</div><div class="ttdef"><b>Definition:</b> <a href="lp__data_8cc_source.html#l00232">lp_data.cc:232</a></div></div>
<div class="ttc" id="aclassoperations__research_1_1glop_1_1_linear_program_html_a62b98dec38b6506442f9fc63f1a9b88f"><div class="ttname"><a href="classoperations__research_1_1glop_1_1_linear_program.html#a62b98dec38b6506442f9fc63f1a9b88f">operations_research::glop::LinearProgram::SetConstraintBounds</a></div><div class="ttdeci">void SetConstraintBounds(RowIndex row, Fractional lower_bound, Fractional upper_bound)</div><div class="ttdef"><b>Definition:</b> <a href="lp__data_8cc_source.html#l00309">lp_data.cc:309</a></div></div>
<div class="ttc" id="aclassoperations__research_1_1glop_1_1_linear_program_html_a695ac3d8db5a986f572711f2ef3a6a39"><div class="ttname"><a href="classoperations__research_1_1glop_1_1_linear_program.html#a695ac3d8db5a986f572711f2ef3a6a39">operations_research::glop::LinearProgram::CreateNewVariable</a></div><div class="ttdeci">ColIndex CreateNewVariable()</div><div class="ttdef"><b>Definition:</b> <a href="lp__data_8cc_source.html#l00162">lp_data.cc:162</a></div></div>
<div class="ttc" id="aclassoperations__research_1_1glop_1_1_linear_program_html_a7ddcdc56f25d075e18d62ddbcd3389b2"><div class="ttname"><a href="classoperations__research_1_1glop_1_1_linear_program.html#a7ddcdc56f25d075e18d62ddbcd3389b2">operations_research::glop::LinearProgram::SetVariableType</a></div><div class="ttdeci">void SetVariableType(ColIndex col, VariableType type)</div><div class="ttdef"><b>Definition:</b> <a href="lp__data_8cc_source.html#l00236">lp_data.cc:236</a></div></div>
<div class="ttc" id="aclassoperations__research_1_1glop_1_1_linear_program_html_a940d484bb6523277e1d2c742f4f534a4"><div class="ttname"><a href="classoperations__research_1_1glop_1_1_linear_program.html#a940d484bb6523277e1d2c742f4f534a4">operations_research::glop::LinearProgram::SetName</a></div><div class="ttdeci">void SetName(const std::string &amp;name)</div><div class="ttdef"><b>Definition:</b> <a href="lp__data_8h_source.html#l00074">lp_data.h:74</a></div></div>
<div class="ttc" id="aclassoperations__research_1_1glop_1_1_linear_program_html_aa71d36872f416feaa853788a7a7a7ef8"><div class="ttname"><a href="classoperations__research_1_1glop_1_1_linear_program.html#aa71d36872f416feaa853788a7a7a7ef8">operations_research::glop::LinearProgram::Clear</a></div><div class="ttdeci">void Clear()</div><div class="ttdef"><b>Definition:</b> <a href="lp__data_8cc_source.html#l00134">lp_data.cc:134</a></div></div>
<div class="ttc" id="aclassoperations__research_1_1glop_1_1_linear_program_html_ab5af7f232cddcd91f70be84c0d398ba9"><div class="ttname"><a href="classoperations__research_1_1glop_1_1_linear_program.html#ab5af7f232cddcd91f70be84c0d398ba9">operations_research::glop::LinearProgram::SetObjectiveCoefficient</a></div><div class="ttdeci">void SetObjectiveCoefficient(ColIndex col, Fractional value)</div><div class="ttdef"><b>Definition:</b> <a href="lp__data_8cc_source.html#l00326">lp_data.cc:326</a></div></div>
<div class="ttc" id="aclassoperations__research_1_1glop_1_1_linear_program_html_abfc30f91ab75c6f4552003f777672e74"><div class="ttname"><a href="classoperations__research_1_1glop_1_1_linear_program.html#abfc30f91ab75c6f4552003f777672e74">operations_research::glop::LinearProgram::CleanUp</a></div><div class="ttdeci">void CleanUp()</div><div class="ttdef"><b>Definition:</b> <a href="lp__data_8cc_source.html#l00347">lp_data.cc:347</a></div></div>
<div class="ttc" id="aclassoperations__research_1_1glop_1_1_linear_program_html_ac62972ff1b21a037e56530cde67309aba5d5cd46919fa987731fb2edefe0f2a0c"><div class="ttname"><a href="classoperations__research_1_1glop_1_1_linear_program.html#ac62972ff1b21a037e56530cde67309aba5d5cd46919fa987731fb2edefe0f2a0c">operations_research::glop::LinearProgram::VariableType::INTEGER</a></div><div class="ttdeci">@ INTEGER</div></div>
<div class="ttc" id="aclassoperations__research_1_1glop_1_1_linear_program_html_ad9d564651057c77b3f2ca1293134557f"><div class="ttname"><a href="classoperations__research_1_1glop_1_1_linear_program.html#ad9d564651057c77b3f2ca1293134557f">operations_research::glop::LinearProgram::CreateNewConstraint</a></div><div class="ttdeci">RowIndex CreateNewConstraint()</div><div class="ttdef"><b>Definition:</b> <a href="lp__data_8cc_source.html#l00191">lp_data.cc:191</a></div></div>
<div class="ttc" id="aclassoperations__research_1_1glop_1_1_linear_program_html_ae3201a343d8df987411b55830bff7fa3"><div class="ttname"><a href="classoperations__research_1_1glop_1_1_linear_program.html#ae3201a343d8df987411b55830bff7fa3">operations_research::glop::LinearProgram::SetMaximizationProblem</a></div><div class="ttdeci">void SetMaximizationProblem(bool maximize)</div><div class="ttdef"><b>Definition:</b> <a href="lp__data_8cc_source.html#l00343">lp_data.cc:343</a></div></div>
<div class="ttc" id="aclassoperations__research_1_1glop_1_1_sparse_matrix_html"><div class="ttname"><a href="classoperations__research_1_1glop_1_1_sparse_matrix.html">operations_research::glop::SparseMatrix</a></div><div class="ttdef"><b>Definition:</b> <a href="sparse_8h_source.html#l00062">sparse.h:62</a></div></div>
<div class="ttc" id="aclassoperations__research_1_1glop_1_1_sparse_matrix_html_a2fe6f7470512f5301031480737375c88"><div class="ttname"><a href="classoperations__research_1_1glop_1_1_sparse_matrix.html#a2fe6f7470512f5301031480737375c88">operations_research::glop::SparseMatrix::PopulateFromTranspose</a></div><div class="ttdeci">void PopulateFromTranspose(const Matrix &amp;input)</div><div class="ttdef"><b>Definition:</b> <a href="sparse_8cc_source.html#l00181">sparse.cc:181</a></div></div>
<div class="ttc" id="aclassoperations__research_1_1glop_1_1_sparse_matrix_html_a7273cc492a51a1c5d45c620b32fce502"><div class="ttname"><a href="classoperations__research_1_1glop_1_1_sparse_matrix.html#a7273cc492a51a1c5d45c620b32fce502">operations_research::glop::SparseMatrix::column</a></div><div class="ttdeci">const SparseColumn &amp; column(ColIndex col) const</div><div class="ttdef"><b>Definition:</b> <a href="sparse_8h_source.html#l00181">sparse.h:181</a></div></div>
<div class="ttc" id="aclassoperations__research_1_1glop_1_1_sparse_vector_html_ab38326ea6cb6187267665dd8b2748f3d"><div class="ttname"><a href="classoperations__research_1_1glop_1_1_sparse_vector.html#ab38326ea6cb6187267665dd8b2748f3d">operations_research::glop::SparseVector&lt; RowIndex, SparseColumnIterator &gt;::Entry</a></div><div class="ttdeci">typename Iterator::Entry Entry</div><div class="ttdef"><b>Definition:</b> <a href="lp__data_2sparse__vector_8h_source.html#l00091">lp_data/sparse_vector.h:91</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#l01874">expr_array.cc:1874</a></div></div>
<div class="ttc" id="alp__data_2proto__utils_8h_html"><div class="ttname"><a href="lp__data_2proto__utils_8h.html">proto_utils.h</a></div></div>
<div class="ttc" id="amarkowitz_8cc_html_aa9d6c98fdf8d89b0e2321fda02adc82c"><div class="ttname"><a href="markowitz_8cc.html#aa9d6c98fdf8d89b0e2321fda02adc82c">col</a></div><div class="ttdeci">ColIndex col</div><div class="ttdef"><b>Definition:</b> <a href="markowitz_8cc_source.html#l00183">markowitz.cc:183</a></div></div>
<div class="ttc" id="amarkowitz_8cc_html_aea35f36ba98d5bbd8d033382f50c9e52"><div class="ttname"><a href="markowitz_8cc.html#aea35f36ba98d5bbd8d033382f50c9e52">row</a></div><div class="ttdeci">RowIndex row</div><div class="ttdef"><b>Definition:</b> <a href="markowitz_8cc_source.html#l00182">markowitz.cc:182</a></div></div>
<div class="ttc" id="anamespaceoperations__research_1_1glop_html_a4066bdd6e74f798c189fa8e830fcd37b"><div class="ttname"><a href="namespaceoperations__research_1_1glop.html#a4066bdd6e74f798c189fa8e830fcd37b">operations_research::glop::MPModelProtoToLinearProgram</a></div><div class="ttdeci">void MPModelProtoToLinearProgram(const MPModelProto &amp;input, LinearProgram *output)</div><div class="ttdef"><b>Definition:</b> <a href="proto__utils_8cc_source.html#l00051">proto_utils.cc:51</a></div></div>
<div class="ttc" id="anamespaceoperations__research_1_1glop_html_a8750840afdd5774223821fd504df04c5"><div class="ttname"><a href="namespaceoperations__research_1_1glop.html#a8750840afdd5774223821fd504df04c5">operations_research::glop::LinearProgramToMPModelProto</a></div><div class="ttdeci">void LinearProgramToMPModelProto(const LinearProgram &amp;input, MPModelProto *output)</div><div class="ttdef"><b>Definition:</b> <a href="proto__utils_8cc_source.html#l00020">proto_utils.cc:20</a></div></div>
<div class="ttc" id="anamespaceoperations__research_1_1glop_html_a8fbc9efd86a3cc862a9079d86ab8b524"><div class="ttname"><a href="namespaceoperations__research_1_1glop.html#a8fbc9efd86a3cc862a9079d86ab8b524">operations_research::glop::RowToColIndex</a></div><div class="ttdeci">ColIndex RowToColIndex(RowIndex row)</div><div class="ttdef"><b>Definition:</b> <a href="lp__types_8h_source.html#l00049">lp_types.h:49</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">Collection of objects used to extend the Constraint Solver library.</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="aparser_8yy_8cc_html_a5a634cf4429798b1c921a81de8250051"><div class="ttname"><a href="parser_8yy_8cc.html#a5a634cf4429798b1c921a81de8250051">input</a></div><div class="ttdeci">static int input(yyscan_t yyscanner)</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_903a7ff076ee7f01be86992fe717fc82.html">lp_data</a></li><li class="navelem"><a class="el" href="proto__utils_8cc.html">proto_utils.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.3 </li>
</ul>
</div>
</body>
</html>