Docs: reorganize sections

pull/3/head
Alinson S. Xavier 5 years ago
parent 92cc924fee
commit 857e6af1a0

@ -138,21 +138,22 @@
<div class="col-md-3"><div class="bs-sidebar hidden-print affix well" role="complementary"> <div class="col-md-3"><div class="bs-sidebar hidden-print affix well" role="complementary">
<ul class="nav bs-sidenav"> <ul class="nav bs-sidenav">
<li class="first-level active"><a href="#customization">Customization</a></li> <li class="first-level active"><a href="#customization">Customization</a></li>
<li class="second-level"><a href="#selecting-the-internal-mip-solver">Selecting the internal MIP solver</a></li> <li class="second-level"><a href="#customizing-solver-parameters">Customizing solver parameters</a></li>
<li class="second-level"><a href="#selecting-solver-components">Selecting solver components</a></li> <li class="third-level"><a href="#selecting-the-internal-mip-solver">Selecting the internal MIP solver</a></li>
<li class="second-level"><a href="#customizing-solver-components">Customizing solver components</a></li>
<li class="second-level"><a href="#adjusting-component-aggressiveness">Adjusting component aggressiveness</a></li>
<li class="second-level"><a href="#evaluating-component-performance">Evaluating component performance</a></li>
<li class="third-level"><a href="#selecting-components">Selecting components</a></li>
<li class="third-level"><a href="#adjusting-component-aggressiveness">Adjusting component aggressiveness</a></li>
<li class="third-level"><a href="#evaluating-component-performance">Evaluating component performance</a></li>
<li class="third-level"><a href="#using-customized-ml-classifiers-and-regressors">Using customized ML classifiers and regressors</a></li> <li class="third-level"><a href="#using-customized-ml-classifiers-and-regressors">Using customized ML classifiers and regressors</a></li>
</ul> </ul>
</div></div> </div></div>
<div class="col-md-9" role="main"> <div class="col-md-9" role="main">
<h1 id="customization">Customization</h1> <h1 id="customization">Customization</h1>
<h2 id="selecting-the-internal-mip-solver">Selecting the internal MIP solver</h2> <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> <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="python">from miplearn import LearningSolver
solver = LearningSolver(solver=&quot;cplex&quot;, solver = LearningSolver(solver=&quot;cplex&quot;,
@ -160,7 +161,7 @@ solver = LearningSolver(solver=&quot;cplex&quot;,
gap_tolerance=1e-3) gap_tolerance=1e-3)
</code></pre> </code></pre>
<h2 id="selecting-solver-components">Selecting solver components</h2> <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> <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> <ul>
<li><code>LazyConstraintComponent</code>: Predicts which lazy constraint to initially enforce.</li> <li><code>LazyConstraintComponent</code>: Predicts which lazy constraint to initially enforce.</li>
@ -171,6 +172,7 @@ solver = LearningSolver(solver=&quot;cplex&quot;,
<ul> <ul>
<li><code>BranchPriorityComponent</code>: Predicts good branch priorities for decision variables.</li> <li><code>BranchPriorityComponent</code>: Predicts good branch priorities for decision variables.</li>
</ul> </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> <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="python"># Create a solver without any components
solver1 = LearningSolver(components=[]) solver1 = LearningSolver(components=[])
@ -190,7 +192,7 @@ solver = LearningSolver()
solver.add(LazyConstraintComponent(...)) solver.add(LazyConstraintComponent(...))
</code></pre> </code></pre>
<h2 id="adjusting-component-aggressiveness">Adjusting component aggressiveness</h2> <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 <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 be adjusted through the <code>threshold</code> constructor argument. Internally, these components ask the ML models how confident
they are on each prediction (through the <code>predict_proba</code> method in the sklearn API), and only take into account they are on each prediction (through the <code>predict_proba</code> method in the sklearn API), and only take into account
@ -203,7 +205,7 @@ more aggressive, this precision may be lowered.</p>
<pre><code class="python">PrimalSolutionComponent(threshold=MinPrecisionThreshold(0.95)) <pre><code class="python">PrimalSolutionComponent(threshold=MinPrecisionThreshold(0.95))
</code></pre> </code></pre>
<h2 id="evaluating-component-performance">Evaluating component performance</h2> <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 <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> fit <code>PrimalSolutionComponent</code> outside the solver, then evaluate its performance.</p>
<pre><code class="python">from miplearn import PrimalSolutionComponent <pre><code class="python">from miplearn import PrimalSolutionComponent

@ -273,5 +273,5 @@
<!-- <!--
MkDocs version : 1.1 MkDocs version : 1.1
Build Date UTC : 2020-05-05 18:54:05 Build Date UTC : 2020-05-05 18:57:59
--> -->

File diff suppressed because one or more lines are too long

Binary file not shown.

@ -1,6 +1,8 @@
# Customization # Customization
## Selecting the internal MIP solver ## Customizing solver parameters
### Selecting the internal MIP solver
By default, `LearningSolver` uses [Gurobi](https://www.gurobi.com/) as its internal MIP solver. Another supported solver is [IBM ILOG CPLEX](https://www.ibm.com/products/ilog-cplex-optimization-studio). To switch between solvers, use the `solver` constructor argument, as shown below. It is also possible to specify a time limit (in seconds) and a relative MIP gap tolerance. By default, `LearningSolver` uses [Gurobi](https://www.gurobi.com/) as its internal MIP solver. Another supported solver is [IBM ILOG CPLEX](https://www.ibm.com/products/ilog-cplex-optimization-studio). To switch between solvers, use the `solver` constructor argument, as shown below. It is also possible to specify a time limit (in seconds) and a relative MIP gap tolerance.
@ -11,7 +13,7 @@ solver = LearningSolver(solver="cplex",
gap_tolerance=1e-3) gap_tolerance=1e-3)
``` ```
## Selecting solver components ## Customizing solver components
`LearningSolver` 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: `LearningSolver` 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:
@ -23,6 +25,8 @@ The following components are also available, but not enabled by default:
* `BranchPriorityComponent`: Predicts good branch priorities for decision variables. * `BranchPriorityComponent`: Predicts good branch priorities for decision variables.
### Selecting components
To create a `LearningSolver` with a specific set of components, the `components` constructor argument may be used, as the next example shows: To create a `LearningSolver` with a specific set of components, the `components` constructor argument may be used, as the next example shows:
```python ```python
@ -45,7 +49,7 @@ solver = LearningSolver()
solver.add(LazyConstraintComponent(...)) solver.add(LazyConstraintComponent(...))
``` ```
## Adjusting component aggressiveness ### Adjusting component aggressiveness
The aggressiveness of classification components (such as `PrimalSolutionComponent` and `LazyConstraintComponent`) can The aggressiveness of classification components (such as `PrimalSolutionComponent` and `LazyConstraintComponent`) can
be adjusted through the `threshold` constructor argument. Internally, these components ask the ML models how confident be adjusted through the `threshold` constructor argument. Internally, these components ask the ML models how confident
@ -62,7 +66,7 @@ more aggressive, this precision may be lowered.
PrimalSolutionComponent(threshold=MinPrecisionThreshold(0.95)) PrimalSolutionComponent(threshold=MinPrecisionThreshold(0.95))
``` ```
## Evaluating component performance ### Evaluating component performance
MIPLearn allows solver components to be modified, trained and evaluated in isolation. In the following example, we build and MIPLearn allows solver components to be modified, trained and evaluated in isolation. In the following example, we build and
fit `PrimalSolutionComponent` outside the solver, then evaluate its performance. fit `PrimalSolutionComponent` outside the solver, then evaluate its performance.

Loading…
Cancel
Save