Skip to content

Commit

Permalink
build based on 63959f8
Browse files Browse the repository at this point in the history
  • Loading branch information
Documenter.jl committed Nov 22, 2024
1 parent 4b93fad commit bc00e71
Show file tree
Hide file tree
Showing 110 changed files with 34,561 additions and 34,576 deletions.
2 changes: 1 addition & 1 deletion previews/PR3889/.documenter-siteinfo.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"documenter":{"julia_version":"1.11.1","generation_timestamp":"2024-11-22T04:07:38","documenter_version":"1.7.0"}}
{"documenter":{"julia_version":"1.11.1","generation_timestamp":"2024-11-22T04:07:09","documenter_version":"1.7.0"}}
Binary file modified previews/PR3889/JuMP.pdf
Binary file not shown.
30 changes: 15 additions & 15 deletions previews/PR3889/api/JuMP.Containers/index.html

Large diffs are not rendered by default.

556 changes: 278 additions & 278 deletions previews/PR3889/api/JuMP/index.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion previews/PR3889/moi/reference/models/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
model::MOI.ModelLike,
attr::MOI.AbstractConstraintAttribute,
bridge::AbstractBridge,
)</code></pre><p>Return the value of the attribute <code>attr</code> of the model <code>model</code> for the constraint bridged by <code>bridge</code>.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/jump-dev/MathOptInterface.jl/blob/v1.34.0/src/Bridges/bridge.jl#L133-L142">source</a></section><section><div><pre><code class="language-julia hljs">get(model::GenericModel, attr::MathOptInterface.AbstractOptimizerAttribute)</code></pre><p>Return the value of the attribute <code>attr</code> from the model&#39;s MOI backend.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/jump-dev/JuMP.jl/blob/eb3d99392b86ec08053ce9aba8764915087dfe82/src/optimizer_interface.jl#L987-L991">source</a></section><section><div><pre><code class="language-julia hljs">get(model::GenericModel, attr::MathOptInterface.AbstractModelAttribute)</code></pre><p>Return the value of the attribute <code>attr</code> from the model&#39;s MOI backend.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/jump-dev/JuMP.jl/blob/eb3d99392b86ec08053ce9aba8764915087dfe82/src/optimizer_interface.jl#L1056-L1060">source</a></section><section><div><pre><code class="language-julia hljs">get(optimizer::AbstractOptimizer, attr::AbstractOptimizerAttribute)</code></pre><p>Return an attribute <code>attr</code> of the optimizer <code>optimizer</code>.</p><pre><code class="language-julia hljs">get(model::ModelLike, attr::AbstractModelAttribute)</code></pre><p>Return an attribute <code>attr</code> of the model <code>model</code>.</p><pre><code class="language-julia hljs">get(model::ModelLike, attr::AbstractVariableAttribute, v::VariableIndex)</code></pre><p>If the attribute <code>attr</code> is set for the variable <code>v</code> in the model <code>model</code>, return its value, return <code>nothing</code> otherwise. If the attribute <code>attr</code> is not supported by <code>model</code> then an error should be thrown instead of returning <code>nothing</code>.</p><pre><code class="language-julia hljs">get(model::ModelLike, attr::AbstractVariableAttribute, v::Vector{VariableIndex})</code></pre><p>Return a vector of attributes corresponding to each variable in the collection <code>v</code> in the model <code>model</code>.</p><pre><code class="language-julia hljs">get(model::ModelLike, attr::AbstractConstraintAttribute, c::ConstraintIndex)</code></pre><p>If the attribute <code>attr</code> is set for the constraint <code>c</code> in the model <code>model</code>, return its value, return <code>nothing</code> otherwise. If the attribute <code>attr</code> is not supported by <code>model</code> then an error should be thrown instead of returning <code>nothing</code>.</p><pre><code class="language-julia hljs">get(
)</code></pre><p>Return the value of the attribute <code>attr</code> of the model <code>model</code> for the constraint bridged by <code>bridge</code>.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/jump-dev/MathOptInterface.jl/blob/v1.34.0/src/Bridges/bridge.jl#L133-L142">source</a></section><section><div><pre><code class="language-julia hljs">get(model::GenericModel, attr::MathOptInterface.AbstractOptimizerAttribute)</code></pre><p>Return the value of the attribute <code>attr</code> from the model&#39;s MOI backend.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/jump-dev/JuMP.jl/blob/63959f8dd93a006b211f72f1ffc3f207fbb5f107/src/optimizer_interface.jl#L987-L991">source</a></section><section><div><pre><code class="language-julia hljs">get(model::GenericModel, attr::MathOptInterface.AbstractModelAttribute)</code></pre><p>Return the value of the attribute <code>attr</code> from the model&#39;s MOI backend.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/jump-dev/JuMP.jl/blob/63959f8dd93a006b211f72f1ffc3f207fbb5f107/src/optimizer_interface.jl#L1056-L1060">source</a></section><section><div><pre><code class="language-julia hljs">get(optimizer::AbstractOptimizer, attr::AbstractOptimizerAttribute)</code></pre><p>Return an attribute <code>attr</code> of the optimizer <code>optimizer</code>.</p><pre><code class="language-julia hljs">get(model::ModelLike, attr::AbstractModelAttribute)</code></pre><p>Return an attribute <code>attr</code> of the model <code>model</code>.</p><pre><code class="language-julia hljs">get(model::ModelLike, attr::AbstractVariableAttribute, v::VariableIndex)</code></pre><p>If the attribute <code>attr</code> is set for the variable <code>v</code> in the model <code>model</code>, return its value, return <code>nothing</code> otherwise. If the attribute <code>attr</code> is not supported by <code>model</code> then an error should be thrown instead of returning <code>nothing</code>.</p><pre><code class="language-julia hljs">get(model::ModelLike, attr::AbstractVariableAttribute, v::Vector{VariableIndex})</code></pre><p>Return a vector of attributes corresponding to each variable in the collection <code>v</code> in the model <code>model</code>.</p><pre><code class="language-julia hljs">get(model::ModelLike, attr::AbstractConstraintAttribute, c::ConstraintIndex)</code></pre><p>If the attribute <code>attr</code> is set for the constraint <code>c</code> in the model <code>model</code>, return its value, return <code>nothing</code> otherwise. If the attribute <code>attr</code> is not supported by <code>model</code> then an error should be thrown instead of returning <code>nothing</code>.</p><pre><code class="language-julia hljs">get(
model::ModelLike,
attr::AbstractConstraintAttribute,
c::Vector{ConstraintIndex{F,S}},
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
Dual objective value : NaN

