Files
ortools-clone/docs/java/LinearExpr_8java_source.html
2019-08-07 18:01:08 -07:00

104 lines
16 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"/>-->
<link rel="stylesheet" type="text/css" href="ortools.css" title="default" media="screen,print" />
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
</head>
<body>
<div id="banner-container">
<div id="banner">
<span id="sfml">OR-Tools 7.3</span>
</div>
</div>
<link rel="icon" href="https://developers.google.com/optimization/images/orLogo.png">
<div id="content" style="width: 100%; overflow: hidden;">
<div style="margin-left: 15px; margin-top: 5px; float: left; color: #145A32;">
<h2>Reference</h2>
<h3>C++</h3>
<ul>
<li><a href="../cpp_algorithms/annotated.html">Algorithms</a></li>
<li><a href="../cpp_graph/annotated.html">Graph</a></li>
<li><a href="../cpp_routing/annotated.html">Routing</a></li>
<li><a href="../cpp_linear/annotated.html">Linear solver</a></li>
<li><a href="../cpp_sat/annotated.html">CP-SAT</a></li>
</ul>
<h3>Python</h3>
<ul>
<li><a href="../python/ortools/sat/python/cp_model.html">CP-SAT</a></li>
<li><a href="../python/ortools/util/sorted_interval_list.html">Domain</a></li>
<li><a href="../python/ortools/graph/pywrapgraph.html">Graph</a></li>
<li><a href="../python/ortools/algorithms/pywrapknapsack_solver.html">Knapsack solver</a></li>
<li><a href="../python/ortools/linear_solver/pywraplp.html">Linear solver</a></li>
<li><a href="../python/ortools/constraint_solver/pywrapcp.html">Routing</a></li>
</ul>
<h3 id="dotnet-documentation">DotNET</h3>
<ul>
<li><a href="../dotnet/namespaceGoogle_1_1OrTools_1_1Sat.html">CP-SAT</a></li>
<li><a href="../dotnet/namespaceGoogle_1_1OrTools_1_1Graph.html">Graph</a></li>
<li><a href="../dotnet/namespaceGoogle_1_1OrTools_1_1Algorithms.html">Knapsack solver</a></li>
<li><a href="../dotnet/namespaceGoogle_1_1OrTools_1_1LinearSolver.html">Linear solver</a></li>
<li><a href="../dotnet/namespaceGoogle_1_1OrTools_1_1ConstraintSolver.html">Routing</a></li>
<li><a href="../dotnet/namespaceGoogle_1_1OrTools_1_1Util.html">Util</a></li>
</ul>
<h3 id="java-documentation">Java Documentation</h3>
<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.8.15 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main&#160;Page</span></a></li>
<li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File&#160;List</span></a></li>
</ul>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="dir_a7cc1eeded8f693d0da6c729bc88c45a.html">ortools</a></li><li class="navelem"><a class="el" href="dir_ed7866a075c77e634cb451a432014e49.html">com</a></li><li class="navelem"><a class="el" href="dir_ed93e231cce03906e5c9f1a0e4259679.html">google</a></li><li class="navelem"><a class="el" href="dir_e79f93676144f0f6b8f1180b80d43c5b.html">ortools</a></li><li class="navelem"><a class="el" href="dir_e5ee533e9c8def55a36155ecb53c6410.html">sat</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="headertitle">
<div class="title">LinearExpr.java</div> </div>
</div><!--header-->
<div class="contents">
<a href="LinearExpr_8java.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="keyword">package </span>com.google.ortools.sat;</div><div class="line"><a name="l00015"></a><span class="lineno"> 15</span>&#160;</div><div class="line"><a name="l00017"></a><span class="lineno"><a class="line" href="interfacecom_1_1google_1_1ortools_1_1sat_1_1LinearExpr.html"> 17</a></span>&#160;<span class="keyword">public</span> <span class="keyword">interface </span><a class="code" href="interfacecom_1_1google_1_1ortools_1_1sat_1_1LinearExpr.html">LinearExpr</a> {</div><div class="line"><a name="l00019"></a><span class="lineno"> 19</span>&#160; <span class="keywordtype">int</span> <a class="code" href="interfacecom_1_1google_1_1ortools_1_1sat_1_1LinearExpr.html#a59f9cb76db051cd784a42f38220f896d">numElements</a>();</div><div class="line"><a name="l00020"></a><span class="lineno"> 20</span>&#160;</div><div class="line"><a name="l00022"></a><span class="lineno"> 22</span>&#160; <a class="code" href="classcom_1_1google_1_1ortools_1_1sat_1_1IntVar.html">IntVar</a> <a class="code" href="interfacecom_1_1google_1_1ortools_1_1sat_1_1LinearExpr.html#aff988e01e71c0dd3c11e6f970a209520">getVariable</a>(<span class="keywordtype">int</span> index);</div><div class="line"><a name="l00023"></a><span class="lineno"> 23</span>&#160;</div><div class="line"><a name="l00025"></a><span class="lineno"> 25</span>&#160; <span class="keywordtype">long</span> <a class="code" href="interfacecom_1_1google_1_1ortools_1_1sat_1_1LinearExpr.html#a2c77626134edecc47b69efe661ea1904">getCoefficient</a>(<span class="keywordtype">int</span> index);</div><div class="line"><a name="l00026"></a><span class="lineno"> 26</span>&#160;</div><div class="line"><a name="l00028"></a><span class="lineno"><a class="line" href="interfacecom_1_1google_1_1ortools_1_1sat_1_1LinearExpr.html#aafaf7ba9f072b09e687ed03fb4d98b4a"> 28</a></span>&#160; <span class="keyword">static</span> <a class="code" href="interfacecom_1_1google_1_1ortools_1_1sat_1_1LinearExpr.html">LinearExpr</a> <a class="code" href="interfacecom_1_1google_1_1ortools_1_1sat_1_1LinearExpr.html#aafaf7ba9f072b09e687ed03fb4d98b4a">sum</a>(<a class="code" href="classcom_1_1google_1_1ortools_1_1sat_1_1IntVar.html">IntVar</a>[] variables) {</div><div class="line"><a name="l00029"></a><span class="lineno"> 29</span>&#160; <span class="keywordflow">return</span> <span class="keyword">new</span> SumOfVariables(variables);</div><div class="line"><a name="l00030"></a><span class="lineno"> 30</span>&#160; }</div><div class="line"><a name="l00031"></a><span class="lineno"> 31</span>&#160;</div><div class="line"><a name="l00033"></a><span class="lineno"><a class="line" href="interfacecom_1_1google_1_1ortools_1_1sat_1_1LinearExpr.html#add2c1c4ca7d2bd87e429a5044df28417"> 33</a></span>&#160; <span class="keyword">static</span> <a class="code" href="interfacecom_1_1google_1_1ortools_1_1sat_1_1LinearExpr.html">LinearExpr</a> <a class="code" href="interfacecom_1_1google_1_1ortools_1_1sat_1_1LinearExpr.html#add2c1c4ca7d2bd87e429a5044df28417">scalProd</a>(<a class="code" href="classcom_1_1google_1_1ortools_1_1sat_1_1IntVar.html">IntVar</a>[] variables, <span class="keywordtype">long</span>[] coefficients) {</div><div class="line"><a name="l00034"></a><span class="lineno"> 34</span>&#160; <span class="keywordflow">return</span> <span class="keyword">new</span> ScalProd(variables, coefficients);</div><div class="line"><a name="l00035"></a><span class="lineno"> 35</span>&#160; }</div><div class="line"><a name="l00036"></a><span class="lineno"> 36</span>&#160;</div><div class="line"><a name="l00038"></a><span class="lineno"><a class="line" href="interfacecom_1_1google_1_1ortools_1_1sat_1_1LinearExpr.html#adc5cb20cefb7b9bfa251adc4a57eb2bb"> 38</a></span>&#160; <span class="keyword">static</span> <a class="code" href="interfacecom_1_1google_1_1ortools_1_1sat_1_1LinearExpr.html">LinearExpr</a> <a class="code" href="interfacecom_1_1google_1_1ortools_1_1sat_1_1LinearExpr.html#adc5cb20cefb7b9bfa251adc4a57eb2bb">scalProd</a>(<a class="code" href="classcom_1_1google_1_1ortools_1_1sat_1_1IntVar.html">IntVar</a>[] variables, <span class="keywordtype">int</span>[] coefficients) {</div><div class="line"><a name="l00039"></a><span class="lineno"> 39</span>&#160; <span class="keywordtype">long</span>[] tmp = <span class="keyword">new</span> <span class="keywordtype">long</span>[coefficients.length];</div><div class="line"><a name="l00040"></a><span class="lineno"> 40</span>&#160; <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; coefficients.length; ++i) {</div><div class="line"><a name="l00041"></a><span class="lineno"> 41</span>&#160; tmp[i] = coefficients[i];</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; <span class="keywordflow">return</span> <span class="keyword">new</span> ScalProd(variables, tmp);</div><div class="line"><a name="l00044"></a><span class="lineno"> 44</span>&#160; }</div><div class="line"><a name="l00045"></a><span class="lineno"> 45</span>&#160;}</div><div class="ttc" id="interfacecom_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#l00017">LinearExpr.java:17</a></div></div>
<div class="ttc" id="interfacecom_1_1google_1_1ortools_1_1sat_1_1LinearExpr_html_aafaf7ba9f072b09e687ed03fb4d98b4a"><div class="ttname"><a href="interfacecom_1_1google_1_1ortools_1_1sat_1_1LinearExpr.html#aafaf7ba9f072b09e687ed03fb4d98b4a">com.google.ortools.sat.LinearExpr.sum</a></div><div class="ttdeci">static LinearExpr sum(IntVar[] variables)</div><div class="ttdoc">Creates a sum expression.</div><div class="ttdef"><b>Definition:</b> <a href="LinearExpr_8java_source.html#l00028">LinearExpr.java:28</a></div></div>
<div class="ttc" id="interfacecom_1_1google_1_1ortools_1_1sat_1_1LinearExpr_html_add2c1c4ca7d2bd87e429a5044df28417"><div class="ttname"><a href="interfacecom_1_1google_1_1ortools_1_1sat_1_1LinearExpr.html#add2c1c4ca7d2bd87e429a5044df28417">com.google.ortools.sat.LinearExpr.scalProd</a></div><div class="ttdeci">static LinearExpr scalProd(IntVar[] variables, long[] coefficients)</div><div class="ttdoc">Creates a scalar product.</div><div class="ttdef"><b>Definition:</b> <a href="LinearExpr_8java_source.html#l00033">LinearExpr.java:33</a></div></div>
<div class="ttc" id="interfacecom_1_1google_1_1ortools_1_1sat_1_1LinearExpr_html_aff988e01e71c0dd3c11e6f970a209520"><div class="ttname"><a href="interfacecom_1_1google_1_1ortools_1_1sat_1_1LinearExpr.html#aff988e01e71c0dd3c11e6f970a209520">com.google.ortools.sat.LinearExpr.getVariable</a></div><div class="ttdeci">IntVar getVariable(int index)</div><div class="ttdoc">Returns the ith variable.</div></div>
<div class="ttc" id="interfacecom_1_1google_1_1ortools_1_1sat_1_1LinearExpr_html_a59f9cb76db051cd784a42f38220f896d"><div class="ttname"><a href="interfacecom_1_1google_1_1ortools_1_1sat_1_1LinearExpr.html#a59f9cb76db051cd784a42f38220f896d">com.google.ortools.sat.LinearExpr.numElements</a></div><div class="ttdeci">int numElements()</div><div class="ttdoc">Returns the number of elements in the interface.</div></div>
<div class="ttc" id="classcom_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="com_2google_2ortools_2sat_2IntVar_8java_source.html#l00021">com/google/ortools/sat/IntVar.java:21</a></div></div>
<div class="ttc" id="interfacecom_1_1google_1_1ortools_1_1sat_1_1LinearExpr_html_adc5cb20cefb7b9bfa251adc4a57eb2bb"><div class="ttname"><a href="interfacecom_1_1google_1_1ortools_1_1sat_1_1LinearExpr.html#adc5cb20cefb7b9bfa251adc4a57eb2bb">com.google.ortools.sat.LinearExpr.scalProd</a></div><div class="ttdeci">static LinearExpr scalProd(IntVar[] variables, int[] coefficients)</div><div class="ttdoc">Creates a scalar product.</div><div class="ttdef"><b>Definition:</b> <a href="LinearExpr_8java_source.html#l00038">LinearExpr.java:38</a></div></div>
<div class="ttc" id="interfacecom_1_1google_1_1ortools_1_1sat_1_1LinearExpr_html_a2c77626134edecc47b69efe661ea1904"><div class="ttname"><a href="interfacecom_1_1google_1_1ortools_1_1sat_1_1LinearExpr.html#a2c77626134edecc47b69efe661ea1904">com.google.ortools.sat.LinearExpr.getCoefficient</a></div><div class="ttdeci">long getCoefficient(int index)</div><div class="ttdoc">Returns the ith coefficient.</div></div>
</div><!-- fragment --></div><!-- contents -->
</div>
</div>
<div id="footer-container">
<div id="footer">
</div>
</div>
</body>
</html>