Update 0.2 docs

This commit is contained in:
2021-01-22 07:25:10 -06:00
parent 894f4b4668
commit 144523a5c0
73 changed files with 607 additions and 842 deletions

View File

@@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1" />
<meta name="generator" content="pdoc 0.7.0" />
<meta name="generator" content="pdoc 0.7.5" />
<title>miplearn.solvers.gurobi API documentation</title>
<meta name="description" content="" />
<link href='https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.0/normalize.min.css' rel='stylesheet'>
@@ -920,7 +920,7 @@ LP relaxation of that node.</dd>
</nav>
</main>
<footer id="footer">
<p>Generated by <a href="https://pdoc3.github.io/pdoc"><cite>pdoc</cite> 0.7.0</a>.</p>
<p>Generated by <a href="https://pdoc3.github.io/pdoc"><cite>pdoc</cite> 0.7.5</a>.</p>
</footer>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"></script>
<script>hljs.initHighlightingOnLoad()</script>

View File

@@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1" />
<meta name="generator" content="pdoc 0.7.0" />
<meta name="generator" content="pdoc 0.7.5" />
<title>miplearn.solvers API documentation</title>
<meta name="description" content="" />
<link href='https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.0/normalize.min.css' rel='stylesheet'>
@@ -115,7 +115,7 @@ class _RedirectOutput:
</nav>
</main>
<footer id="footer">
<p>Generated by <a href="https://pdoc3.github.io/pdoc"><cite>pdoc</cite> 0.7.0</a>.</p>
<p>Generated by <a href="https://pdoc3.github.io/pdoc"><cite>pdoc</cite> 0.7.5</a>.</p>
</footer>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"></script>
<script>hljs.initHighlightingOnLoad()</script>

View File

