Update docs

docs
Alinson S. Xavier 5 years ago
parent 070c4adc73
commit ed15ffe119

@ -59,7 +59,9 @@
<!-- Main title -->
<a class="navbar-brand" href="/.">MIPLearn</a>
<a class="navbar-brand" href="/.">MIPLearn</a>
</div>
<!-- Expanded navigation -->
@ -133,18 +135,22 @@
</div>
<footer class="col-md-12 text-center">
<hr>
<p>
<small>Copyright © 2020, UChicago Argonne, LLC. All Rights Reserved.</small><br>
<footer class="col-md-12 text-center">
<hr>
<p>
<small>Copyright © 2020, UChicago Argonne, LLC. All Rights Reserved.</small><br>
<small>Documentation built with <a href="http://www.mkdocs.org/">MkDocs</a>.</small>
</p>
<small>Documentation built with <a href="http://www.mkdocs.org/">MkDocs</a>.</small>
</p>
</footer>
</footer>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="/js/bootstrap-3.0.3.min.js"></script>

@ -59,7 +59,9 @@
<!-- Main title -->
<a class="navbar-brand" href="..">MIPLearn</a>
<a class="navbar-brand" href="..">MIPLearn</a>
</div>
<!-- Expanded navigation -->
@ -155,14 +157,19 @@
</ul>
<h3 id="acknowledgments">Acknowledgments</h3>
<ul>
<li>Based upon work supported by Laboratory Directed Research and Development (LDRD) funding from Argonne National Laboratory, provided by the Director, Office of Science, of the U.S. Department of Energy under Contract No. DE-AC02-06CH11357.</li>
<li>Based upon work supported by <strong>Laboratory Directed Research and Development</strong> (LDRD) funding from Argonne National Laboratory, provided by the Director, Office of Science, of the U.S. Department of Energy under Contract No. DE-AC02-06CH11357, and the <strong>U.S. Department of Energy Advanced Grid Modeling Program</strong> under Grant DE-OE0000875.</li>
</ul>
<h3 id="references">References</h3>
<p>If you use MIPLearn in your research, or the included problem generators, we kindly request that you cite the package as follows:</p>
<ul>
<li><strong>Alinson S. Xavier, Feng Qiu.</strong> <em>MIPLearn: An Extensible Framework for Learning-Enhanced Optimization</em>. Zenodo (2020). DOI: <a href="https://doi.org/10.5281/zenodo.4287567">10.5281/zenodo.4287567</a></li>
</ul>
<p>If you use MIPLearn in the field of power systems optimization, we kindly request that you cite the reference below, in which the main techniques implemented in MIPLearn were first developed:</p>
<ul>
<li><strong>Learning to Solve Large-Scale Security-Constrained Unit Commitment Problems.</strong> <em>Alinson S. Xavier, Feng Qiu, Shabbir Ahmed</em>. INFORMS Journal on Computing (to appear). <a href="https://arxiv.org/abs/1902.01697">ArXiv:1902:01696</a></li>
<li><strong>Alinson S. Xavier, Feng Qiu, Shabbir Ahmed.</strong> <em>Learning to Solve Large-Scale Unit Commitment Problems.</em> INFORMS Journal on Computing (2020). DOI: <a href="https://doi.org/10.1287/ijoc.2020.0976">10.1287/ijoc.2020.0976</a></li>
</ul>
<h3 id="license">License</h3>
<pre><code class="text">MIPLearn, an extensible framework for Learning-Enhanced Mixed-Integer Optimization
<pre><code class="language-text">MIPLearn, an extensible framework for Learning-Enhanced Mixed-Integer Optimization
Copyright © 2020, UChicago Argonne, LLC. All Rights Reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted
@ -191,18 +198,22 @@ POSSIBILITY OF SUCH DAMAGE.
</div>
<footer class="col-md-12 text-center">
<hr>
<p>
<small>Copyright © 2020, UChicago Argonne, LLC. All Rights Reserved.</small><br>
<footer class="col-md-12 text-center">
<hr>
<p>
<small>Copyright © 2020, UChicago Argonne, LLC. All Rights Reserved.</small><br>
<small>Documentation built with <a href="http://www.mkdocs.org/">MkDocs</a>.</small>
</p>
<small>Documentation built with <a href="http://www.mkdocs.org/">MkDocs</a>.</small>
</p>
</footer>
</footer>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="../js/bootstrap-3.0.3.min.js"></script>

