You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
MIPLearn/0.2/benchmark/index.html

477 lines
32 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>2. Benchmarks &#8212; MIPLearn&lt;br/&gt;&lt;small&gt;0.2.0&lt;/small&gt;</title>
<link href="../_static/css/theme.css" rel="stylesheet" />
<link href="../_static/css/index.c5995385ac14fb8791e8eb36b4908be2.css" rel="stylesheet" />
<link rel="stylesheet"
href="../_static/vendor/fontawesome/5.13.0/css/all.min.css">
<link rel="preload" as="font" type="font/woff2" crossorigin
href="../_static/vendor/fontawesome/5.13.0/webfonts/fa-solid-900.woff2">
<link rel="preload" as="font" type="font/woff2" crossorigin
href="../_static/vendor/fontawesome/5.13.0/webfonts/fa-brands-400.woff2">
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../_static/sphinx-book-theme.acff12b8f9c144ce68a297486a2fa670.css" type="text/css" />
<link rel="stylesheet" type="text/css" href="../_static/custom.css" />
<link rel="preload" as="script" href="../_static/js/index.1c5a1a01449ed65a7b51.js">
<script id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
<script src="../_static/jquery.js"></script>
<script src="../_static/underscore.js"></script>
<script src="../_static/doctools.js"></script>
<script src="../_static/sphinx-book-theme.12a9622fbb08dcb3a2a40b2c02b83a57.js"></script>
<script async="async" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/latest.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/x-mathjax-config">MathJax.Hub.Config({"tex2jax": {"inlineMath": [["\\(", "\\)"]], "displayMath": [["\\[", "\\]"]], "processRefs": false, "processEnvironments": false}})</script>
<link rel="author" title="About these documents" href="../about/" />
<link rel="index" title="Index" href="../genindex/" />
<link rel="search" title="Search" href="../search/" />
<link rel="next" title="3. Customization" href="../customization/" />
<link rel="prev" title="1. Using MIPLearn" href="../usage/" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="docsearch:language" content="en" />
</head>
<body data-spy="scroll" data-target="#bd-toc-nav" data-offset="80">
<div class="container-fluid" id="banner"></div>
<div class="container-xl">
<div class="row">
<div class="col-12 col-md-3 bd-sidebar site-navigation show" id="site-navigation">
<div class="navbar-brand-box">
<a class="navbar-brand text-wrap" href="../">
<h1 class="site-logo" id="site-title">MIPLearn<br/><small>0.2.0</small></h1>
</a>
</div><form class="bd-search d-flex align-items-center" action="../search/" method="get">
<i class="icon fas fa-search"></i>
<input type="search" class="form-control" name="q" id="search-input" placeholder="Search the docs ..." aria-label="Search the docs ..." autocomplete="off" >
</form><nav class="bd-links" id="bd-docs-nav" aria-label="Main navigation">
<div class="bd-toc-item active">
<ul class="current nav bd-sidenav">
<li class="toctree-l1">
<a class="reference internal" href="../usage/">
<span class="sectnum">
1.
</span>
Using MIPLearn
</a>
</li>
<li class="toctree-l1 current active">
<a class="current reference internal" href="#">
<span class="sectnum">
2.
</span>
Benchmarks
</a>
</li>
<li class="toctree-l1">
<a class="reference internal" href="../customization/">
<span class="sectnum">
3.
</span>
Customization
</a>
</li>
<li class="toctree-l1">
<a class="reference internal" href="../about/">
<span class="sectnum">
4.
</span>
About
</a>
</li>
</ul>
</div>
</nav> <!-- To handle the deprecated key -->
</div>
<main class="col py-md-3 pl-md-4 bd-content overflow-auto" role="main">
<div class="topbar container-xl fixed-top">
<div class="topbar-contents row">
<div class="col-12 col-md-3 bd-topbar-whitespace site-navigation show"></div>
<div class="col pl-md-4 topbar-main">
<button id="navbar-toggler" class="navbar-toggler ml-0" type="button" data-toggle="collapse"
data-toggle="tooltip" data-placement="bottom" data-target=".site-navigation" aria-controls="navbar-menu"
aria-expanded="true" aria-label="Toggle navigation" aria-controls="site-navigation"
title="Toggle navigation" data-toggle="tooltip" data-placement="left">
<i class="fas fa-bars"></i>
<i class="fas fa-arrow-left"></i>
<i class="fas fa-arrow-up"></i>
</button>
<div class="dropdown-buttons-trigger">
<button id="dropdown-buttons-trigger" class="btn btn-secondary topbarbtn" aria-label="Download this page"><i
class="fas fa-download"></i></button>
<div class="dropdown-buttons">
<!-- ipynb file if we had a myst markdown file -->
<!-- Download raw file -->
<a class="dropdown-buttons" href="../_sources/benchmark.md.txt"><button type="button"
class="btn btn-secondary topbarbtn" title="Download source file" data-toggle="tooltip"
data-placement="left">.md</button></a>
<!-- Download PDF via print -->
<button type="button" id="download-print" class="btn btn-secondary topbarbtn" title="Print to PDF"
onClick="window.print()" data-toggle="tooltip" data-placement="left">.pdf</button>
</div>
</div>
<!-- Source interaction buttons -->
<div class="dropdown-buttons-trigger">
<button id="dropdown-buttons-trigger" class="btn btn-secondary topbarbtn"
aria-label="Connect with source repository"><i class="fab fa-github"></i></button>
<div class="dropdown-buttons sourcebuttons">
<a class="repository-button"
href="https://github.com/ANL-CEEESA/MIPLearn/"><button type="button" class="btn btn-secondary topbarbtn"
data-toggle="tooltip" data-placement="left" title="Source repository"><i
class="fab fa-github"></i>repository</button></a>
</div>
</div>
<!-- Full screen (wrap in <a> to have style consistency -->
<a class="full-screen-button"><button type="button" class="btn btn-secondary topbarbtn" data-toggle="tooltip"
data-placement="bottom" onclick="toggleFullScreen()" aria-label="Fullscreen mode"
title="Fullscreen mode"><i
class="fas fa-expand"></i></button></a>
<!-- Launch buttons -->
</div>
<!-- Table of contents -->
<div class="d-none d-md-block col-md-2 bd-toc show">
<div class="tocsection onthispage pt-5 pb-3">
<i class="fas fa-list"></i> Contents
</div>
<nav id="bd-toc-nav">
<ul class="visible nav section-nav flex-column">
<li class="toc-h2 nav-item toc-entry">
<a class="reference internal nav-link" href="#preliminaries">
<span class="sectnum">
2.1.
</span>
Preliminaries
</a>
<ul class="nav section-nav flex-column">
<li class="toc-h3 nav-item toc-entry">
<a class="reference internal nav-link" href="#benchmark-challenges">
Benchmark challenges
</a>
</li>
<li class="toc-h3 nav-item toc-entry">
<a class="reference internal nav-link" href="#baseline-results">
Baseline results
</a>
</li>
</ul>
</li>
<li class="toc-h2 nav-item toc-entry">
<a class="reference internal nav-link" href="#maximum-weight-stable-set-problem">
<span class="sectnum">
2.2.
</span>
Maximum Weight Stable Set Problem
</a>
<ul class="nav section-nav flex-column">
<li class="toc-h3 nav-item toc-entry">
<a class="reference internal nav-link" href="#problem-definition">
Problem definition
</a>
</li>
<li class="toc-h3 nav-item toc-entry">
<a class="reference internal nav-link" href="#random-instance-generator">
Random instance generator
</a>
</li>
<li class="toc-h3 nav-item toc-entry">
<a class="reference internal nav-link" href="#challenge-a">
Challenge A
</a>
</li>
</ul>
</li>
<li class="toc-h2 nav-item toc-entry">
<a class="reference internal nav-link" href="#traveling-salesman-problem">
<span class="sectnum">
2.3.
</span>
Traveling Salesman Problem
</a>
<ul class="nav section-nav flex-column">
<li class="toc-h3 nav-item toc-entry">
<a class="reference internal nav-link" href="#id1">
Problem definition
</a>
</li>
<li class="toc-h3 nav-item toc-entry">
<a class="reference internal nav-link" href="#random-problem-generator">
Random problem generator
</a>
</li>
<li class="toc-h3 nav-item toc-entry">
<a class="reference internal nav-link" href="#id2">
Challenge A
</a>
</li>
</ul>
</li>
<li class="toc-h2 nav-item toc-entry">
<a class="reference internal nav-link" href="#multidimensional-0-1-knapsack-problem">
<span class="sectnum">
2.4.
</span>
Multidimensional 0-1 Knapsack Problem
</a>
<ul class="nav section-nav flex-column">
<li class="toc-h3 nav-item toc-entry">
<a class="reference internal nav-link" href="#id3">
Problem definition
</a>
</li>
<li class="toc-h3 nav-item toc-entry">
<a class="reference internal nav-link" href="#id4">
Random instance generator
</a>
</li>
<li class="toc-h3 nav-item toc-entry">
<a class="reference internal nav-link" href="#id5">
Challenge A
</a>
</li>
</ul>
</li>
</ul>
</nav>
</div>
</div>
</div>
<div id="main-content" class="row">
<div class="col-12 col-md-9 pl-md-3 pr-md-0">
<div>
<div class="section" id="benchmarks">
<h1><span class="sectnum">2.</span> Benchmarks<a class="headerlink" href="#benchmarks" title="Permalink to this headline"></a></h1>
<p>MIPLearn provides a selection of benchmark problems and random instance generators, covering applications from different fields, that can be used to evaluate new learning-enhanced MIP techniques in a measurable and reproducible way. In this page, we describe these problems, the included instance generators, and we present some benchmark results for <code class="docutils literal notranslate"><span class="pre">LearningSolver</span></code> with default parameters.</p>
<div class="section" id="preliminaries">
<h2><span class="sectnum">2.1.</span> Preliminaries<a class="headerlink" href="#preliminaries" title="Permalink to this headline"></a></h2>
<div class="section" id="benchmark-challenges">
<h3>Benchmark challenges<a class="headerlink" href="#benchmark-challenges" title="Permalink to this headline"></a></h3>
<p>When evaluating the performance of a conventional MIP solver, <em>benchmark sets</em>, such as MIPLIB and TSPLIB, are typically used. The performance of newly proposed solvers or solution techniques are typically measured as the average (or total) running time the solver takes to solve the entire benchmark set. For Learning-Enhanced MIP solvers, it is also necessary to specify what instances should the solver be trained on (the <em>training instances</em>) before solving the actual set of instances we are interested in (the <em>test instances</em>). If the training instances are very similar to the test instances, we would expect a Learning-Enhanced Solver to present stronger perfomance benefits.</p>
<p>In MIPLearn, each optimization problem comes with a set of <strong>benchmark challenges</strong>, which specify how should the training and test instances be generated. The first challenges are typically easier, in the sense that training and test instances are very similar. Later challenges gradually make the sets more distinct, and therefore harder to learn from.</p>
</div>
<div class="section" id="baseline-results">
<h3>Baseline results<a class="headerlink" href="#baseline-results" title="Permalink to this headline"></a></h3>
<p>To illustrate the performance of <code class="docutils literal notranslate"><span class="pre">LearningSolver</span></code>, and to set a baseline for newly proposed techniques, we present in this page, for each benchmark challenge, a small set of computational results measuring the solution speed of the solver and the solution quality with default parameters. For more detailed computational studies, see <a class="reference external" href="about.md#references">references</a>. We compare three solvers:</p>
<ul class="simple">
<li><p><strong>baseline:</strong> Gurobi 9.0 with default settings (a conventional state-of-the-art MIP solver)</p></li>
<li><p><strong>ml-exact:</strong> <code class="docutils literal notranslate"><span class="pre">LearningSolver</span></code> with default settings, using Gurobi 9.0 as internal MIP solver</p></li>
<li><p><strong>ml-heuristic:</strong> Same as above, but with <code class="docutils literal notranslate"><span class="pre">mode=&quot;heuristic&quot;</span></code></p></li>
</ul>
<p>All experiments presented here were performed on a Linux server (Ubuntu Linux 18.04 LTS) with Intel Xeon Gold 6230s (2 processors, 40 cores, 80 threads) and 256 GB RAM (DDR4, 2933 MHz). All solvers were restricted to use 4 threads, with no time limits, and 10 instances were solved simultaneously at a time.</p>
</div>
</div>
<div class="section" id="maximum-weight-stable-set-problem">
<h2><span class="sectnum">2.2.</span> Maximum Weight Stable Set Problem<a class="headerlink" href="#maximum-weight-stable-set-problem" title="Permalink to this headline"></a></h2>
<div class="section" id="problem-definition">
<h3>Problem definition<a class="headerlink" href="#problem-definition" title="Permalink to this headline"></a></h3>
<p>Given a simple undirected graph <span class="math notranslate nohighlight">\(G=(V,E)\)</span> and weights <span class="math notranslate nohighlight">\(w \in \mathbb{R}^V\)</span>, the problem is to find a stable set <span class="math notranslate nohighlight">\(S \subseteq V\)</span> that maximizes <span class="math notranslate nohighlight">\( \sum_{v \in V} w_v\)</span>. We recall that a subset <span class="math notranslate nohighlight">\(S \subseteq V\)</span> is a <em>stable set</em> if no two vertices of <span class="math notranslate nohighlight">\(S\)</span> are adjacent. This is one of Karps 21 NP-complete problems.</p>
</div>
<div class="section" id="random-instance-generator">
<h3>Random instance generator<a class="headerlink" href="#random-instance-generator" title="Permalink to this headline"></a></h3>
<p>The class <code class="docutils literal notranslate"><span class="pre">MaxWeightStableSetGenerator</span></code> can be used to generate random instances of this problem, with user-specified probability distributions. When the constructor parameter <code class="docutils literal notranslate"><span class="pre">fix_graph=True</span></code> is provided, one random Erdős-Rényi graph <span class="math notranslate nohighlight">\(G_{n,p}\)</span> is generated during the constructor, where <span class="math notranslate nohighlight">\(n\)</span> and <span class="math notranslate nohighlight">\(p\)</span> are sampled from user-provided probability distributions <code class="docutils literal notranslate"><span class="pre">n</span></code> and <code class="docutils literal notranslate"><span class="pre">p</span></code>. To generate each instance, the generator independently samples each <span class="math notranslate nohighlight">\(w_v\)</span> from the user-provided probability distribution <code class="docutils literal notranslate"><span class="pre">w</span></code>. When <code class="docutils literal notranslate"><span class="pre">fix_graph=False</span></code>, a new random graph is generated for each instance, while the remaining parameters are sampled in the same way.</p>
</div>
<div class="section" id="challenge-a">
<h3>Challenge A<a class="headerlink" href="#challenge-a" title="Permalink to this headline"></a></h3>
<ul class="simple">
<li><p>Fixed random Erdős-Rényi graph <span class="math notranslate nohighlight">\(G_{n,p}\)</span> with <span class="math notranslate nohighlight">\(n=200\)</span> and <span class="math notranslate nohighlight">\(p=5\%\)</span></p></li>
<li><p>Random vertex weights <span class="math notranslate nohighlight">\(w_v \sim U(100, 150)\)</span></p></li>
<li><p>500 training instances, 50 test instances</p></li>
</ul>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">MaxWeightStableSetGenerator</span><span class="p">(</span><span class="n">w</span><span class="o">=</span><span class="n">uniform</span><span class="p">(</span><span class="n">loc</span><span class="o">=</span><span class="mf">100.</span><span class="p">,</span> <span class="n">scale</span><span class="o">=</span><span class="mf">50.</span><span class="p">),</span>
<span class="n">n</span><span class="o">=</span><span class="n">randint</span><span class="p">(</span><span class="n">low</span><span class="o">=</span><span class="mi">200</span><span class="p">,</span> <span class="n">high</span><span class="o">=</span><span class="mi">201</span><span class="p">),</span>
<span class="n">p</span><span class="o">=</span><span class="n">uniform</span><span class="p">(</span><span class="n">loc</span><span class="o">=</span><span class="mf">0.05</span><span class="p">,</span> <span class="n">scale</span><span class="o">=</span><span class="mf">0.0</span><span class="p">),</span>
<span class="n">fix_graph</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
</pre></div>
</div>
<p><img alt="alt" src="figures/benchmark_stab_a.png" /></p>
</div>
</div>
<div class="section" id="traveling-salesman-problem">
<h2><span class="sectnum">2.3.</span> Traveling Salesman Problem<a class="headerlink" href="#traveling-salesman-problem" title="Permalink to this headline"></a></h2>
<div class="section" id="id1">
<h3>Problem definition<a class="headerlink" href="#id1" title="Permalink to this headline"></a></h3>
<p>Given a list of cities and the distance between each pair of cities, the problem asks for the
shortest route starting at the first city, visiting each other city exactly once, then returning
to the first city. This problem is a generalization of the Hamiltonian path problem, one of Karps
21 NP-complete problems.</p>
</div>
<div class="section" id="random-problem-generator">
<h3>Random problem generator<a class="headerlink" href="#random-problem-generator" title="Permalink to this headline"></a></h3>
<p>The class <code class="docutils literal notranslate"><span class="pre">TravelingSalesmanGenerator</span></code> can be used to generate random instances of this
problem. Initially, the generator creates <span class="math notranslate nohighlight">\(n\)</span> cities <span class="math notranslate nohighlight">\((x_1,y_1),\ldots,(x_n,y_n) \in \mathbb{R}^2\)</span>,
where <span class="math notranslate nohighlight">\(n, x_i\)</span> and <span class="math notranslate nohighlight">\(y_i\)</span> are sampled independently from the provided probability distributions <code class="docutils literal notranslate"><span class="pre">n</span></code>,
<code class="docutils literal notranslate"><span class="pre">x</span></code> and <code class="docutils literal notranslate"><span class="pre">y</span></code>. For each pair of cities <span class="math notranslate nohighlight">\((i,j)\)</span>, the distance <span class="math notranslate nohighlight">\(d_{i,j}\)</span> between them is set to:
$<span class="math notranslate nohighlight">\(
d_{i,j} = \gamma_{i,j} \sqrt{(x_i-x_j)^2 + (y_i - y_j)^2}
\)</span><span class="math notranslate nohighlight">\(
where \)</span>\gamma_{i,j}$ is sampled from the distribution <code class="docutils literal notranslate"><span class="pre">gamma</span></code>.</p>
<p>If <code class="docutils literal notranslate"><span class="pre">fix_cities=True</span></code> is provided, the list of cities is kept the same for all generated instances.
The <span class="math notranslate nohighlight">\(gamma\)</span> values, and therefore also the distances, are still different.</p>
<p>By default, all distances <span class="math notranslate nohighlight">\(d_{i,j}\)</span> are rounded to the nearest integer. If <code class="docutils literal notranslate"><span class="pre">round=False</span></code>
is provided, this rounding will be disabled.</p>
</div>
<div class="section" id="id2">
<h3>Challenge A<a class="headerlink" href="#id2" title="Permalink to this headline"></a></h3>
<ul class="simple">
<li><p>Fixed list of 350 cities in the <span class="math notranslate nohighlight">\([0, 1000]^2\)</span> square</p></li>
<li><p><span class="math notranslate nohighlight">\(\gamma_{i,j} \sim U(0.95, 1.05)\)</span></p></li>
<li><p>500 training instances, 50 test instances</p></li>
</ul>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">TravelingSalesmanGenerator</span><span class="p">(</span><span class="n">x</span><span class="o">=</span><span class="n">uniform</span><span class="p">(</span><span class="n">loc</span><span class="o">=</span><span class="mf">0.0</span><span class="p">,</span> <span class="n">scale</span><span class="o">=</span><span class="mf">1000.0</span><span class="p">),</span>
<span class="n">y</span><span class="o">=</span><span class="n">uniform</span><span class="p">(</span><span class="n">loc</span><span class="o">=</span><span class="mf">0.0</span><span class="p">,</span> <span class="n">scale</span><span class="o">=</span><span class="mf">1000.0</span><span class="p">),</span>
<span class="n">n</span><span class="o">=</span><span class="n">randint</span><span class="p">(</span><span class="n">low</span><span class="o">=</span><span class="mi">350</span><span class="p">,</span> <span class="n">high</span><span class="o">=</span><span class="mi">351</span><span class="p">),</span>
<span class="n">gamma</span><span class="o">=</span><span class="n">uniform</span><span class="p">(</span><span class="n">loc</span><span class="o">=</span><span class="mf">0.95</span><span class="p">,</span> <span class="n">scale</span><span class="o">=</span><span class="mf">0.1</span><span class="p">),</span>
<span class="n">fix_cities</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span>
<span class="nb">round</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span>
<span class="p">)</span>
</pre></div>
</div>
<p><img alt="alt" src="figures/benchmark_tsp_a.png" /></p>
</div>
</div>
<div class="section" id="multidimensional-0-1-knapsack-problem">
<h2><span class="sectnum">2.4.</span> Multidimensional 0-1 Knapsack Problem<a class="headerlink" href="#multidimensional-0-1-knapsack-problem" title="Permalink to this headline"></a></h2>
<div class="section" id="id3">
<h3>Problem definition<a class="headerlink" href="#id3" title="Permalink to this headline"></a></h3>
<p>Given a set of <span class="math notranslate nohighlight">\(n\)</span> items and <span class="math notranslate nohighlight">\(m\)</span> types of resources (also called <em>knapsacks</em>), the problem is to find a subset of items that maximizes profit without consuming more resources than it is available. More precisely, the problem is:</p>
<div class="math notranslate nohighlight">
\[\begin{split}
\begin{align*}
\text{maximize}
&amp; \sum_{j=1}^n p_j x_j
\\
\text{subject to}
&amp; \sum_{j=1}^n w_{ij} x_j \leq b_i
&amp; \forall i=1,\ldots,m \\
&amp; x_j \in \{0,1\}
&amp; \forall j=1,\ldots,n
\end{align*}
\end{split}\]</div>
</div>
<div class="section" id="id4">
<h3>Random instance generator<a class="headerlink" href="#id4" title="Permalink to this headline"></a></h3>
<p>The class <code class="docutils literal notranslate"><span class="pre">MultiKnapsackGenerator</span></code> can be used to generate random instances of this problem. The number of items <span class="math notranslate nohighlight">\(n\)</span> and knapsacks <span class="math notranslate nohighlight">\(m\)</span> are sampled from the user-provided probability distributions <code class="docutils literal notranslate"><span class="pre">n</span></code> and <code class="docutils literal notranslate"><span class="pre">m</span></code>. The weights <span class="math notranslate nohighlight">\(w_{ij}\)</span> are sampled independently from the provided distribution <code class="docutils literal notranslate"><span class="pre">w</span></code>. The capacity of knapsack <span class="math notranslate nohighlight">\(i\)</span> is set to</p>
<div class="math notranslate nohighlight">
\[
b_i = \alpha_i \sum_{j=1}^n w_{ij}
\]</div>
<p>where <span class="math notranslate nohighlight">\(\alpha_i\)</span>, the tightness ratio, is sampled from the provided probability
distribution <code class="docutils literal notranslate"><span class="pre">alpha</span></code>. To make the instances more challenging, the costs of the items
are linearly correlated to their average weights. More specifically, the price of each
item <span class="math notranslate nohighlight">\(j\)</span> is set to:</p>
<div class="math notranslate nohighlight">
\[
p_j = \sum_{i=1}^m \frac{w_{ij}}{m} + K u_j,
\]</div>
<p>where <span class="math notranslate nohighlight">\(K\)</span>, the correlation coefficient, and <span class="math notranslate nohighlight">\(u_j\)</span>, the correlation multiplier, are sampled
from the provided probability distributions <code class="docutils literal notranslate"><span class="pre">K</span></code> and <code class="docutils literal notranslate"><span class="pre">u</span></code>.</p>
<p>If <code class="docutils literal notranslate"><span class="pre">fix_w=True</span></code> is provided, then <span class="math notranslate nohighlight">\(w_{ij}\)</span> are kept the same in all generated instances. This also implies that <span class="math notranslate nohighlight">\(n\)</span> and <span class="math notranslate nohighlight">\(m\)</span> are kept fixed. Although the prices and capacities are derived from <span class="math notranslate nohighlight">\(w_{ij}\)</span>, as long as <code class="docutils literal notranslate"><span class="pre">u</span></code> and <code class="docutils literal notranslate"><span class="pre">K</span></code> are not constants, the generated instances will still not be completely identical.</p>
<p>If a probability distribution <code class="docutils literal notranslate"><span class="pre">w_jitter</span></code> is provided, then item weights will be set to <span class="math notranslate nohighlight">\(w_{ij} \gamma_{ij}\)</span> where <span class="math notranslate nohighlight">\(\gamma_{ij}\)</span> is sampled from <code class="docutils literal notranslate"><span class="pre">w_jitter</span></code>. When combined with <code class="docutils literal notranslate"><span class="pre">fix_w=True</span></code>, this argument may be used to generate instances where the weight of each item is roughly the same, but not exactly identical, across all instances. The prices of the items and the capacities of the knapsacks will be calculated as above, but using these perturbed weights instead.</p>
<p>By default, all generated prices, weights and capacities are rounded to the nearest integer number. If <code class="docutils literal notranslate"><span class="pre">round=False</span></code> is provided, this rounding will be disabled.</p>
<p>!!! note “References”
* Freville, Arnaud, and Gérard Plateau. <em>An efficient preprocessing procedure for the multidimensional 01 knapsack problem.</em> Discrete applied mathematics 49.1-3 (1994): 189-212.
* Fréville, Arnaud. <em>The multidimensional 01 knapsack problem: An overview.</em> European Journal of Operational Research 155.1 (2004): 1-21.</p>
</div>
<div class="section" id="id5">
<h3>Challenge A<a class="headerlink" href="#id5" title="Permalink to this headline"></a></h3>
<ul class="simple">
<li><p>250 variables, 10 constraints, fixed weights</p></li>
<li><p><span class="math notranslate nohighlight">\(w \sim U(0, 1000), \gamma \sim U(0.95, 1.05)\)</span></p></li>
<li><p><span class="math notranslate nohighlight">\(K = 500, u \sim U(0, 1), \alpha = 0.25\)</span></p></li>
<li><p>500 training instances, 50 test instances</p></li>
</ul>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">MultiKnapsackGenerator</span><span class="p">(</span><span class="n">n</span><span class="o">=</span><span class="n">randint</span><span class="p">(</span><span class="n">low</span><span class="o">=</span><span class="mi">250</span><span class="p">,</span> <span class="n">high</span><span class="o">=</span><span class="mi">251</span><span class="p">),</span>
<span class="n">m</span><span class="o">=</span><span class="n">randint</span><span class="p">(</span><span class="n">low</span><span class="o">=</span><span class="mi">10</span><span class="p">,</span> <span class="n">high</span><span class="o">=</span><span class="mi">11</span><span class="p">),</span>
<span class="n">w</span><span class="o">=</span><span class="n">uniform</span><span class="p">(</span><span class="n">loc</span><span class="o">=</span><span class="mf">0.0</span><span class="p">,</span> <span class="n">scale</span><span class="o">=</span><span class="mf">1000.0</span><span class="p">),</span>
<span class="n">K</span><span class="o">=</span><span class="n">uniform</span><span class="p">(</span><span class="n">loc</span><span class="o">=</span><span class="mf">500.0</span><span class="p">,</span> <span class="n">scale</span><span class="o">=</span><span class="mf">0.0</span><span class="p">),</span>
<span class="n">u</span><span class="o">=</span><span class="n">uniform</span><span class="p">(</span><span class="n">loc</span><span class="o">=</span><span class="mf">0.0</span><span class="p">,</span> <span class="n">scale</span><span class="o">=</span><span class="mf">1.0</span><span class="p">),</span>
<span class="n">alpha</span><span class="o">=</span><span class="n">uniform</span><span class="p">(</span><span class="n">loc</span><span class="o">=</span><span class="mf">0.25</span><span class="p">,</span> <span class="n">scale</span><span class="o">=</span><span class="mf">0.0</span><span class="p">),</span>
<span class="n">fix_w</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span>
<span class="n">w_jitter</span><span class="o">=</span><span class="n">uniform</span><span class="p">(</span><span class="n">loc</span><span class="o">=</span><span class="mf">0.95</span><span class="p">,</span> <span class="n">scale</span><span class="o">=</span><span class="mf">0.1</span><span class="p">),</span>
<span class="p">)</span>
</pre></div>
</div>
<p><img alt="alt" src="figures/benchmark_knapsack_a.png" /></p>
</div>
</div>
</div>
</div>
<div class='prev-next-bottom'>
<a class='left-prev' id="prev-link" href="../usage/" title="previous page"><span class="sectnum">1.</span> Using MIPLearn</a>
<a class='right-next' id="next-link" href="../customization/" title="next page"><span class="sectnum">3.</span> Customization</a>
</div>
</div>
</div>
<footer class="footer mt-5 mt-md-0">
<div class="container">
<p>
&copy; Copyright 2020-2021, UChicago Argonne, LLC.<br/>
</p>
</div>
</footer>
</main>
</div>
</div>
<script src="../_static/js/index.1c5a1a01449ed65a7b51.js"></script>
</body>
</html>