158 lines
18 KiB
HTML
158 lines
18 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
<head>
|
|
<title>OR-Tools</title>
|
|
<meta http-equiv="Content-Type" content="text/html;"/>
|
|
<meta charset="utf-8"/>
|
|
<!--<link rel='stylesheet' type='text/css' href="https://fonts.googleapis.com/css?family=Ubuntu:400,700,400italic"/>-->
|
|
<script type="text/javascript" src="jquery.js"></script>
|
|
<script type="text/javascript" src="dynsections.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="banner-container">
|
|
<div id="banner">
|
|
<span id="sfml">Google OR-Tools 9.2</span>
|
|
</div>
|
|
</div>
|
|
<div id="content" style="width: 100%; overflow: hidden;">
|
|
<div style="margin-left: 15px; margin-top: 5px; float: left; color: #145A32;">
|
|
<h2>Java Reference</h2>
|
|
<ul>
|
|
<li><a href="../java/namespacecom_1_1google_1_1ortools_1_1sat.html">CP-SAT</a></li>
|
|
<li><a href="../java/namespacecom_1_1google_1_1ortools_1_1graph.html">Graph</a></li>
|
|
<li><a href="../java/namespacecom_1_1google_1_1ortools_1_1algorithms.html">Knapsack solver</a></li>
|
|
<li><a href="../java/namespacecom_1_1google_1_1ortools_1_1linearsolver.html">Linear solver</a></li>
|
|
<li><a href="../java/namespacecom_1_1google_1_1ortools_1_1constraintsolver.html">Routing</a></li>
|
|
<li><a href="../java/namespacecom_1_1google_1_1ortools_1_1util.html">Util</a></li>
|
|
</ul>
|
|
</div>
|
|
<div id="content">
|
|
<div align="center">
|
|
<h1 style="color: #145A32;">Java Reference</h1>
|
|
</div>
|
|
<!-- Generated by Doxygen 1.9.2 -->
|
|
<script type="text/javascript">
|
|
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&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&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&dn=expat.txt MIT */
|
|
$(document).ready(function(){initNavTree('SumOfVariables_8java_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">SumOfVariables.java</div></div>
|
|
</div><!--header-->
|
|
<div class="contents">
|
|
<a href="SumOfVariables_8java.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 "License");</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 "AS IS" 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="keyword">package </span>com.google.ortools.sat;</div>
|
|
<div class="line"><a id="l00015" name="l00015"></a><span class="lineno"> 15</span> </div>
|
|
<div class="line"><a id="l00017" name="l00017"></a><span class="lineno"><a class="line" href="classcom_1_1google_1_1ortools_1_1sat_1_1SumOfVariables.html"> 17</a></span><span class="keyword">public</span> <span class="keyword">final</span> <span class="keyword">class </span><a class="code hl_class" href="classcom_1_1google_1_1ortools_1_1sat_1_1SumOfVariables.html">SumOfVariables</a> <span class="keyword">implements</span> <a class="code hl_interface" href="interfacecom_1_1google_1_1ortools_1_1sat_1_1LinearExpr.html">LinearExpr</a> {</div>
|
|
<div class="line"><a id="l00018" name="l00018"></a><span class="lineno"> 18</span> <span class="keyword">private</span> <span class="keyword">final</span> <a class="code hl_class" href="classcom_1_1google_1_1ortools_1_1sat_1_1IntVar.html">IntVar</a>[] variables;</div>
|
|
<div class="line"><a id="l00019" name="l00019"></a><span class="lineno"> 19</span> <span class="keyword">private</span> <span class="keyword">final</span> <span class="keywordtype">long</span> offset;</div>
|
|
<div class="line"><a id="l00020" name="l00020"></a><span class="lineno"> 20</span> </div>
|
|
<div class="line"><a id="l00021" name="l00021"></a><span class="lineno"><a class="line" href="classcom_1_1google_1_1ortools_1_1sat_1_1SumOfVariables.html#a119d655e8f906f718f46dfe2ceae76d1"> 21</a></span> <span class="keyword">public</span> <a class="code hl_function" href="classcom_1_1google_1_1ortools_1_1sat_1_1SumOfVariables.html#a119d655e8f906f718f46dfe2ceae76d1">SumOfVariables</a>(<a class="code hl_class" href="classcom_1_1google_1_1ortools_1_1sat_1_1IntVar.html">IntVar</a>[] variables) {</div>
|
|
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno"> 22</span> this.variables = variables;</div>
|
|
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno"> 23</span> this.offset = 0;</div>
|
|
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno"> 24</span> }</div>
|
|
<div class="line"><a id="l00025" name="l00025"></a><span class="lineno"> 25</span> </div>
|
|
<div class="line"><a id="l00026" name="l00026"></a><span class="lineno"><a class="line" href="classcom_1_1google_1_1ortools_1_1sat_1_1SumOfVariables.html#a1461f6462f1985b695e2544aa79df6a7"> 26</a></span> <span class="keyword">public</span> <a class="code hl_function" href="classcom_1_1google_1_1ortools_1_1sat_1_1SumOfVariables.html#a1461f6462f1985b695e2544aa79df6a7">SumOfVariables</a>(<a class="code hl_class" href="classcom_1_1google_1_1ortools_1_1sat_1_1IntVar.html">IntVar</a>[] variables, <span class="keywordtype">long</span> offset) {</div>
|
|
<div class="line"><a id="l00027" name="l00027"></a><span class="lineno"> 27</span> this.variables = variables;</div>
|
|
<div class="line"><a id="l00028" name="l00028"></a><span class="lineno"> 28</span> this.offset = offset;</div>
|
|
<div class="line"><a id="l00029" name="l00029"></a><span class="lineno"> 29</span> }</div>
|
|
<div class="line"><a id="l00030" name="l00030"></a><span class="lineno"> 30</span> </div>
|
|
<div class="line"><a id="l00031" name="l00031"></a><span class="lineno"> 31</span> @Override</div>
|
|
<div class="line"><a id="l00032" name="l00032"></a><span class="lineno"><a class="line" href="classcom_1_1google_1_1ortools_1_1sat_1_1SumOfVariables.html#a59f9cb76db051cd784a42f38220f896d"> 32</a></span> <span class="keyword">public</span> <span class="keywordtype">int</span> <a class="code hl_function" href="classcom_1_1google_1_1ortools_1_1sat_1_1SumOfVariables.html#a59f9cb76db051cd784a42f38220f896d">numElements</a>() {</div>
|
|
<div class="line"><a id="l00033" name="l00033"></a><span class="lineno"> 33</span> <span class="keywordflow">return</span> variables.length;</div>
|
|
<div class="line"><a id="l00034" name="l00034"></a><span class="lineno"> 34</span> }</div>
|
|
<div class="line"><a id="l00035" name="l00035"></a><span class="lineno"> 35</span> </div>
|
|
<div class="line"><a id="l00036" name="l00036"></a><span class="lineno"> 36</span> @Override</div>
|
|
<div class="line"><a id="l00037" name="l00037"></a><span class="lineno"><a class="line" href="classcom_1_1google_1_1ortools_1_1sat_1_1SumOfVariables.html#aff988e01e71c0dd3c11e6f970a209520"> 37</a></span> <span class="keyword">public</span> <a class="code hl_class" href="classcom_1_1google_1_1ortools_1_1sat_1_1IntVar.html">IntVar</a> <a class="code hl_function" href="classcom_1_1google_1_1ortools_1_1sat_1_1SumOfVariables.html#aff988e01e71c0dd3c11e6f970a209520">getVariable</a>(<span class="keywordtype">int</span> index) {</div>
|
|
<div class="line"><a id="l00038" name="l00038"></a><span class="lineno"> 38</span> <span class="keywordflow">if</span> (index < 0 || index >= variables.length) {</div>
|
|
<div class="line"><a id="l00039" name="l00039"></a><span class="lineno"> 39</span> <span class="keywordflow">throw</span> <span class="keyword">new</span> IllegalArgumentException(<span class="stringliteral">"wrong index in LinearExpr.getVariable(): "</span> + index);</div>
|
|
<div class="line"><a id="l00040" name="l00040"></a><span class="lineno"> 40</span> }</div>
|
|
<div class="line"><a id="l00041" name="l00041"></a><span class="lineno"> 41</span> <span class="keywordflow">return</span> variables[index];</div>
|
|
<div class="line"><a id="l00042" name="l00042"></a><span class="lineno"> 42</span> }</div>
|
|
<div class="line"><a id="l00043" name="l00043"></a><span class="lineno"> 43</span> </div>
|
|
<div class="line"><a id="l00044" name="l00044"></a><span class="lineno"> 44</span> @Override</div>
|
|
<div class="line"><a id="l00045" name="l00045"></a><span class="lineno"><a class="line" href="classcom_1_1google_1_1ortools_1_1sat_1_1SumOfVariables.html#a2c77626134edecc47b69efe661ea1904"> 45</a></span> <span class="keyword">public</span> <span class="keywordtype">long</span> <a class="code hl_function" href="classcom_1_1google_1_1ortools_1_1sat_1_1SumOfVariables.html#a2c77626134edecc47b69efe661ea1904">getCoefficient</a>(<span class="keywordtype">int</span> index) {</div>
|
|
<div class="line"><a id="l00046" name="l00046"></a><span class="lineno"> 46</span> <span class="keywordflow">return</span> 1;</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> @Override</div>
|
|
<div class="line"><a id="l00050" name="l00050"></a><span class="lineno"><a class="line" href="classcom_1_1google_1_1ortools_1_1sat_1_1SumOfVariables.html#aa7d6a5c7e69f4efdc6a44b85bbe22f1a"> 50</a></span> <span class="keyword">public</span> <span class="keywordtype">long</span> <a class="code hl_function" href="classcom_1_1google_1_1ortools_1_1sat_1_1SumOfVariables.html#aa7d6a5c7e69f4efdc6a44b85bbe22f1a">getOffset</a>() {</div>
|
|
<div class="line"><a id="l00051" name="l00051"></a><span class="lineno"> 51</span> <span class="keywordflow">return</span> offset;</div>
|
|
<div class="line"><a id="l00052" name="l00052"></a><span class="lineno"> 52</span> }</div>
|
|
<div class="line"><a id="l00053" name="l00053"></a><span class="lineno"> 53</span>}</div>
|
|
<div class="ttc" id="aclasscom_1_1google_1_1ortools_1_1sat_1_1IntVar_html"><div class="ttname"><a href="classcom_1_1google_1_1ortools_1_1sat_1_1IntVar.html">com.google.ortools.sat.IntVar</a></div><div class="ttdoc">An integer variable.</div><div class="ttdef"><b>Definition:</b> <a href="java_2com_2google_2ortools_2sat_2IntVar_8java_source.html#l00021">java/com/google/ortools/sat/IntVar.java:21</a></div></div>
|
|
<div class="ttc" id="aclasscom_1_1google_1_1ortools_1_1sat_1_1SumOfVariables_html"><div class="ttname"><a href="classcom_1_1google_1_1ortools_1_1sat_1_1SumOfVariables.html">com.google.ortools.sat.SumOfVariables</a></div><div class="ttdoc">A linear expression interface that can be parsed.</div><div class="ttdef"><b>Definition:</b> <a href="SumOfVariables_8java_source.html#l00017">SumOfVariables.java:17</a></div></div>
|
|
<div class="ttc" id="aclasscom_1_1google_1_1ortools_1_1sat_1_1SumOfVariables_html_a119d655e8f906f718f46dfe2ceae76d1"><div class="ttname"><a href="classcom_1_1google_1_1ortools_1_1sat_1_1SumOfVariables.html#a119d655e8f906f718f46dfe2ceae76d1">com.google.ortools.sat.SumOfVariables.SumOfVariables</a></div><div class="ttdeci">SumOfVariables(IntVar[] variables)</div><div class="ttdef"><b>Definition:</b> <a href="SumOfVariables_8java_source.html#l00021">SumOfVariables.java:21</a></div></div>
|
|
<div class="ttc" id="aclasscom_1_1google_1_1ortools_1_1sat_1_1SumOfVariables_html_a1461f6462f1985b695e2544aa79df6a7"><div class="ttname"><a href="classcom_1_1google_1_1ortools_1_1sat_1_1SumOfVariables.html#a1461f6462f1985b695e2544aa79df6a7">com.google.ortools.sat.SumOfVariables.SumOfVariables</a></div><div class="ttdeci">SumOfVariables(IntVar[] variables, long offset)</div><div class="ttdef"><b>Definition:</b> <a href="SumOfVariables_8java_source.html#l00026">SumOfVariables.java:26</a></div></div>
|
|
<div class="ttc" id="aclasscom_1_1google_1_1ortools_1_1sat_1_1SumOfVariables_html_a2c77626134edecc47b69efe661ea1904"><div class="ttname"><a href="classcom_1_1google_1_1ortools_1_1sat_1_1SumOfVariables.html#a2c77626134edecc47b69efe661ea1904">com.google.ortools.sat.SumOfVariables.getCoefficient</a></div><div class="ttdeci">long getCoefficient(int index)</div><div class="ttdoc">Returns the ith coefficient.</div><div class="ttdef"><b>Definition:</b> <a href="SumOfVariables_8java_source.html#l00045">SumOfVariables.java:45</a></div></div>
|
|
<div class="ttc" id="aclasscom_1_1google_1_1ortools_1_1sat_1_1SumOfVariables_html_a59f9cb76db051cd784a42f38220f896d"><div class="ttname"><a href="classcom_1_1google_1_1ortools_1_1sat_1_1SumOfVariables.html#a59f9cb76db051cd784a42f38220f896d">com.google.ortools.sat.SumOfVariables.numElements</a></div><div class="ttdeci">int numElements()</div><div class="ttdoc">Returns the number of elements in the interface.</div><div class="ttdef"><b>Definition:</b> <a href="SumOfVariables_8java_source.html#l00032">SumOfVariables.java:32</a></div></div>
|
|
<div class="ttc" id="aclasscom_1_1google_1_1ortools_1_1sat_1_1SumOfVariables_html_aa7d6a5c7e69f4efdc6a44b85bbe22f1a"><div class="ttname"><a href="classcom_1_1google_1_1ortools_1_1sat_1_1SumOfVariables.html#aa7d6a5c7e69f4efdc6a44b85bbe22f1a">com.google.ortools.sat.SumOfVariables.getOffset</a></div><div class="ttdeci">long getOffset()</div><div class="ttdoc">Returns the constant part of the expression.</div><div class="ttdef"><b>Definition:</b> <a href="SumOfVariables_8java_source.html#l00050">SumOfVariables.java:50</a></div></div>
|
|
<div class="ttc" id="aclasscom_1_1google_1_1ortools_1_1sat_1_1SumOfVariables_html_aff988e01e71c0dd3c11e6f970a209520"><div class="ttname"><a href="classcom_1_1google_1_1ortools_1_1sat_1_1SumOfVariables.html#aff988e01e71c0dd3c11e6f970a209520">com.google.ortools.sat.SumOfVariables.getVariable</a></div><div class="ttdeci">IntVar getVariable(int index)</div><div class="ttdoc">Returns the ith variable.</div><div class="ttdef"><b>Definition:</b> <a href="SumOfVariables_8java_source.html#l00037">SumOfVariables.java:37</a></div></div>
|
|
<div class="ttc" id="ainterfacecom_1_1google_1_1ortools_1_1sat_1_1LinearExpr_html"><div class="ttname"><a href="interfacecom_1_1google_1_1ortools_1_1sat_1_1LinearExpr.html">com.google.ortools.sat.LinearExpr</a></div><div class="ttdoc">A linear expression interface that can be parsed.</div><div class="ttdef"><b>Definition:</b> <a href="LinearExpr_8java_source.html#l00020">LinearExpr.java:20</a></div></div>
|
|
</div><!-- fragment --></div><!-- contents -->
|
|
</div><!-- doc-content -->
|
|
</div>
|
|
</div>
|
|
<div id="footer-container">
|
|
<div id="footer">
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html>
|