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

354 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"/>-->
<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.1@</span>
</div>
</div>
<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="pages.html"><span>Related&#160;Pages</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="annotated.html"><span>Class&#160;List</span></a></li>
<li><a href="classes.html"><span>Class&#160;Index</span></a></li>
<li><a href="inherits.html"><span>Class&#160;Hierarchy</span></a></li>
<li><a href="functions.html"><span>Class&#160;Members</span></a></li>
</ul>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="namespaceoperations__research.html">operations_research</a></li><li class="navelem"><a class="el" href="classoperations__research_1_1BaseKnapsackSolver.html">BaseKnapsackSolver</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="classoperations__research_1_1BaseKnapsackSolver-members.html">List of all members</a> </div>
<div class="headertitle">
<div class="title">operations_research::BaseKnapsackSolver Class Reference<span class="mlabels"><span class="mlabel">abstract</span></span></div> </div>
</div><!--header-->
<div class="contents">
<p>--&mdash; <a class="el" href="classoperations__research_1_1BaseKnapsackSolver.html" title="--— BaseKnapsackSolver --— This is the base class for knapsack solvers.">BaseKnapsackSolver</a> --&mdash; This is the base class for knapsack solvers.
<a href="classoperations__research_1_1BaseKnapsackSolver.html#details">More...</a></p>
<p><code>#include &lt;<a class="el" href="knapsack__solver_8h_source.html">knapsack_solver.h</a>&gt;</code></p>
<div class="dynheader">
Inheritance diagram for operations_research::BaseKnapsackSolver:</div>
<div class="dyncontent">
<div class="center"><img src="classoperations__research_1_1BaseKnapsackSolver__inherit__graph.png" border="0" usemap="#operations__research_1_1BaseKnapsackSolver_inherit__map" alt="Inheritance graph"/></div>
<map name="operations__research_1_1BaseKnapsackSolver_inherit__map" id="operations__research_1_1BaseKnapsackSolver_inherit__map">
<area shape="rect" title="&#45;&#45;— BaseKnapsackSolver &#45;&#45;— This is the base class for knapsack solvers." alt="" coords="13,5,169,44"/>
<area shape="rect" href="classoperations__research_1_1KnapsackGenericSolver.html" title="&#45;&#45;— KnapsackGenericSolver &#45;&#45;— KnapsackGenericSolver is the multi&#45;dimensional knapsack solver class." alt="" coords="5,92,177,131"/>
</map>
<center><span class="legend">[<a href="graph_legend.html">legend</a>]</span></center></div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a507afd9932799f0be34f34605cd5ffee"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classoperations__research_1_1BaseKnapsackSolver.html#a507afd9932799f0be34f34605cd5ffee">BaseKnapsackSolver</a> (const std::string &amp;solver_name)</td></tr>
<tr class="separator:a507afd9932799f0be34f34605cd5ffee"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5f685ec61d9de86d57bdc53124c08b12"><td class="memItemLeft" align="right" valign="top">virtual&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classoperations__research_1_1BaseKnapsackSolver.html#a5f685ec61d9de86d57bdc53124c08b12">~BaseKnapsackSolver</a> ()</td></tr>
<tr class="separator:a5f685ec61d9de86d57bdc53124c08b12"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3e8f72facec15537065c1625e647d58b"><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classoperations__research_1_1BaseKnapsackSolver.html#a3e8f72facec15537065c1625e647d58b">Init</a> (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)=0</td></tr>
<tr class="memdesc:a3e8f72facec15537065c1625e647d58b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Initializes the solver and enters the problem to be solved. <a href="#a3e8f72facec15537065c1625e647d58b">More...</a><br /></td></tr>
<tr class="separator:a3e8f72facec15537065c1625e647d58b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a381cc9d7b544a8ec4727f9618f0b4f8f"><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classoperations__research_1_1BaseKnapsackSolver.html#a381cc9d7b544a8ec4727f9618f0b4f8f">GetLowerAndUpperBoundWhenItem</a> (int item_id, bool is_item_in, int64 *lower_bound, int64 *upper_bound)</td></tr>
<tr class="memdesc:a381cc9d7b544a8ec4727f9618f0b4f8f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Gets the lower and upper bound when the item is in or out of the knapsack. <a href="#a381cc9d7b544a8ec4727f9618f0b4f8f">More...</a><br /></td></tr>
<tr class="separator:a381cc9d7b544a8ec4727f9618f0b4f8f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a952deb24e032890d2781e52fedb70efa"><td class="memItemLeft" align="right" valign="top">virtual int64&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classoperations__research_1_1BaseKnapsackSolver.html#a952deb24e032890d2781e52fedb70efa">Solve</a> (TimeLimit *time_limit, bool *is_solution_optimal)=0</td></tr>
<tr class="memdesc:a952deb24e032890d2781e52fedb70efa"><td class="mdescLeft">&#160;</td><td class="mdescRight">Solves the problem and returns the profit of the optimal solution. <a href="#a952deb24e032890d2781e52fedb70efa">More...</a><br /></td></tr>
<tr class="separator:a952deb24e032890d2781e52fedb70efa"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a08bf62b91f6cf3fca10a504f7dd278a6"><td class="memItemLeft" align="right" valign="top">virtual bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classoperations__research_1_1BaseKnapsackSolver.html#a08bf62b91f6cf3fca10a504f7dd278a6">best_solution</a> (int item_id) const =0</td></tr>
<tr class="memdesc:a08bf62b91f6cf3fca10a504f7dd278a6"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns true if the item 'item_id' is packed in the optimal knapsack. <a href="#a08bf62b91f6cf3fca10a504f7dd278a6">More...</a><br /></td></tr>
<tr class="separator:a08bf62b91f6cf3fca10a504f7dd278a6"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae19aff92b4b38e712ead1cfcafd81f03"><td class="memItemLeft" align="right" valign="top">virtual std::string&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classoperations__research_1_1BaseKnapsackSolver.html#ae19aff92b4b38e712ead1cfcafd81f03">GetName</a> () const</td></tr>
<tr class="separator:ae19aff92b4b38e712ead1cfcafd81f03"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>--&mdash; <a class="el" href="classoperations__research_1_1BaseKnapsackSolver.html" title="--— BaseKnapsackSolver --— This is the base class for knapsack solvers.">BaseKnapsackSolver</a> --&mdash; This is the base class for knapsack solvers. </p>
<p class="definition">Definition at line <a class="el" href="knapsack__solver_8h_source.html#l00491">491</a> of file <a class="el" href="knapsack__solver_8h_source.html">knapsack_solver.h</a>.</p>
</div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a id="a507afd9932799f0be34f34605cd5ffee"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a507afd9932799f0be34f34605cd5ffee">&#9670;&nbsp;</a></span>BaseKnapsackSolver()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">operations_research::BaseKnapsackSolver::BaseKnapsackSolver </td>
<td>(</td>
<td class="paramtype">const std::string &amp;&#160;</td>
<td class="paramname"><em>solver_name</em></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">explicit</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p class="definition">Definition at line <a class="el" href="knapsack__solver_8h_source.html#l00493">493</a> of file <a class="el" href="knapsack__solver_8h_source.html">knapsack_solver.h</a>.</p>
</div>
</div>
<a id="a5f685ec61d9de86d57bdc53124c08b12"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a5f685ec61d9de86d57bdc53124c08b12">&#9670;&nbsp;</a></span>~BaseKnapsackSolver()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">virtual operations_research::BaseKnapsackSolver::~BaseKnapsackSolver </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">virtual</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p class="definition">Definition at line <a class="el" href="knapsack__solver_8h_source.html#l00495">495</a> of file <a class="el" href="knapsack__solver_8h_source.html">knapsack_solver.h</a>.</p>
</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a id="a08bf62b91f6cf3fca10a504f7dd278a6"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a08bf62b91f6cf3fca10a504f7dd278a6">&#9670;&nbsp;</a></span>best_solution()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">virtual bool operations_research::BaseKnapsackSolver::best_solution </td>
<td>(</td>
<td class="paramtype">int&#160;</td>
<td class="paramname"><em>item_id</em></td><td>)</td>
<td> const</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">pure virtual</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns true if the item 'item_id' is packed in the optimal knapsack. </p>
<p>Implemented in <a class="el" href="classoperations__research_1_1KnapsackGenericSolver.html#a3f48cb5dfceb3c4129779568d2569606">operations_research::KnapsackGenericSolver</a>.</p>
</div>
</div>
<a id="a381cc9d7b544a8ec4727f9618f0b4f8f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a381cc9d7b544a8ec4727f9618f0b4f8f">&#9670;&nbsp;</a></span>GetLowerAndUpperBoundWhenItem()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">virtual void operations_research::BaseKnapsackSolver::GetLowerAndUpperBoundWhenItem </td>
<td>(</td>
<td class="paramtype">int&#160;</td>
<td class="paramname"><em>item_id</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">bool&#160;</td>
<td class="paramname"><em>is_item_in</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int64 *&#160;</td>
<td class="paramname"><em>lower_bound</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int64 *&#160;</td>
<td class="paramname"><em>upper_bound</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Gets the lower and upper bound when the item is in or out of the knapsack. </p>
<p>To ensure objects are correctly initialized, this method should not be called before ::Init. </p>
<p>Reimplemented in <a class="el" href="classoperations__research_1_1KnapsackGenericSolver.html#aa49dbbb2b6eae494f521992c964bad53">operations_research::KnapsackGenericSolver</a>.</p>
</div>
</div>
<a id="ae19aff92b4b38e712ead1cfcafd81f03"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae19aff92b4b38e712ead1cfcafd81f03">&#9670;&nbsp;</a></span>GetName()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">virtual std::string operations_research::BaseKnapsackSolver::GetName </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">virtual</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p class="definition">Definition at line <a class="el" href="knapsack__solver_8h_source.html#l00515">515</a> of file <a class="el" href="knapsack__solver_8h_source.html">knapsack_solver.h</a>.</p>
</div>
</div>
<a id="a3e8f72facec15537065c1625e647d58b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a3e8f72facec15537065c1625e647d58b">&#9670;&nbsp;</a></span>Init()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">virtual void operations_research::BaseKnapsackSolver::Init </td>
<td>(</td>
<td class="paramtype">const std::vector&lt; int64 &gt; &amp;&#160;</td>
<td class="paramname"><em>profits</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const std::vector&lt; std::vector&lt; int64 &gt; &gt; &amp;&#160;</td>
<td class="paramname"><em>weights</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const std::vector&lt; int64 &gt; &amp;&#160;</td>
<td class="paramname"><em>capacities</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">pure virtual</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Initializes the solver and enters the problem to be solved. </p>
<p>Implemented in <a class="el" href="classoperations__research_1_1KnapsackGenericSolver.html#af9635774fd7761f62ee92e64205034b3">operations_research::KnapsackGenericSolver</a>.</p>
</div>
</div>
<a id="a952deb24e032890d2781e52fedb70efa"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a952deb24e032890d2781e52fedb70efa">&#9670;&nbsp;</a></span>Solve()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">virtual int64 operations_research::BaseKnapsackSolver::Solve </td>
<td>(</td>
<td class="paramtype">TimeLimit *&#160;</td>
<td class="paramname"><em>time_limit</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">bool *&#160;</td>
<td class="paramname"><em>is_solution_optimal</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">pure virtual</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Solves the problem and returns the profit of the optimal solution. </p>
<p>Implemented in <a class="el" href="classoperations__research_1_1KnapsackGenericSolver.html#a8f57ec05930a3df316b5df101c814984">operations_research::KnapsackGenericSolver</a>.</p>
</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="knapsack__solver_8h_source.html">knapsack_solver.h</a></li>
</ul>
</div><!-- contents -->
</div>
<div id="footer-container">
<div id="footer">
</div>
</div>
</body>
</html>