@ -59,7 +59,9 @@
<!-- Main title -->
<a class="navbar-brand" href="..">MIPLearn</a>
<a class="navbar-brand" href="..">MIPLearn</a>
</div>
<!-- Expanded navigation -->
@ -146,7 +148,7 @@
<h1 id="benchmarks-utilities">Benchmarks Utilities</h1>
<h3 id="using-benchmarkrunner">Using <code>BenchmarkRunner</code></h3>
<p>MIPLearn provides the utility class <code>BenchmarkRunner</code>, which simplifies the task of comparing the performance of different solvers. The snippet below shows its basic usage:</p>
<pre><code class="python">from miplearn import BenchmarkRunner, LearningSolver
<pre><code class="language-python">from miplearn import BenchmarkRunner, LearningSolver
# Create train and test instances
train_instances = [...]
@ -168,7 +170,6 @@ benchmark.fit(train_instances)
benchmark.parallel_solve(test_instances, n_jobs=2)
print(benchmark.raw_results())
</code></pre>
<p>The method <code>fit</code> trains the ML models for each individual solver. The method <code>parallel_solve</code> solves the test instances in parallel, and collects solver statistics such as running time and optimal value. Finally, <code>raw_results</code> produces a table of results (Pandas DataFrame) with the following columns:</p>
<ul>
<li><strong>Solver,</strong> the name of the solver.</li>
@ -182,7 +183,7 @@ print(benchmark.raw_results())
<p>In addition to the above, there is also a "Relative" version of most columns, where the raw number is compared to the solver which provided the best performance. The <em>Relative Wallclock Time</em> for example, indicates how many times slower this run was when compared to the best time achieved by any solver when processing this instance. For example, if this run took 10 seconds, but the fastest solver took only 5 seconds to solve the same instance, the relative wallclock time would be 2.</p>
<h3 id="saving-and-loading-benchmark-results">Saving and loading benchmark results</h3>
<p>When iteratively exploring new formulations, encoding and solver parameters, it is often desirable to avoid repeating parts of the benchmark suite. For example, if the baseline solver has not been changed, there is no need to evaluate its performance again and again when making small changes to the remaining solvers. <code>BenchmarkRunner</code> provides the methods <code>save_results</code> and <code>load_results</code>, which can be used to avoid this repetition, as the next example shows:</p>
<pre><code class="python"># Benchmark baseline solvers and save results to a file.
<pre><code class="language-python"># Benchmark baseline solvers and save results to a file.
benchmark = BenchmarkRunner(baseline_solvers)
benchmark.parallel_solve(test_instances)
benchmark.save_results(&quot;baseline_results.csv&quot;)
@ -197,18 +198,22 @@ benchmark.parallel_solve(test_instances)
</div>
<footer class="col-md-12 text-center">
<hr>
<p>
<small>Copyright © 2020, UChicago Argonne, LLC. All Rights Reserved.</small><br>
<footer class="col-md-12 text-center">
<hr>
<p>
<small>Copyright © 2020, UChicago Argonne, LLC. All Rights Reserved.</small><br>
<small>Documentation built with <a href="http://www.mkdocs.org/">MkDocs</a>.</small>
</p>
<small>Documentation built with <a href="http://www.mkdocs.org/">MkDocs</a>.</small>
</p>
</footer>
</footer>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="../js/bootstrap-3.0.3.min.js"></script>

