Files
ortools-clone/docs/cpp_algorithms/knapsack__solver_8h_source.html

79 lines
94 KiB
HTML
Raw Normal View History

<!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">
2019-06-29 18:18:08 +02:00
<span id="sfml">OR-Tools 7.2</span>
</div>
</div>
2019-06-29 18:18:08 +02:00
<link rel="icon" href="https://developers.google.com/optimization/images/orLogo.png">
<div id="content">
<!-- 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="namespaces.html"><span>Namespaces</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
2019-07-15 17:42:24 -07:00
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
</div><!-- top -->
2019-07-12 11:43:12 -07:00
<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:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('knapsack__solver_8h_source.html','');});
/* @license-end */
</script>
<div id="doc-content">
<div class="header">
<div class="headertitle">
<div class="title">knapsack_solver.h</div> </div>
</div><!--header-->
<div class="contents">
2019-07-15 17:42:24 -07:00
<a href="knapsack__solver_8h.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="preprocessor">#ifndef OR_TOOLS_ALGORITHMS_KNAPSACK_SOLVER_H_</span></div><div class="line"><a name="l00015"></a><span class="lineno"> 15</span>&#160;<span class="preprocessor">#define OR_TOOLS_ALGORITHMS_KNAPSACK_SOLVER_H_</span></div><div class="line"><a name="l00016"></a><span class="lineno"> 16</span>&#160;</div><div class="line"><a name="l00017"></a><span class="lineno"> 17</span>&#160;<span class="preprocessor">#include &lt;math.h&gt;</span></div><div class="line"><a name="l00018"></a><span class="lineno"> 18</span>&#160;</div><div class="line"><a name="l00019"></a><span class="lineno"> 19</span>&#160;<span class="preprocessor">#include &lt;memory&gt;</span></div><div class="line"><a name="l00020"></a><span class="lineno"> 20</span>&#160;<span class="preprocessor">#include &lt;string&gt;</span></div><div class="line"><a name="l00021"></a><span class="lineno"> 21</span>&#160;<span class="preprocessor">#include &lt;vector&gt;</span></div><div class="line"><a name="l00022"></a><span class="lineno"> 22</span>&#160;</div><div class="line"><a name="l00023"></a><span class="lineno"> 23</span>&#160;<span class="preprocessor">#include &quot;absl/memory/memory.h&quot;</span></div><div class="line"><a name="l00024"></a><span class="lineno"> 24</span>&#160;<span class="preprocessor">#include &quot;ortools/base/basictypes.h&quot;</span></div><div class="line"><a name="l00025"></a><span class="lineno"> 25</span>&#160;<span class="preprocessor">#include &quot;ortools/base/integral_types.h&quot;</span></div><div class="line"><a name="l00026"></a><span class="lineno"> 26</span>&#160;<span class="preprocessor">#include &quot;ortools/base/logging.h&quot;</span></div><div class="line"><a name="l00027"></a><span class="lineno"> 27</span>&#160;<span class="preprocessor">#include &quot;ortools/base/macros.h&quot;</span></div><div
2019-07-12 11:43:12 -07:00
<div class="ttc" id="classoperations__research_1_1KnapsackSolver_html_a96f960b29496f637af7a3eeb10e606ab"><div class="ttname"><a href="classoperations__research_1_1KnapsackSolver.html#a96f960b29496f637af7a3eeb10e606ab">operations_research::KnapsackSolver::IsSolutionOptimal</a></div><div class="ttdeci">bool IsSolutionOptimal() const</div><div class="ttdoc">Returns true if the solution was proven optimal.</div><div class="ttdef"><b>Definition:</b> <a href="knapsack__solver_8h_source.html#l00201">knapsack_solver.h:201</a></div></div>
<div class="ttc" id="classoperations__research_1_1KnapsackSolver_html_ad2950d2690930dd8562b40d29bb7002e"><div class="ttname"><a href="classoperations__research_1_1KnapsackSolver.html#ad2950d2690930dd8562b40d29bb7002e">operations_research::KnapsackSolver::GetName</a></div><div class="ttdeci">std::string GetName() const</div></div>
2019-07-12 11:43:12 -07:00
<div class="ttc" id="classoperations__research_1_1KnapsackSolver_html"><div class="ttname"><a href="classoperations__research_1_1KnapsackSolver.html">operations_research::KnapsackSolver</a></div><div class="ttdoc">This library solves knapsack problems.</div><div class="ttdef"><b>Definition:</b> <a href="knapsack__solver_8h_source.html#l00120">knapsack_solver.h:120</a></div></div>
<div class="ttc" id="classoperations__research_1_1KnapsackSolver_html_a81ce17438663c39f7793e8db92ff1893a4d72c45990d1a81e3f5bcdaf6de72096"><div class="ttname"><a href="classoperations__research_1_1KnapsackSolver.html#a81ce17438663c39f7793e8db92ff1893a4d72c45990d1a81e3f5bcdaf6de72096">operations_research::KnapsackSolver::KNAPSACK_BRUTE_FORCE_SOLVER</a></div><div class="ttdoc">Brute force method.</div><div class="ttdef"><b>Definition:</b> <a href="knapsack__solver_8h_source.html#l00134">knapsack_solver.h:134</a></div></div>
<div class="ttc" id="classoperations__research_1_1KnapsackSolver_html_a81ce17438663c39f7793e8db92ff1893"><div class="ttname"><a href="classoperations__research_1_1KnapsackSolver.html#a81ce17438663c39f7793e8db92ff1893">operations_research::KnapsackSolver::SolverType</a></div><div class="ttdeci">SolverType</div><div class="ttdoc">Enum controlling which underlying algorithm is used.</div><div class="ttdef"><b>Definition:</b> <a href="knapsack__solver_8h_source.html#l00127">knapsack_solver.h:127</a></div></div>
<div class="ttc" id="classoperations__research_1_1KnapsackSolver_html_abb429376ba12d5541f22a905a728b0e1"><div class="ttname"><a href="classoperations__research_1_1KnapsackSolver.html#abb429376ba12d5541f22a905a728b0e1">operations_research::KnapsackSolver::set_use_reduction</a></div><div class="ttdeci">void set_use_reduction(bool use_reduction)</div><div class="ttdef"><b>Definition:</b> <a href="knapsack__solver_8h_source.html#l00205">knapsack_solver.h:205</a></div></div>
<div class="ttc" id="classoperations__research_1_1KnapsackSolver_html_a7638cb76df7cb79d956dda62d179a554"><div class="ttname"><a href="classoperations__research_1_1KnapsackSolver.html#a7638cb76df7cb79d956dda62d179a554">operations_research::KnapsackSolver::KnapsackSolver</a></div><div class="ttdeci">KnapsackSolver(const std::string &amp;solver_name)</div></div>
2019-07-12 11:43:12 -07:00
<div class="ttc" id="classoperations__research_1_1KnapsackSolver_html_a81ce17438663c39f7793e8db92ff1893ae1b7e0ea856a376a9c04130e0abdf812"><div class="ttname"><a href="classoperations__research_1_1KnapsackSolver.html#a81ce17438663c39f7793e8db92ff1893ae1b7e0ea856a376a9c04130e0abdf812">operations_research::KnapsackSolver::KNAPSACK_MULTIDIMENSION_CBC_MIP_SOLVER</a></div><div class="ttdoc">CBC Based Solver.</div><div class="ttdef"><b>Definition:</b> <a href="knapsack__solver_8h_source.html#l00158">knapsack_solver.h:158</a></div></div>
2019-07-15 17:42:24 -07:00
<div class="ttc" id="classoperations__research_1_1KnapsackSolver_html_ad2a0397c061a1cf0bfc759b35f23e463"><div class="ttname"><a href="classoperations__research_1_1KnapsackSolver.html#ad2a0397c061a1cf0bfc759b35f23e463">operations_research::KnapsackSolver::Init</a></div><div class="ttdeci">void Init(const std::vector&lt; int64 &gt; &amp;profits, const std::vector&lt; std::vector&lt; int64 &gt; &gt; &amp;weights, const std::vector&lt; int64 &gt; &amp;capacities)</div><div class="ttdoc">Initializes the solver and enters the problem to be solved.</div></div>
2019-07-12 11:43:12 -07:00
<div class="ttc" id="classoperations__research_1_1KnapsackSolver_html_a81ce17438663c39f7793e8db92ff1893a9c02fa29c925bc1d37cba92490998132"><div class="ttname"><a href="classoperations__research_1_1KnapsackSolver.html#a81ce17438663c39f7793e8db92ff1893a9c02fa29c925bc1d37cba92490998132">operations_research::KnapsackSolver::KNAPSACK_DYNAMIC_PROGRAMMING_SOLVER</a></div><div class="ttdoc">Dynamic Programming approach for single dimension problems.</div><div class="ttdef"><b>Definition:</b> <a href="knapsack__solver_8h_source.html#l00150">knapsack_solver.h:150</a></div></div>
<div class="ttc" id="classoperations__research_1_1KnapsackSolver_html_a81ce17438663c39f7793e8db92ff1893aa6d83fc5b8d17db1f82c1b414a4e8b20"><div class="ttname"><a href="classoperations__research_1_1KnapsackSolver.html#a81ce17438663c39f7793e8db92ff1893aa6d83fc5b8d17db1f82c1b414a4e8b20">operations_research::KnapsackSolver::KNAPSACK_MULTIDIMENSION_SCIP_MIP_SOLVER</a></div><div class="ttdoc">SCIP based solver.</div><div class="ttdef"><b>Definition:</b> <a href="knapsack__solver_8h_source.html#l00174">knapsack_solver.h:174</a></div></div>
<div class="ttc" id="classoperations__research_1_1KnapsackSolver_html_a0408f46c96d0dbf4eb463fa385778593"><div class="ttname"><a href="classoperations__research_1_1KnapsackSolver.html#a0408f46c96d0dbf4eb463fa385778593">operations_research::KnapsackSolver::use_reduction</a></div><div class="ttdeci">bool use_reduction() const</div><div class="ttdef"><b>Definition:</b> <a href="knapsack__solver_8h_source.html#l00204">knapsack_solver.h:204</a></div></div>
2019-07-15 17:42:24 -07:00
<div class="ttc" id="classoperations__research_1_1KnapsackSolver_html_a0f6ca3ef8483871052325ea2d04ca72d"><div class="ttname"><a href="classoperations__research_1_1KnapsackSolver.html#a0f6ca3ef8483871052325ea2d04ca72d">operations_research::KnapsackSolver::set_time_limit</a></div><div class="ttdeci">void set_time_limit(double time_limit_seconds)</div><div class="ttdoc">Time limit in seconds.</div><div class="ttdef"><b>Definition:</b> <a href="knapsack__solver_8h_source.html#l00212">knapsack_solver.h:212</a></div></div>
2019-07-12 11:43:12 -07:00
<div class="ttc" id="classoperations__research_1_1KnapsackSolver_html_a81ce17438663c39f7793e8db92ff1893ae8c15c25eaf606f5f853821aaabba164"><div class="ttname"><a href="classoperations__research_1_1KnapsackSolver.html#a81ce17438663c39f7793e8db92ff1893ae8c15c25eaf606f5f853821aaabba164">operations_research::KnapsackSolver::KNAPSACK_MULTIDIMENSION_BRANCH_AND_BOUND_SOLVER</a></div><div class="ttdoc">Generic Solver.</div><div class="ttdef"><b>Definition:</b> <a href="knapsack__solver_8h_source.html#l00166">knapsack_solver.h:166</a></div></div>
2019-07-11 17:46:00 -07:00
<div class="ttc" id="namespaceoperations__research_html"><div class="ttname"><a href="namespaceoperations__research.html">operations_research</a></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="classoperations__research_1_1KnapsackSolver_html_ac6d1a38c9a1c607e80d05720372ace4d"><div class="ttname"><a href="classoperations__research_1_1KnapsackSolver.html#ac6d1a38c9a1c607e80d05720372ace4d">operations_research::KnapsackSolver::~KnapsackSolver</a></div><div class="ttdeci">virtual ~KnapsackSolver()</div></div>
2019-07-12 11:43:12 -07:00
<div class="ttc" id="classoperations__research_1_1KnapsackSolver_html_a81ce17438663c39f7793e8db92ff1893aa6c3b9157b2506f5a53b0c73165c8f9b"><div class="ttname"><a href="classoperations__research_1_1KnapsackSolver.html#a81ce17438663c39f7793e8db92ff1893aa6c3b9157b2506f5a53b0c73165c8f9b">operations_research::KnapsackSolver::KNAPSACK_64ITEMS_SOLVER</a></div><div class="ttdoc">Optimized method for single dimension small problems.</div><div class="ttdef"><b>Definition:</b> <a href="knapsack__solver_8h_source.html#l00142">knapsack_solver.h:142</a></div></div>
<div class="ttc" id="classoperations__research_1_1KnapsackSolver_html_a7c3b5825c8effd86de03a610d1a38ed7"><div class="ttname"><a href="classoperations__research_1_1KnapsackSolver.html#a7c3b5825c8effd86de03a610d1a38ed7">operations_research::KnapsackSolver::Solve</a></div><div class="ttdeci">int64 Solve()</div><div class="ttdoc">Solves the problem and returns the profit of the optimal solution.</div></div>
</div><!-- fragment --></div><!-- contents -->
2019-07-12 11:43:12 -07:00
</div><!-- doc-content -->
</div>
<div id="footer-container">
<div id="footer">
</div>
</div>
</body>
</html>