* Work counters
Solve time (sec) : 1.51134e-03
Solve time (sec) : 1.97172e-03
Simplex iterations : 15
Barrier iterations : -1
Node count : 1
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@
Dual objective value : NaN

* Work counters
Solve time (sec) : 5.05371e+00
Simplex iterations : 20697
Solve time (sec) : 5.04854e+00
Simplex iterations : 20481
Barrier iterations : -1
Node count : 0
</code></pre><p>However, there is a formulation that solves much faster, and that is to use a column generation scheme.</p><h2 id="Column-generation-theory"><a class="docs-heading-anchor" href="#Column-generation-theory">Column generation theory</a><a id="Column-generation-theory-1"></a><a class="docs-heading-anchor-permalink" href="#Column-generation-theory" title="Permalink"></a></h2><p>The key insight for column generation is to recognize that feasible columns in the <span>$x$</span> matrix of variables encode <em>cutting patterns</em>.</p><p>For example, if we look only at the roll <span>$j=1$</span>, then a feasible solution is:</p><ul><li><span>$x_{1,1} = 1$</span> (1 unit of piece #1)</li><li><span>$x_{13,1} = 1$</span> (1 unit of piece #13)</li><li>All other <span>$x_{i,1} = 0$</span></li></ul><p>Another solution is</p><ul><li><span>$x_{20,1} = 19$</span> (19 unit of piece #20)</li><li>All other <span>$x_{i,1} = 0$</span></li></ul><p>Cutting patterns like <span>$x_{1,1} = 1$</span> and <span>$x_{2,1} = 1$</span> are infeasible because the combined length is greater than <span>$W$</span>.</p><p>Since there are a finite number of ways that we could cut a roll into a valid cutting pattern, we could create a set of all possible cutting patterns <span>$p = 1,\ldots,P$</span>, with data <span>$a_{i,p}$</span> indicating how many units of piece <span>$i$</span> we cut in pattern <span>$p$</span>. Then, we can formulate our mixed-integer linear program as:</p><p class="math-container">\[\begin{align}
Expand Down Expand Up @@ -189,7 +189,7 @@
return plot
end

plot_patterns(data, patterns)</code></pre><img src="ceb79ef1.svg" alt="Example block output"/><h2 id="The-base-problem"><a class="docs-heading-anchor" href="#The-base-problem">The base problem</a><a id="The-base-problem-1"></a><a class="docs-heading-anchor-permalink" href="#The-base-problem" title="Permalink"></a></h2><p>Using the initial set of patterns, we can create and optimize our base model:</p><pre><code class="language-julia hljs">model = Model(HiGHS.Optimizer)
plot_patterns(data, patterns)</code></pre><img src="cac66ad5.svg" alt="Example block output"/><h2 id="The-base-problem"><a class="docs-heading-anchor" href="#The-base-problem">The base problem</a><a id="The-base-problem-1"></a><a class="docs-heading-anchor-permalink" href="#The-base-problem" title="Permalink"></a></h2><p>Using the initial set of patterns, we can create and optimize our base model:</p><pre><code class="language-julia hljs">model = Model(HiGHS.Optimizer)
set_silent(model)
@variable(model, x[1:length(patterns)] &gt;= 0, Int)
@objective(model, Min, sum(x))
Expand All @@ -213,7 +213,7 @@
Dual objective value : NaN

* Work counters
Solve time (sec) : 1.46389e-04
Solve time (sec) : 1.51396e-04
Simplex iterations : 0
Barrier iterations : -1
Node count : 0
Expand Down Expand Up @@ -285,7 +285,7 @@
<span class="sgr36"><span class="sgr1">[ Info: </span></span>No new patterns, terminating the algorithm.</code></pre><p>We found lots of new patterns. Here&#39;s pattern 21:</p><pre><code class="language-julia hljs">patterns[21]</code></pre><pre class="documenter-example-output"><code class="nohighlight hljs ansi">20-element SparseArrays.SparseVector{Int64, Int64} with 3 stored entries:
[9 ] = 1
[13] = 2
[17] = 1</code></pre><p>Let&#39;s have a look at the patterns now:</p><pre><code class="language-julia hljs">plot_patterns(data, patterns)</code></pre><img src="4090efe1.svg" alt="Example block output"/><h2 id="Looking-at-the-solution"><a class="docs-heading-anchor" href="#Looking-at-the-solution">Looking at the solution</a><a id="Looking-at-the-solution-1"></a><a class="docs-heading-anchor-permalink" href="#Looking-at-the-solution" title="Permalink"></a></h2><p>Let&#39;s see how many of each column we need:</p><pre><code class="language-julia hljs">solution = DataFrames.DataFrame([
[17] = 1</code></pre><p>Let&#39;s have a look at the patterns now:</p><pre><code class="language-julia hljs">plot_patterns(data, patterns)</code></pre><img src="de7f340e.svg" alt="Example block output"/><h2 id="Looking-at-the-solution"><a class="docs-heading-anchor" href="#Looking-at-the-solution">Looking at the solution</a><a id="Looking-at-the-solution-1"></a><a class="docs-heading-anchor-permalink" href="#Looking-at-the-solution" title="Permalink"></a></h2><p>Let&#39;s see how many of each column we need:</p><pre><code class="language-julia hljs">solution = DataFrames.DataFrame([
(pattern = p, rolls = value(x_p)) for (p, x_p) in enumerate(x)
])
filter!(row -&gt; row.rolls &gt; 0, solution)</code></pre><div><div style = "float: left;"><span>16×2 DataFrame</span></div><div style = "clear: both;"></div></div><div class = "data-frame" style = "overflow-x: scroll;"><table class = "data-frame" style = "margin-bottom: 6px;"><thead><tr class = "header"><th class = "rowNumber" style = "font-weight: bold; text-align: right;">Row</th><th style = "text-align: left;">pattern</th><th style = "text-align: left;">rolls</th></tr><tr class = "subheader headerLastRow"><th class = "rowNumber" style = "font-weight: bold; text-align: right;"></th><th title = "Int64" style = "text-align: left;">Int64</th><th title = "Float64" style = "text-align: left;">Float64</th></tr></thead><tbody><tr><td class = "rowNumber" style = "font-weight: bold; text-align: right;">1</td><td style = "text-align: right;">1</td><td style = "text-align: right;">38.0</td></tr><tr><td class = "rowNumber" style = "font-weight: bold; text-align: right;">2</td><td style = "text-align: right;">2</td><td style = "text-align: right;">44.0</td></tr><tr><td class = "rowNumber" style = "font-weight: bold; text-align: right;">3</td><td style = "text-align: right;">3</td><td style = "text-align: right;">30.0</td></tr><tr><td class = "rowNumber" style = "font-weight: bold; text-align: right;">4</td><td style = "text-align: right;">21</td><td style = "text-align: right;">0.5</td></tr><tr><td class = "rowNumber" style = "font-weight: bold; text-align: right;">5</td><td style = "text-align: right;">22</td><td style = "text-align: right;">10.2</td></tr><tr><td class = "rowNumber" style = "font-weight: bold; text-align: right;">6</td><td style = "text-align: right;">23</td><td style = "text-align: right;">14.65</td></tr><tr><td class = "rowNumber" style = "font-weight: bold; text-align: right;">7</td><td style = "text-align: right;">24</td><td style = "text-align: right;">23.1</td></tr><tr><td class = "rowNumber" style = "font-weight: bold; text-align: right;">8</td><td style = "text-align: right;">25</td><td style = "text-align: right;">11.25</td></tr><tr><td class = "rowNumber" style = "font-weight: bold; text-align: right;">9</td><td style = "text-align: right;">26</td><td style = "text-align: right;">21.35</td></tr><tr><td class = "rowNumber" style = "font-weight: bold; text-align: right;">10</td><td style = "text-align: right;">28</td><td style = "text-align: right;">4.3</td></tr><tr><td class = "rowNumber" style = "font-weight: bold; text-align: right;">11</td><td style = "text-align: right;">29</td><td style = "text-align: right;">19.55</td></tr><tr><td class = "rowNumber" style = "font-weight: bold; text-align: right;">12</td><td style = "text-align: right;">30</td><td style = "text-align: right;">11.25</td></tr><tr><td class = "rowNumber" style = "font-weight: bold; text-align: right;">13</td><td style = "text-align: right;">31</td><td style = "text-align: right;">17.45</td></tr><tr><td class = "rowNumber" style = "font-weight: bold; text-align: right;">14</td><td style = "text-align: right;">33</td><td style = "text-align: right;">36.0</td></tr><tr><td class = "rowNumber" style = "font-weight: bold; text-align: right;">15</td><td style = "text-align: right;">34</td><td style = "text-align: right;">11.4</td></tr><tr><td class = "rowNumber" style = "font-weight: bold; text-align: right;">16</td><td style = "text-align: right;">35</td><td style = "text-align: right;">41.0</td></tr></tbody></table></div><p>Since we solved a linear program, some of our columns have fractional solutions. We can create a integer feasible solution by rounding up the orders. This requires 341 rolls:</p><pre><code class="language-julia hljs">sum(ceil.(Int, solution.rolls))</code></pre><pre class="documenter-example-output"><code class="nohighlight hljs ansi">341</code></pre><p>Alternatively, we can re-introduce the integrality constraints and resolve the problem:</p><pre><code class="language-julia hljs">set_integer.(x)
Expand Down
6 changes: 3 additions & 3 deletions previews/PR3889/tutorials/algorithms/pdhg/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@
c3 : [-1.93193e-06,2.50002e-01,1.50000e+00]