@ -1,12 +1,9 @@
body {
padding-top: 70px;
html {
scroll-padding-top: 70px;
}
h1[id]:before, h2[id]:before, h3[id]:before, h4[id]:before, h5[id]:before, h6[id]:before {
content: "";
display: block;
margin-top: -75px;
height: 75px;
body {
padding-top: 70px;
}
p > img {
@ -103,7 +100,8 @@ div.source-links {
.bs-sidebar.affix {
position: fixed; /* Undo the static from mobile first approach */
top: 80px;
max-height: calc(100% - 90px);
max-height: calc(100% - 180px);
overflow-y: auto;
}
.bs-sidebar.affix-bottom {
position: absolute; /* Undo the static from mobile first approach */
@ -228,6 +226,16 @@ div.source-links {
}
/* End Bootstrap Callouts CSS Source by Chris Pratt */
/* Headerlinks */
.headerlink {
display: none;
padding-left: .5em;
}
h1:hover .headerlink, h2:hover .headerlink, h3:hover .headerlink, h4:hover .headerlink, h5:hover .headerlink, h6:hover .headerlink {
display: inline-block;
}
/* Admonitions */
.admonition {
padding: 20px;

@ -1 +1 @@
body{padding-top:70px}h1[id]:before,h2[id]:before,h3[id]:before,h4[id]:before,h5[id]:before,h6[id]:before{content:"";display:block;margin-top:-75px;height:75px}p>img{max-width:100%;height:auto}ul.nav li.first-level{font-weight:bold}ul.nav li.third-level{padding-left:12px}div.col-md-3{padding-left:0}div.col-md-9{padding-bottom:100px}div.source-links{float:right}.bs-sidebar.affix{position:static}.bs-sidebar.well{padding:0}.bs-sidenav{margin-top:30px;margin-bottom:30px;padding-top:10px;padding-bottom:10px;border-radius:5px}.bs-sidebar .nav>li>a{display:block;padding:5px 20px;z-index:1}.bs-sidebar .nav>li>a:hover,.bs-sidebar .nav>li>a:focus{text-decoration:none;border-right:1px solid}.bs-sidebar .nav>.active>a,.bs-sidebar .nav>.active:hover>a,.bs-sidebar .nav>.active:focus>a{font-weight:bold;background-color:transparent;border-right:1px solid}.bs-sidebar .nav .nav{display:none;margin-bottom:8px}.bs-sidebar .nav .nav>li>a{padding-top:3px;padding-bottom:3px;padding-left:30px;font-size:90%}@media(min-width:992px){.bs-sidebar .nav>.active>ul{display:block}.bs-sidebar.affix,.bs-sidebar.affix-bottom{width:213px}.bs-sidebar.affix{position:fixed;top:80px;max-height:calc(100% - 90px)}.bs-sidebar.affix-bottom{position:absolute}.bs-sidebar.affix-bottom .bs-sidenav,.bs-sidebar.affix .bs-sidenav{margin-top:0;margin-bottom:0}}@media(min-width:1200px){.bs-sidebar.affix-bottom,.bs-sidebar.affix{width:263px}}.dropdown-submenu{position:relative}.dropdown-submenu>.dropdown-menu{top:0;left:100%;margin-top:0;margin-left:0}.dropdown-submenu:hover>.dropdown-menu{display:block}.dropdown-submenu>a:after{display:block;content:" ";float:right;width:0;height:0;border-color:transparent;border-style:solid;border-width:5px 0 5px 5px;border-left-color:#ccc;margin-top:5px;margin-right:-10px}.dropdown-submenu:hover>a:after{border-left-color:#fff}.dropdown-submenu.pull-left{float:none}.dropdown-submenu.pull-left>.dropdown-menu{left:-100%;margin-left:00px}.bs-callout{padding:20px;margin:20px 0;border:1px solid #eee;border-left-width:5px;border-radius:3px;background-color:#fcfdff}.bs-callout h4{font-style:normal;font-weight:400;margin-top:0;margin-bottom:5px}.bs-callout p:last-child{margin-bottom:0}.bs-callout code{border-radius:3px}.bs-callout+.bs-callout{margin-top:-5px}.bs-callout-default{border-left-color:#fa023c}.bs-callout-default h4{color:#fa023c}.bs-callout-primary{border-left-color:#428bca}.bs-callout-primary h4{color:#428bca}.bs-callout-success{border-left-color:#5cb85c}.bs-callout-success h4{color:#5cb85c}.bs-callout-danger{border-left-color:#d9534f}.bs-callout-danger h4{color:#d9534f}.bs-callout-warning{border-left-color:#f0ad4e}.bs-callout-warning h4{color:#f0ad4e}.bs-callout-info{border-left-color:#5bc0de}.bs-callout-info h4{color:#5bc0de}.admonition{padding:20px;margin:20px 0;border:1px solid #eee;border-left-width:5px;border-radius:3px;background-color:#fcfdff}.admonition p:last-child{margin-bottom:0}.admonition code{border-radius:3px}.admonition+.admonition{margin-top:-5px}.admonition.note{border-left-color:#428bca}.admonition.warning{border-left-color:#f0ad4e}.admonition.danger{border-left-color:#d9534f}.admonition-title{font-size:19px;font-style:normal;font-weight:400;margin-top:0;margin-bottom:5px}.admonition.note>.admonition-title{color:#428bca}.admonition.warning>.admonition-title{color:#f0ad4e}.admonition.danger>.admonition-title{color:#d9534f}
html{scroll-padding-top:70px}body{padding-top:70px}p>img{max-width:100%;height:auto}ul.nav li.first-level{font-weight:bold}ul.nav li.third-level{padding-left:12px}div.col-md-3{padding-left:0}div.col-md-9{padding-bottom:100px}div.source-links{float:right}.bs-sidebar.affix{position:static}.bs-sidebar.well{padding:0}.bs-sidenav{margin-top:30px;margin-bottom:30px;padding-top:10px;padding-bottom:10px;border-radius:5px}.bs-sidebar .nav>li>a{display:block;padding:5px 20px;z-index:1}.bs-sidebar .nav>li>a:hover,.bs-sidebar .nav>li>a:focus{text-decoration:none;border-right:1px solid}.bs-sidebar .nav>.active>a,.bs-sidebar .nav>.active:hover>a,.bs-sidebar .nav>.active:focus>a{font-weight:bold;background-color:transparent;border-right:1px solid}.bs-sidebar .nav .nav{display:none;margin-bottom:8px}.bs-sidebar .nav .nav>li>a{padding-top:3px;padding-bottom:3px;padding-left:30px;font-size:90%}@media(min-width:992px){.bs-sidebar .nav>.active>ul{display:block}.bs-sidebar.affix,.bs-sidebar.affix-bottom{width:213px}.bs-sidebar.affix{position:fixed;top:80px;max-height:calc(100% - 180px);overflow-y:auto}.bs-sidebar.affix-bottom{position:absolute}.bs-sidebar.affix-bottom .bs-sidenav,.bs-sidebar.affix .bs-sidenav{margin-top:0;margin-bottom:0}}@media(min-width:1200px){.bs-sidebar.affix-bottom,.bs-sidebar.affix{width:263px}}.dropdown-submenu{position:relative}.dropdown-submenu>.dropdown-menu{top:0;left:100%;margin-top:0;margin-left:0}.dropdown-submenu:hover>.dropdown-menu{display:block}.dropdown-submenu>a:after{display:block;content:" ";float:right;width:0;height:0;border-color:transparent;border-style:solid;border-width:5px 0 5px 5px;border-left-color:#ccc;margin-top:5px;margin-right:-10px}.dropdown-submenu:hover>a:after{border-left-color:#fff}.dropdown-submenu.pull-left{float:none}.dropdown-submenu.pull-left>.dropdown-menu{left:-100%;margin-left:00px}.bs-callout{padding:20px;margin:20px 0;border:1px solid #eee;border-left-width:5px;border-radius:3px;background-color:#fcfdff}.bs-callout h4{font-style:normal;font-weight:400;margin-top:0;margin-bottom:5px}.bs-callout p:last-child{margin-bottom:0}.bs-callout code{border-radius:3px}.bs-callout+.bs-callout{margin-top:-5px}.bs-callout-default{border-left-color:#fa023c}.bs-callout-default h4{color:#fa023c}.bs-callout-primary{border-left-color:#428bca}.bs-callout-primary h4{color:#428bca}.bs-callout-success{border-left-color:#5cb85c}.bs-callout-success h4{color:#5cb85c}.bs-callout-danger{border-left-color:#d9534f}.bs-callout-danger h4{color:#d9534f}.bs-callout-warning{border-left-color:#f0ad4e}.bs-callout-warning h4{color:#f0ad4e}.bs-callout-info{border-left-color:#5bc0de}.bs-callout-info h4{color:#5bc0de}.headerlink{display:none;padding-left:.5em}h1:hover .headerlink,h2:hover .headerlink,h3:hover .headerlink,h4:hover .headerlink,h5:hover .headerlink,h6:hover .headerlink{display:inline-block}.admonition{padding:20px;margin:20px 0;border:1px solid #eee;border-left-width:5px;border-radius:3px;background-color:#fcfdff}.admonition p:last-child{margin-bottom:0}.admonition code{border-radius:3px}.admonition+.admonition{margin-top:-5px}.admonition.note{border-left-color:#428bca}.admonition.warning{border-left-color:#f0ad4e}.admonition.danger{border-left-color:#d9534f}.admonition-title{font-size:19px;font-style:normal;font-weight:400;margin-top:0;margin-bottom:5px}.admonition.note>.admonition-title{color:#428bca}.admonition.warning>.admonition-title{color:#f0ad4e}.admonition.danger>.admonition-title{color:#d9534f}

@ -59,7 +59,9 @@
<!-- Main title -->
<a class="navbar-brand" href="..">MIPLearn</a>
<a class="navbar-brand" href="..">MIPLearn</a>
</div>
<!-- Expanded navigation -->
@ -152,12 +154,11 @@
<h2 id="customizing-solver-parameters">Customizing solver parameters</h2>
<h3 id="selecting-the-internal-mip-solver">Selecting the internal MIP solver</h3>
<p>By default, <code>LearningSolver</code> uses <a href="https://www.gurobi.com/">Gurobi</a> as its internal MIP solver. Another supported solver is <a href="https://www.ibm.com/products/ilog-cplex-optimization-studio">IBM ILOG CPLEX</a>. To switch between solvers, use the <code>solver</code> constructor argument, as shown below. It is also possible to specify a time limit (in seconds) and a relative MIP gap tolerance.</p>
<pre><code class="python">from miplearn import LearningSolver
<pre><code class="language-python">from miplearn import LearningSolver
solver = LearningSolver(solver=&quot;cplex&quot;,
time_limit=300,
gap_tolerance=1e-3)
</code></pre>
<h2 id="customizing-solver-components">Customizing solver components</h2>
<p><code>LearningSolver</code> is composed by a number of individual machine-learning components, each targeting a different part of the solution process. Each component can be individually enabled, disabled or customized. The following components are enabled by default:</p>
<ul>
@ -171,7 +172,7 @@ solver = LearningSolver(solver=&quot;cplex&quot;,
</ul>
<h3 id="selecting-components">Selecting components</h3>
<p>To create a <code>LearningSolver</code> with a specific set of components, the <code>components</code> constructor argument may be used, as the next example shows:</p>
<pre><code class="python"># Create a solver without any components
<pre><code class="language-python"># Create a solver without any components
solver1 = LearningSolver(components=[])
# Create a solver with only two components
@ -180,15 +181,13 @@ solver2 = LearningSolver(components=[
PrimalSolutionComponent(...),
])
</code></pre>
<p>It is also possible to add components to an existing solver using the <code>solver.add</code> method, as shown below. If the solver already holds another component of that type, the new component will replace the previous one.</p>
<pre><code class="python"># Create solver with default components
<pre><code class="language-python"># Create solver with default components
solver = LearningSolver()
# Replace the default LazyConstraintComponent by one with custom parameters
solver.add(LazyConstraintComponent(...))
</code></pre>
<h3 id="adjusting-component-aggressiveness">Adjusting component aggressiveness</h3>
<p>The aggressiveness of classification components (such as <code>PrimalSolutionComponent</code> and <code>LazyConstraintComponent</code>) can
be adjusted through the <code>threshold</code> constructor argument. Internally, these components ask the ML models how confident
@ -199,13 +198,12 @@ while raising a component's threshold makes it more conservative. </p>
to achieve a minimum desired true positive rate (also known as precision). The example below shows how to initialize
a <code>PrimalSolutionComponent</code> which achieves 95% precision, possibly at the cost of a lower recall. To make the component
more aggressive, this precision may be lowered.</p>
<pre><code class="python">PrimalSolutionComponent(threshold=MinPrecisionThreshold(0.95))
<pre><code class="language-python">PrimalSolutionComponent(threshold=MinPrecisionThreshold(0.95))
</code></pre>
<h3 id="evaluating-component-performance">Evaluating component performance</h3>
<p>MIPLearn allows solver components to be modified, trained and evaluated in isolation. In the following example, we build and
fit <code>PrimalSolutionComponent</code> outside the solver, then evaluate its performance.</p>
<pre><code class="python">from miplearn import PrimalSolutionComponent
<pre><code class="language-python">from miplearn import PrimalSolutionComponent
# User-provided set of previously-solved instances
train_instances = [...]
@ -217,14 +215,12 @@ comp.fit(train_instances[:100])
# Evaluate performance on an additional set of training instances
ev = comp.evaluate(train_instances[100:150])
</code></pre>
<p>The method <code>evaluate</code> returns a dictionary with performance evaluation statistics for each training instance provided,
and for each type of prediction the component makes. To obtain a summary across all instances, pandas may be used, as below:</p>
<pre><code class="python">import pandas as pd
<pre><code class="language-python">import pandas as pd
pd.DataFrame(ev[&quot;Fix one&quot;]).mean(axis=1)
</code></pre>
<pre><code class="text">Predicted positive 3.120000
<pre><code class="language-text">Predicted positive 3.120000
Predicted negative 196.880000
Condition positive 62.500000
Condition negative 137.500000
@ -246,10 +242,9 @@ False positive (%) 0.030000
False negative (%) 29.720000
dtype: float64
</code></pre>
<p>Regression components (such as <code>ObjectiveValueComponent</code>) can also be trained and evaluated similarly,
as the next example shows:</p>
<pre><code class="python">from miplearn import ObjectiveValueComponent
<pre><code class="language-python">from miplearn import ObjectiveValueComponent
comp = ObjectiveValueComponent()
comp.fit(train_instances[:100])
ev = comp.evaluate(train_instances[100:150])
@ -257,8 +252,7 @@ ev = comp.evaluate(train_instances[100:150])
import pandas as pd
pd.DataFrame(ev).mean(axis=1)
</code></pre>
<pre><code class="text">Mean squared error 7001.977827
<pre><code class="language-text">Mean squared error 7001.977827
Explained variance 0.519790
Max error 242.375804
Mean absolute error 65.843924
@ -266,7 +260,6 @@ R2 0.517612
Median absolute error 65.843924
dtype: float64
</code></pre>
<h3 id="using-customized-ml-classifiers-and-regressors">Using customized ML classifiers and regressors</h3>
<p>By default, given a training set of instantes, MIPLearn trains a fixed set of ML classifiers and regressors, then
selects the best one based on cross-validation performance. Alternatively, the user may specify which ML model a component
@ -281,7 +274,7 @@ predictors. This is a known limitation, which will be addressed in a future vers
</div>
<p>The example below shows how to construct a <code>PrimalSolutionComponent</code> which internally uses
sklearn's <code>KNeighborsClassifiers</code>. Any other sklearn classifier or pipeline can be used. </p>
<pre><code class="python">from miplearn import PrimalSolutionComponent
<pre><code class="language-python">from miplearn import PrimalSolutionComponent
from sklearn.neighbors import KNeighborsClassifier
comp = PrimalSolutionComponent(classifier=KNeighborsClassifier(n_neighbors=5))
@ -291,18 +284,22 @@ comp.fit(train_instances)
</div>
<footer class="col-md-12 text-center">
<hr>
<p>
<small>Copyright © 2020, UChicago Argonne, LLC. All Rights Reserved.</small><br>
<footer class="col-md-12 text-center">
<hr>
<p>
<small>Copyright © 2020, UChicago Argonne, LLC. All Rights Reserved.</small><br>
<small>Documentation built with <a href="http://www.mkdocs.org/">MkDocs</a>.</small>
</p>
<small>Documentation built with <a href="http://www.mkdocs.org/">MkDocs</a>.</small>
</p>
</footer>
</footer>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="../js/bootstrap-3.0.3.min.js"></script>

@ -59,7 +59,9 @@
<!-- Main title -->
<a class="navbar-brand" href=".">MIPLearn</a>
<a class="navbar-brand" href=".">MIPLearn</a>
</div>
<!-- Expanded navigation -->
@ -179,18 +181,22 @@
</div>
<footer class="col-md-12 text-center">
<hr>
<p>
<small>Copyright © 2020, UChicago Argonne, LLC. All Rights Reserved.</small><br>
<footer class="col-md-12 text-center">
<hr>
<p>
<small>Copyright © 2020, UChicago Argonne, LLC. All Rights Reserved.</small><br>
<small>Documentation built with <a href="http://www.mkdocs.org/">MkDocs</a>.</small>
</p>
<small>Documentation built with <a href="http://www.mkdocs.org/">MkDocs</a>.</small>
</p>
</footer>
</footer>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="js/bootstrap-3.0.3.min.js"></script>
@ -279,5 +285,5 @@
<!--
MkDocs version : 1.1.2
Build Date UTC : 2020-09-25 10:54:38.289401+00:00
Build Date UTC : 2020-12-03 18:22:04.344984+00:00
-->

@ -59,7 +59,9 @@
<!-- Main title -->
<a class="navbar-brand" href="..">MIPLearn</a>
<a class="navbar-brand" href="..">MIPLearn</a>
</div>
<!-- Expanded navigation -->
@ -183,12 +185,11 @@
<li>Random vertex weights $w_v \sim U(100, 150)$</li>
<li>500 training instances, 50 test instances</li>
</ul>
<pre><code class="python">MaxWeightStableSetGenerator(w=uniform(loc=100., scale=50.),
<pre><code class="language-python">MaxWeightStableSetGenerator(w=uniform(loc=100., scale=50.),
n=randint(low=200, high=201),
p=uniform(loc=0.05, scale=0.0),
fix_graph=True)
</code></pre>
<p><img alt="alt" src="../figures/benchmark_stab_a.png" /></p>
<h2 id="traveling-salesman-problem">Traveling Salesman Problem</h2>
<h3 id="problem-definition_1">Problem definition</h3>
@ -215,7 +216,7 @@ is provided, this rounding will be disabled.</p>
<li>$\gamma_{i,j} \sim U(0.95, 1.05)$</li>
<li>500 training instances, 50 test instances</li>
</ul>
<pre><code class="python">TravelingSalesmanGenerator(x=uniform(loc=0.0, scale=1000.0),
<pre><code class="language-python">TravelingSalesmanGenerator(x=uniform(loc=0.0, scale=1000.0),
y=uniform(loc=0.0, scale=1000.0),
n=randint(low=350, high=351),
gamma=uniform(loc=0.95, scale=0.1),
@ -223,7 +224,6 @@ is provided, this rounding will be disabled.</p>
round=True,
)
</code></pre>
<p><img alt="alt" src="../figures/benchmark_tsp_a.png" /></p>
<h2 id="multidimensional-0-1-knapsack-problem">Multidimensional 0-1 Knapsack Problem</h2>
<h3 id="problem-definition_2">Problem definition</h3>
@ -275,7 +275,7 @@ from the provided probability distributions <code>K</code> and <code>u</code>.</
<li>$K = 500, u \sim U(0, 1), \alpha = 0.25$</li>
<li>500 training instances, 50 test instances</li>
</ul>
<pre><code class="python">MultiKnapsackGenerator(n=randint(low=250, high=251),
<pre><code class="language-python">MultiKnapsackGenerator(n=randint(low=250, high=251),
m=randint(low=10, high=11),
w=uniform(loc=0.0, scale=1000.0),
K=uniform(loc=500.0, scale=0.0),
@ -285,24 +285,27 @@ from the provided probability distributions <code>K</code> and <code>u</code>.</
w_jitter=uniform(loc=0.95, scale=0.1),
)
</code></pre>
<p><img alt="alt" src="../figures/benchmark_knapsack_a.png" /></p></div>
</div>
<footer class="col-md-12 text-center">
<hr>
<p>
<small>Copyright © 2020, UChicago Argonne, LLC. All Rights Reserved.</small><br>
<footer class="col-md-12 text-center">
<hr>
<p>
<small>Copyright © 2020, UChicago Argonne, LLC. All Rights Reserved.</small><br>
<small>Documentation built with <a href="http://www.mkdocs.org/">MkDocs</a>.</small>
</p>
<small>Documentation built with <a href="http://www.mkdocs.org/">MkDocs</a>.</small>
</p>
</footer>
</footer>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="../js/bootstrap-3.0.3.min.js"></script>

File diff suppressed because one or more lines are too long

@ -1,27 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><url>
<loc>None</loc>
<lastmod>2020-09-25</lastmod>
<lastmod>2020-12-03</lastmod>
<changefreq>daily</changefreq>
</url><url>
<loc>None</loc>
<lastmod>2020-09-25</lastmod>
<lastmod>2020-12-03</lastmod>
<changefreq>daily</changefreq>
</url><url>
<loc>None</loc>
<lastmod>2020-09-25</lastmod>
<lastmod>2020-12-03</lastmod>
<changefreq>daily</changefreq>
</url><url>
<loc>None</loc>
<lastmod>2020-09-25</lastmod>
<lastmod>2020-12-03</lastmod>
<changefreq>daily</changefreq>
</url><url>
<loc>None</loc>
<lastmod>2020-09-25</lastmod>
<lastmod>2020-12-03</lastmod>
<changefreq>daily</changefreq>
</url><url>
<loc>None</loc>
<lastmod>2020-09-25</lastmod>
<lastmod>2020-12-03</lastmod>
<changefreq>daily</changefreq>
</url>
</urlset>

Binary file not shown.

@ -59,7 +59,9 @@
<!-- Main title -->
<a class="navbar-brand" href="..">MIPLearn</a>
<a class="navbar-brand" href="..">MIPLearn</a>
</div>
<!-- Expanded navigation -->
@ -161,17 +163,15 @@
<h2 id="1-installation">1. Installation</h2>
<p>In these docs, we describe the Python/Pyomo version of the package, although a <a href="https://github.com/ANL-CEEESA/MIPLearn.jl">Julia/JuMP version</a> is also available. A mixed-integer solver is also required and its Python bindings must be properly installed. Supported solvers are currently CPLEX and Gurobi.</p>
<p>To install MIPLearn, run: </p>
<pre><code class="bash">pip3 install miplearn
<pre><code class="language-bash">pip3 install miplearn
</code></pre>
<p>After installation, the package <code>miplearn</code> should become available to Python. It can be imported
as follows:</p>
<pre><code class="python">import miplearn
<pre><code class="language-python">import miplearn
</code></pre>
<h2 id="2-using-learningsolver">2. Using <code>LearningSolver</code></h2>
<p>The main class provided by this package is <code>LearningSolver</code>, a learning-enhanced MIP solver which uses information from previously solved instances to accelerate the solution of new instances. The following example shows its basic usage:</p>
<pre><code class="python">from miplearn import LearningSolver
<pre><code class="language-python">from miplearn import LearningSolver
# List of user-provided instances
training_instances = [...]
@ -191,7 +191,6 @@ solver.fit(training_instances)
for instance in test_instances:
solver.solve(instance)
</code></pre>
<p>In this example, we have two lists of user-provided instances: <code>training_instances</code> and <code>test_instances</code>. We start by solving all training instances. Since there is no historical information available at this point, the instances will be processed from scratch, with no ML acceleration. After solving each instance, the solver stores within each <code>instance</code> object the optimal solution, the optimal objective value, and other information that can be used to accelerate future solves. After all training instances are solved, we call <code>solver.fit(training_instances)</code>. This instructs the solver to train all its internal machine-learning models based on the solutions of the (solved) trained instances. Subsequent calls to <code>solver.solve(instance)</code> will automatically use the trained Machine Learning models to accelerate the solution process.</p>
<h2 id="3-describing-problem-instances">3. Describing problem instances</h2>
<p>Instances to be solved by <code>LearningSolver</code> must derive from the abstract class <code>miplearn.Instance</code>. The following three abstract methods must be implemented:</p>
@ -245,7 +244,7 @@ for instance in test_instances:
</div>
<h2 id="6-saving-and-loading-solver-state">6. Saving and loading solver state</h2>
<p>After solving a large number of training instances, it may be desirable to save the current state of <code>LearningSolver</code> to disk, so that the solver can still use the acquired knowledge after the application restarts. This can be accomplished by using the standard <code>pickle</code> module, as the following example illustrates:</p>
<pre><code class="python">from miplearn import LearningSolver
<pre><code class="language-python">from miplearn import LearningSolver
import pickle
# Solve training instances
@ -270,10 +269,9 @@ test_instances = [...]
for instance in test_instances:
solver.solve(instance)
</code></pre>
<h2 id="7-solving-training-instances-in-parallel">7. Solving training instances in parallel</h2>
<p>In many situations, training and test instances can be solved in parallel to accelerate the training process. <code>LearningSolver</code> provides the method <code>parallel_solve(instances)</code> to easily achieve this:</p>
<pre><code class="python">from miplearn import LearningSolver
<pre><code class="language-python">from miplearn import LearningSolver
training_instances = [...]
solver = LearningSolver()
@ -284,7 +282,6 @@ solver.fit(training_instances)
test_instances = [...]
solver.parallel_solve(test_instances)
</code></pre>
<h2 id="8-current-limitations">8. Current Limitations</h2>
<ul>
<li>Only binary and continuous decision variables are currently supported.</li>
@ -293,18 +290,22 @@ solver.parallel_solve(test_instances)
</div>
<footer class="col-md-12 text-center">
<hr>
<p>
<small>Copyright © 2020, UChicago Argonne, LLC. All Rights Reserved.</small><br>
<footer class="col-md-12 text-center">
<hr>
<p>
<small>Copyright © 2020, UChicago Argonne, LLC. All Rights Reserved.</small><br>
<small>Documentation built with <a href="http://www.mkdocs.org/">MkDocs</a>.</small>
</p>
<small>Documentation built with <a href="http://www.mkdocs.org/">MkDocs</a>.</small>
</p>
</footer>
</footer>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="../js/bootstrap-3.0.3.min.js"></script>

Loading…
Cancel
Save