mirror of
https://github.com/ANL-CEEESA/MIPLearn.git
synced 2025-12-06 09:28:51 -06:00
Update docs
This commit is contained in:
@@ -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>
|
||||
|
||||
<small>Documentation built with <a href="http://www.mkdocs.org/">MkDocs</a>.</small>
|
||||
</p>
|
||||
|
||||
<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>
|
||||
|
||||
|
||||
|
||||
|
||||
</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>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user