* Work counters
Solve time (sec) : 2.05041e-01
Solve time (sec) : 2.29210e-01
Barrier iterations : 8365
</code></pre><p>But we could also have written:</p><pre><code class="language-julia hljs">model = Model(Optimizer)
@variable(model, x &gt;= 0)
Expand Down Expand Up @@ -352,7 +352,7 @@
c2 : 1.50000e+00

* Work counters
Solve time (sec) : 1.91402e-03
Solve time (sec) : 2.21205e-03
Barrier iterations : 8365
</code></pre><p>Other variations are also possible:</p><pre><code class="language-julia hljs">model = Model(Optimizer)
@variable(model, x[1:5] &gt;= 0)
Expand Down Expand Up @@ -390,6 +390,6 @@
c4 : multiple constraints with the same name

* Work counters
Solve time (sec) : 1.89614e-03
Solve time (sec) : 1.79887e-03
Barrier iterations : 8365
</code></pre><p>Behind the scenes, JuMP and MathOptInterface reformulate the problem from the modeller&#39;s form into the standard form defined by our <code>Optimizer</code>.</p></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../parallelism/">« Parallelism</a><a class="docs-footer-nextpage" href="../../applications/power_systems/">Power Systems »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="auto">Automatic (OS)</option><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="catppuccin-latte">catppuccin-latte</option><option value="catppuccin-frappe">catppuccin-frappe</option><option value="catppuccin-macchiato">catppuccin-macchiato</option><option value="catppuccin-mocha">catppuccin-mocha</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.7.0 on <span class="colophon-date" title="Friday 22 November 2024 04:06">Friday 22 November 2024</span>. Using Julia version 1.11.1.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
Loading

0 comments on commit bc00e71

Please sign in to comment.