@@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1" />
<meta name="generator" content="pdoc 0.7.0" />
<meta name="generator" content="pdoc 0.7.5" />
<title>miplearn.solvers.internal API documentation</title>
<meta name="description" content="" />
<link href='https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.0/normalize.min.css' rel='stylesheet'>
@@ -303,7 +303,6 @@ class InternalSolver(ABC):
<dl>
<dt id="miplearn.solvers.internal.InternalSolver"><code class="flex name class">
<span>class <span class="ident">InternalSolver</span></span>
<span>(</span><span>*args, **kwargs)</span>
</code></dt>
<dd>
<section class="desc"><p>Abstract class representing the MIP solver used internally by LearningSolver.</p></section>
@@ -561,8 +560,8 @@ class InternalSolver(ABC):
</ul>
<h3>Subclasses</h3>
<ul class="hlist">
<li><a title="miplearn.solvers.pyomo.base.BasePyomoSolver" href="pyomo/base.html#miplearn.solvers.pyomo.base.BasePyomoSolver">BasePyomoSolver</a></li>
<li><a title="miplearn.solvers.gurobi.GurobiSolver" href="gurobi.html#miplearn.solvers.gurobi.GurobiSolver">GurobiSolver</a></li>
<li><a title="miplearn.solvers.pyomo.base.BasePyomoSolver" href="pyomo/base.html#miplearn.solvers.pyomo.base.BasePyomoSolver">BasePyomoSolver</a></li>
</ul>
<h3>Methods</h3>
<dl>
@@ -1134,7 +1133,7 @@ def solve_lp(
</nav>
</main>
<footer id="footer">
<p>Generated by <a href="https://pdoc3.github.io/pdoc"><cite>pdoc</cite> 0.7.0</a>.</p>
<p>Generated by <a href="https://pdoc3.github.io/pdoc"><cite>pdoc</cite> 0.7.5</a>.</p>
</footer>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"></script>
<script>hljs.initHighlightingOnLoad()</script>

View File

@@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1" />
<meta name="generator" content="pdoc 0.7.0" />
<meta name="generator" content="pdoc 0.7.5" />
<title>miplearn.solvers.learning API documentation</title>
<meta name="description" content="" />
<link href='https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.0/normalize.min.css' rel='stylesheet'>
@@ -46,7 +46,7 @@ from miplearn.instance import Instance
from miplearn.solvers import _RedirectOutput
from miplearn.solvers.internal import InternalSolver
from miplearn.solvers.pyomo.gurobi import GurobiPyomoSolver
from miplearn.types import MIPSolveStats, TrainingSample
from miplearn.types import MIPSolveStats, TrainingSample, LearningSolveStats
logger = logging.getLogger(__name__)
@@ -153,7 +153,7 @@ class LearningSolver:
output_filename: Optional[str] = None,
discard_output: bool = False,
tee: bool = False,
) -&gt; MIPSolveStats:
) -&gt; LearningSolveStats:
# Load instance from file, if necessary
filename = None
@@ -229,15 +229,24 @@ class LearningSolver:
# Solve MILP
logger.info(&#34;Solving MILP...&#34;)
stats = self.internal_solver.solve(
tee=tee,
iteration_cb=iteration_cb_wrapper,
lazy_cb=lazy_cb,
stats = cast(
LearningSolveStats,
self.internal_solver.solve(
tee=tee,
iteration_cb=iteration_cb_wrapper,
lazy_cb=lazy_cb,
),
)
if &#34;LP value&#34; in training_sample.keys():
stats[&#34;LP value&#34;] = training_sample[&#34;LP value&#34;]
stats[&#34;Solver&#34;] = &#34;default&#34;
stats[&#34;Gap&#34;] = self._compute_gap(
ub=stats[&#34;Upper bound&#34;],
lb=stats[&#34;Lower bound&#34;],
)
stats[&#34;Mode&#34;] = self.mode
# Read MIP solution and bounds
# Add some information to training_sample
training_sample[&#34;Lower bound&#34;] = stats[&#34;Lower bound&#34;]
training_sample[&#34;Upper bound&#34;] = stats[&#34;Upper bound&#34;]
training_sample[&#34;MIP log&#34;] = stats[&#34;Log&#34;]
@@ -268,7 +277,7 @@ class LearningSolver:
output_filename: Optional[str] = None,
discard_output: bool = False,
tee: bool = False,
) -&gt; MIPSolveStats:
) -&gt; LearningSolveStats:
&#34;&#34;&#34;
Solves the given instance. If trained machine-learning models are
available, they will be used to accelerate the solution process.
@@ -301,7 +310,7 @@ class LearningSolver:
Returns
-------
MIPSolveStats
LearningSolveStats
A dictionary of solver statistics containing at least the following
keys: &#34;Lower bound&#34;, &#34;Upper bound&#34;, &#34;Wallclock time&#34;, &#34;Nodes&#34;,
&#34;Sense&#34;, &#34;Log&#34;, &#34;Warm start value&#34; and &#34;LP value&#34;.
@@ -337,7 +346,7 @@ class LearningSolver:
label: str = &#34;Solve&#34;,
output_filenames: Optional[List[str]] = None,
discard_outputs: bool = False,
) -&gt; List[MIPSolveStats]:
) -&gt; List[LearningSolveStats]:
&#34;&#34;&#34;
Solves multiple instances in parallel.
@@ -364,7 +373,7 @@ class LearningSolver:
Returns
-------
List[MIPSolveStats]
List[LearningSolveStats]
List of solver statistics, with one entry for each provided instance.
The list is the same you would obtain by calling
`[solver.solve(p) for p in instances]`
@@ -409,7 +418,19 @@ class LearningSolver:
def __getstate__(self) -&gt; Dict:
self.internal_solver = None
return self.__dict__</code></pre>
return self.__dict__
@staticmethod
def _compute_gap(ub: Optional[float], lb: Optional[float]) -&gt; Optional[float]:
if lb is None or ub is None or lb * ub &lt; 0:
# solver did not find a solution and/or bound
return None
elif abs(ub - lb) &lt; 1e-6:
# avoid division by zero when ub = lb = 0
return 0.0
else:
# divide by max(abs(ub),abs(lb)) to ensure gap &lt;= 1
return (ub - lb) / max(abs(ub), abs(lb))</code></pre>
</details>
</section>
<section>
@@ -531,7 +552,7 @@ the theoretical performance of perfect ML models.</dd>
output_filename: Optional[str] = None,
discard_output: bool = False,
tee: bool = False,
) -&gt; MIPSolveStats:
) -&gt; LearningSolveStats:
# Load instance from file, if necessary
filename = None
@@ -607,15 +628,24 @@ the theoretical performance of perfect ML models.</dd>
# Solve MILP
logger.info(&#34;Solving MILP...&#34;)
stats = self.internal_solver.solve(
tee=tee,
iteration_cb=iteration_cb_wrapper,
lazy_cb=lazy_cb,
stats = cast(
LearningSolveStats,
self.internal_solver.solve(
tee=tee,
iteration_cb=iteration_cb_wrapper,
lazy_cb=lazy_cb,
),
)
if &#34;LP value&#34; in training_sample.keys():
stats[&#34;LP value&#34;] = training_sample[&#34;LP value&#34;]
stats[&#34;Solver&#34;] = &#34;default&#34;
stats[&#34;Gap&#34;] = self._compute_gap(
ub=stats[&#34;Upper bound&#34;],
lb=stats[&#34;Lower bound&#34;],
)
stats[&#34;Mode&#34;] = self.mode
# Read MIP solution and bounds
# Add some information to training_sample
training_sample[&#34;Lower bound&#34;] = stats[&#34;Lower bound&#34;]
training_sample[&#34;Upper bound&#34;] = stats[&#34;Upper bound&#34;]
training_sample[&#34;MIP log&#34;] = stats[&#34;Log&#34;]
@@ -646,7 +676,7 @@ the theoretical performance of perfect ML models.</dd>
output_filename: Optional[str] = None,
discard_output: bool = False,
tee: bool = False,
) -&gt; MIPSolveStats:
) -&gt; LearningSolveStats:
&#34;&#34;&#34;
Solves the given instance. If trained machine-learning models are
available, they will be used to accelerate the solution process.
@@ -679,7 +709,7 @@ the theoretical performance of perfect ML models.</dd>
Returns
-------
MIPSolveStats
LearningSolveStats
A dictionary of solver statistics containing at least the following
keys: &#34;Lower bound&#34;, &#34;Upper bound&#34;, &#34;Wallclock time&#34;, &#34;Nodes&#34;,
&#34;Sense&#34;, &#34;Log&#34;, &#34;Warm start value&#34; and &#34;LP value&#34;.
@@ -715,7 +745,7 @@ the theoretical performance of perfect ML models.</dd>
label: str = &#34;Solve&#34;,
output_filenames: Optional[List[str]] = None,
discard_outputs: bool = False,
) -&gt; List[MIPSolveStats]:
) -&gt; List[LearningSolveStats]:
&#34;&#34;&#34;
Solves multiple instances in parallel.
@@ -742,7 +772,7 @@ the theoretical performance of perfect ML models.</dd>
Returns
-------
List[MIPSolveStats]
List[LearningSolveStats]
List of solver statistics, with one entry for each provided instance.
The list is the same you would obtain by calling
`[solver.solve(p) for p in instances]`
@@ -787,7 +817,19 @@ the theoretical performance of perfect ML models.</dd>
def __getstate__(self) -&gt; Dict:
self.internal_solver = None
return self.__dict__</code></pre>
return self.__dict__
@staticmethod
def _compute_gap(ub: Optional[float], lb: Optional[float]) -&gt; Optional[float]:
if lb is None or ub is None or lb * ub &lt; 0:
# solver did not find a solution and/or bound
return None
elif abs(ub - lb) &lt; 1e-6:
# avoid division by zero when ub = lb = 0
return 0.0
else:
# divide by max(abs(ub),abs(lb)) to ensure gap &lt;= 1
return (ub - lb) / max(abs(ub), abs(lb))</code></pre>
</details>
<h3>Methods</h3>
<dl>
@@ -808,7 +850,7 @@ the theoretical performance of perfect ML models.</dd>
</details>
</dd>
<dt id="miplearn.solvers.learning.LearningSolver.parallel_solve"><code class="name flex">
<span>def <span class="ident">parallel_solve</span></span>(<span>self, instances, n_jobs=4, label=&#39;Solve&#39;, output_filenames=None, discard_outputs=False)</span>
<span>def <span class="ident">parallel_solve</span></span>(<span>self, instances, n_jobs=4, label='Solve', output_filenames=None, discard_outputs=False)</span>
</code></dt>
<dd>
<section class="desc"><p>Solves multiple instances in parallel.</p>
@@ -834,7 +876,7 @@ them instead. Useful during benchmarking.</dd>
</dl>
<h2 id="returns">Returns</h2>
<dl>
<dt><code>List</code>[<code>MIPSolveStats</code>]</dt>
<dt><code>List</code>[<code>LearningSolveStats</code>]</dt>
<dd>List of solver statistics, with one entry for each provided instance.
The list is the same you would obtain by calling
<code>[solver.solve(p) for p in instances]</code></dd>
@@ -850,7 +892,7 @@ The list is the same you would obtain by calling
label: str = &#34;Solve&#34;,
output_filenames: Optional[List[str]] = None,
discard_outputs: bool = False,
) -&gt; List[MIPSolveStats]:
) -&gt; List[LearningSolveStats]:
&#34;&#34;&#34;
Solves multiple instances in parallel.
@@ -877,7 +919,7 @@ The list is the same you would obtain by calling
Returns
-------
List[MIPSolveStats]
List[LearningSolveStats]
List of solver statistics, with one entry for each provided instance.
The list is the same you would obtain by calling
`[solver.solve(p) for p in instances]`
@@ -933,7 +975,7 @@ them. Useful during benchmarking.</dd>
</dl>
<h2 id="returns">Returns</h2>
<dl>
<dt><code>MIPSolveStats</code></dt>
<dt><code>LearningSolveStats</code></dt>
<dd>
<p>A dictionary of solver statistics containing at least the following
keys: "Lower bound", "Upper bound", "Wallclock time", "Nodes",
@@ -955,7 +997,7 @@ details.</p>
output_filename: Optional[str] = None,
discard_output: bool = False,
tee: bool = False,
) -&gt; MIPSolveStats:
) -&gt; LearningSolveStats:
&#34;&#34;&#34;
Solves the given instance. If trained machine-learning models are
available, they will be used to accelerate the solution process.
@@ -988,7 +1030,7 @@ details.</p>
Returns
-------
MIPSolveStats
LearningSolveStats
A dictionary of solver statistics containing at least the following
keys: &#34;Lower bound&#34;, &#34;Upper bound&#34;, &#34;Wallclock time&#34;, &#34;Nodes&#34;,
&#34;Sense&#34;, &#34;Log&#34;, &#34;Warm start value&#34; and &#34;LP value&#34;.
@@ -1050,7 +1092,7 @@ details.</p>
</nav>
</main>
<footer id="footer">
<p>Generated by <a href="https://pdoc3.github.io/pdoc"><cite>pdoc</cite> 0.7.0</a>.</p>
<p>Generated by <a href="https://pdoc3.github.io/pdoc"><cite>pdoc</cite> 0.7.5</a>.</p>
</footer>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"></script>
<script>hljs.initHighlightingOnLoad()</script>

View File

@@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1" />
<meta name="generator" content="pdoc 0.7.0" />
<meta name="generator" content="pdoc 0.7.5" />
<title>miplearn.solvers.pyomo.base API documentation</title>
<meta name="description" content="" />
<link href='https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.0/normalize.min.css' rel='stylesheet'>
@@ -665,8 +665,8 @@ class BasePyomoSolver(InternalSolver):
</ul>
<h3>Subclasses</h3>
<ul class="hlist">
<li><a title="miplearn.solvers.pyomo.gurobi.GurobiPyomoSolver" href="gurobi.html#miplearn.solvers.pyomo.gurobi.GurobiPyomoSolver">GurobiPyomoSolver</a></li>
<li><a title="miplearn.solvers.pyomo.cplex.CplexPyomoSolver" href="cplex.html#miplearn.solvers.pyomo.cplex.CplexPyomoSolver">CplexPyomoSolver</a></li>
<li><a title="miplearn.solvers.pyomo.gurobi.GurobiPyomoSolver" href="gurobi.html#miplearn.solvers.pyomo.gurobi.GurobiPyomoSolver">GurobiPyomoSolver</a></li>
<li><a title="miplearn.solvers.pyomo.xpress.XpressPyomoSolver" href="xpress.html#miplearn.solvers.pyomo.xpress.XpressPyomoSolver">XpressPyomoSolver</a></li>
</ul>
<h3>Inherited members</h3>
@@ -722,7 +722,7 @@ class BasePyomoSolver(InternalSolver):
</nav>
</main>
<footer id="footer">
<p>Generated by <a href="https://pdoc3.github.io/pdoc"><cite>pdoc</cite> 0.7.0</a>.</p>
<p>Generated by <a href="https://pdoc3.github.io/pdoc"><cite>pdoc</cite> 0.7.5</a>.</p>
</footer>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"></script>
<script>hljs.initHighlightingOnLoad()</script>

View File

@@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1" />
<meta name="generator" content="pdoc 0.7.0" />
<meta name="generator" content="pdoc 0.7.5" />
<title>miplearn.solvers.pyomo.cplex API documentation</title>
<meta name="description" content="" />
<link href='https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.0/normalize.min.css' rel='stylesheet'>
@@ -185,7 +185,7 @@ class CplexPyomoSolver(BasePyomoSolver):
</nav>
</main>
<footer id="footer">
<p>Generated by <a href="https://pdoc3.github.io/pdoc"><cite>pdoc</cite> 0.7.0</a>.</p>
<p>Generated by <a href="https://pdoc3.github.io/pdoc"><cite>pdoc</cite> 0.7.5</a>.</p>
</footer>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"></script>
<script>hljs.initHighlightingOnLoad()</script>

View File

@@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1" />
<meta name="generator" content="pdoc 0.7.0" />
<meta name="generator" content="pdoc 0.7.5" />
<title>miplearn.solvers.pyomo.gurobi API documentation</title>
<meta name="description" content="" />
<link href='https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.0/normalize.min.css' rel='stylesheet'>
@@ -213,7 +213,7 @@ class GurobiPyomoSolver(BasePyomoSolver):
</nav>
</main>
<footer id="footer">
<p>Generated by <a href="https://pdoc3.github.io/pdoc"><cite>pdoc</cite> 0.7.0</a>.</p>
<p>Generated by <a href="https://pdoc3.github.io/pdoc"><cite>pdoc</cite> 0.7.5</a>.</p>
</footer>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"></script>
<script>hljs.initHighlightingOnLoad()</script>

View File

@@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1" />
<meta name="generator" content="pdoc 0.7.0" />
<meta name="generator" content="pdoc 0.7.5" />
<title>miplearn.solvers.pyomo API documentation</title>
<meta name="description" content="" />
<link href='https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.0/normalize.min.css' rel='stylesheet'>
@@ -80,7 +80,7 @@
</nav>
</main>
<footer id="footer">
<p>Generated by <a href="https://pdoc3.github.io/pdoc"><cite>pdoc</cite> 0.7.0</a>.</p>
<p>Generated by <a href="https://pdoc3.github.io/pdoc"><cite>pdoc</cite> 0.7.5</a>.</p>
</footer>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"></script>
<script>hljs.initHighlightingOnLoad()</script>

View File

@@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1" />
<meta name="generator" content="pdoc 0.7.0" />
<meta name="generator" content="pdoc 0.7.5" />
<title>miplearn.solvers.pyomo.xpress API documentation</title>
<meta name="description" content="" />
<link href='https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.0/normalize.min.css' rel='stylesheet'>
@@ -166,7 +166,7 @@ class XpressPyomoSolver(BasePyomoSolver):
</nav>
</main>
<footer id="footer">
<p>Generated by <a href="https://pdoc3.github.io/pdoc"><cite>pdoc</cite> 0.7.0</a>.</p>
<p>Generated by <a href="https://pdoc3.github.io/pdoc"><cite>pdoc</cite> 0.7.5</a>.</p>
</footer>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"></script>
<script>hljs.initHighlightingOnLoad()</script>

View File

@@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1" />
<meta name="generator" content="pdoc 0.7.0" />
<meta name="generator" content="pdoc 0.7.5" />
<title>miplearn.solvers.tests API documentation</title>
<meta name="description" content="" />
<link href='https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.0/normalize.min.css' rel='stylesheet'>
@@ -242,7 +242,7 @@ features, which can be provided as inputs to machine learning models.</p></secti
</nav>
</main>
<footer id="footer">
<p>Generated by <a href="https://pdoc3.github.io/pdoc"><cite>pdoc</cite> 0.7.0</a>.</p>
<p>Generated by <a href="https://pdoc3.github.io/pdoc"><cite>pdoc</cite> 0.7.5</a>.</p>
</footer>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"></script>
<script>hljs.initHighlightingOnLoad()</script>

View File

@@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1" />
<meta name="generator" content="pdoc 0.7.0" />
<meta name="generator" content="pdoc 0.7.5" />
<title>miplearn.solvers.tests.test_internal_solver API documentation</title>
<meta name="description" content="" />
<link href='https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.0/normalize.min.css' rel='stylesheet'>
@@ -535,7 +535,7 @@ def test_iteration_cb():
</nav>
</main>
<footer id="footer">
<p>Generated by <a href="https://pdoc3.github.io/pdoc"><cite>pdoc</cite> 0.7.0</a>.</p>
<p>Generated by <a href="https://pdoc3.github.io/pdoc"><cite>pdoc</cite> 0.7.5</a>.</p>
</footer>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"></script>
<script>hljs.initHighlightingOnLoad()</script>

View File

@@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1" />
<meta name="generator" content="pdoc 0.7.0" />
<meta name="generator" content="pdoc 0.7.5" />
<title>miplearn.solvers.tests.test_lazy_cb API documentation</title>
<meta name="description" content="" />
<link href='https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.0/normalize.min.css' rel='stylesheet'>
@@ -111,7 +111,7 @@ def test_lazy_cb():
</nav>
</main>
<footer id="footer">
<p>Generated by <a href="https://pdoc3.github.io/pdoc"><cite>pdoc</cite> 0.7.0</a>.</p>
<p>Generated by <a href="https://pdoc3.github.io/pdoc"><cite>pdoc</cite> 0.7.5</a>.</p>
</footer>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"></script>
<script>hljs.initHighlightingOnLoad()</script>

View File

@@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1" />
<meta name="generator" content="pdoc 0.7.0" />
<meta name="generator" content="pdoc 0.7.5" />
<title>miplearn.solvers.tests.test_learning_solver API documentation</title>
<meta name="description" content="" />
<link href='https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.0/normalize.min.css' rel='stylesheet'>
@@ -155,7 +155,17 @@ def test_simulate_perfect():
simulate_perfect=True,
)
stats = solver.solve(tmp.name)
assert stats[&#34;Lower bound&#34;] == stats[&#34;Predicted LB&#34;]</code></pre>
assert stats[&#34;Lower bound&#34;] == stats[&#34;Predicted LB&#34;]
def test_gap():
assert LearningSolver._compute_gap(ub=0.0, lb=0.0) == 0.0
assert LearningSolver._compute_gap(ub=1.0, lb=0.5) == 0.5
assert LearningSolver._compute_gap(ub=1.0, lb=1.0) == 0.0
assert LearningSolver._compute_gap(ub=1.0, lb=-1.0) is None
assert LearningSolver._compute_gap(ub=1.0, lb=None) is None
assert LearningSolver._compute_gap(ub=None, lb=1.0) is None
assert LearningSolver._compute_gap(ub=None, lb=None) is None</code></pre>
</details>
</section>
<section>
@@ -165,6 +175,25 @@ def test_simulate_perfect():
<section>
<h2 class="section-title" id="header-functions">Functions</h2>
<dl>
<dt id="miplearn.solvers.tests.test_learning_solver.test_gap"><code class="name flex">
<span>def <span class="ident">test_gap</span></span>(<span>)</span>
</code></dt>
<dd>
<section class="desc"></section>
<details class="source">
<summary>
<span>Expand source code</span>
</summary>
<pre><code class="python">def test_gap():
assert LearningSolver._compute_gap(ub=0.0, lb=0.0) == 0.0
assert LearningSolver._compute_gap(ub=1.0, lb=0.5) == 0.5
assert LearningSolver._compute_gap(ub=1.0, lb=1.0) == 0.0
assert LearningSolver._compute_gap(ub=1.0, lb=-1.0) is None
assert LearningSolver._compute_gap(ub=1.0, lb=None) is None
assert LearningSolver._compute_gap(ub=None, lb=1.0) is None
assert LearningSolver._compute_gap(ub=None, lb=None) is None</code></pre>
</details>
</dd>
<dt id="miplearn.solvers.tests.test_learning_solver.test_learning_solver"><code class="name flex">
<span>def <span class="ident">test_learning_solver</span></span>(<span>)</span>
</code></dt>
@@ -346,6 +375,7 @@ def test_simulate_perfect():
</li>
<li><h3><a href="#header-functions">Functions</a></h3>
<ul class="">
<li><code><a title="miplearn.solvers.tests.test_learning_solver.test_gap" href="#miplearn.solvers.tests.test_learning_solver.test_gap">test_gap</a></code></li>
<li><code><a title="miplearn.solvers.tests.test_learning_solver.test_learning_solver" href="#miplearn.solvers.tests.test_learning_solver.test_learning_solver">test_learning_solver</a></code></li>
<li><code><a title="miplearn.solvers.tests.test_learning_solver.test_parallel_solve" href="#miplearn.solvers.tests.test_learning_solver.test_parallel_solve">test_parallel_solve</a></code></li>
<li><code><a title="miplearn.solvers.tests.test_learning_solver.test_simulate_perfect" href="#miplearn.solvers.tests.test_learning_solver.test_simulate_perfect">test_simulate_perfect</a></code></li>
@@ -357,7 +387,7 @@ def test_simulate_perfect():
</nav>
</main>
<footer id="footer">
<p>Generated by <a href="https://pdoc3.github.io/pdoc"><cite>pdoc</cite> 0.7.0</a>.</p>
<p>Generated by <a href="https://pdoc3.github.io/pdoc"><cite>pdoc</cite> 0.7.5</a>.</p>
</footer>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"></script>
<script>hljs.initHighlightingOnLoad()</script>