Skip to content

Commit b9afb6d

Browse files
committed
Deploying to gh-pages from @ 41513cc 🚀
1 parent 323b80b commit b9afb6d

15 files changed

+122
-78
lines changed

_sources/changelog.md.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changelog
22

3+
## 0.4.1
4+
- Support writing solution files in HiGHS
5+
- Pass the names of variables and constraints to HiGHS
6+
- Add `model.close()` and `env.close()` methods to allow users release the license of commercial solvers manually
7+
38
## 0.4.0
49
- Add `model.add_m_variables` and `model.add_m_linear_constraints` matrix modeling API
510
- Add `model.computeIIS` and IIS related attributes for constraint and variable

_sources/gurobi.md.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,18 @@ env.start()
2929
model = gurobi.Model(env)
3030
```
3131

32+
For users who want to release the license immediately after the optimization, you can call the `close` method of all models created and the `gurobi.Env` object. It applies to other commercial solvers supported as well.
33+
34+
```python
35+
env = gurobi.Env()
36+
model = gurobi.Model(env)
37+
38+
# do something with the model
39+
40+
model.close()
41+
env.close()
42+
```
43+
3244
## The capability of `gurobi.Model`
3345

3446
### Supported constraints

changelog.html

Lines changed: 47 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,15 @@
286286
<section class="tex2jax_ignore mathjax_ignore" id="changelog">
287287
<h1>Changelog<a class="headerlink" href="#changelog" title="Link to this heading"></a></h1>
288288
<section id="id1">
289-
<h2>0.4.0<a class="headerlink" href="#id1" title="Link to this heading"></a></h2>
289+
<h2>0.4.1<a class="headerlink" href="#id1" title="Link to this heading"></a></h2>
290+
<ul class="simple">
291+
<li><p>Support writing solution files in HiGHS</p></li>
292+
<li><p>Pass the names of variables and constraints to HiGHS</p></li>
293+
<li><p>Add <code class="docutils literal notranslate"><span class="pre">model.close()</span></code> and <code class="docutils literal notranslate"><span class="pre">env.close()</span></code> methods to allow users release the license of commercial solvers manually</p></li>
294+
</ul>
295+
</section>
296+
<section id="id2">
297+
<h2>0.4.0<a class="headerlink" href="#id2" title="Link to this heading"></a></h2>
290298
<ul class="simple">
291299
<li><p>Add <code class="docutils literal notranslate"><span class="pre">model.add_m_variables</span></code> and <code class="docutils literal notranslate"><span class="pre">model.add_m_linear_constraints</span></code> matrix modeling API</p></li>
292300
<li><p>Add <code class="docutils literal notranslate"><span class="pre">model.computeIIS</span></code> and IIS related attributes for constraint and variable</p></li>
@@ -296,82 +304,82 @@ <h2>0.4.0<a class="headerlink" href="#id1" title="Link to this heading">¶</a></
296304
<li><p>Supports HiGHS 1.9.0 and Mosek 11</p></li>
297305
</ul>
298306
</section>
299-
<section id="id2">
300-
<h2>0.3.0<a class="headerlink" href="#id2" title="Link to this heading"></a></h2>
307+
<section id="id3">
308+
<h2>0.3.0<a class="headerlink" href="#id3" title="Link to this heading"></a></h2>
301309
<ul class="simple">
302310
<li><p>Add <code class="docutils literal notranslate"><span class="pre">model.set_variable_bounds(variable,</span> <span class="pre">lb,</span> <span class="pre">ub)</span></code> to make it easier to change variable bounds</p></li>
303311
<li><p>Introduce nonlinear programming support of Ipopt</p></li>
304312
<li><p>Support new versions of optimizers</p></li>
305313
<li><p>Various minor bug fixes</p></li>
306314
</ul>
307315
</section>
308-
<section id="id3">
309-
<h2>0.2.8<a class="headerlink" href="#id3" title="Link to this heading"></a></h2>
316+
<section id="id4">
317+
<h2>0.2.8<a class="headerlink" href="#id4" title="Link to this heading"></a></h2>
310318
<ul class="simple">
311319
<li><p>Fix bugs in HiGHS and MOSEK when the quadratic objective function contains nondiagonal terms</p></li>
312320
</ul>
313321
</section>
314-
<section id="id4">
315-
<h2>0.2.7<a class="headerlink" href="#id4" title="Link to this heading"></a></h2>
322+
<section id="id5">
323+
<h2>0.2.7<a class="headerlink" href="#id5" title="Link to this heading"></a></h2>
316324
<ul class="simple">
317325
<li><p>Fix bugs in HiGHS termination status</p></li>
318326
</ul>
319327
</section>
320-
<section id="id5">
321-
<h2>0.2.6<a class="headerlink" href="#id5" title="Link to this heading"></a></h2>
328+
<section id="id6">
329+
<h2>0.2.6<a class="headerlink" href="#id6" title="Link to this heading"></a></h2>
322330
<ul class="simple">
323331
<li><p>Add rotated second-order cone support for COPT, Gurobi and Mosek</p></li>
324332
<li><p>Add exponential cone support for COPT and Mosek</p></li>
325333
<li><p>Requires COPT version &gt;= 7.1.4 to support exponential cone</p></li>
326334
</ul>
327335
</section>
328-
<section id="id6">
329-
<h2>0.2.5<a class="headerlink" href="#id6" title="Link to this heading"></a></h2>
336+
<section id="id7">
337+
<h2>0.2.5<a class="headerlink" href="#id7" title="Link to this heading"></a></h2>
330338
<ul class="simple">
331339
<li><p>Fix <code class="docutils literal notranslate"><span class="pre">add_linear_constraint</span></code> of HiGHS optimizer to consider the constant term in expression correctly</p></li>
332340
<li><p>Make <code class="docutils literal notranslate"><span class="pre">make_tupledict</span></code> slightly faster</p></li>
333341
</ul>
334342
</section>
335-
<section id="id7">
336-
<h2>0.2.4<a class="headerlink" href="#id7" title="Link to this heading"></a></h2>
343+
<section id="id8">
344+
<h2>0.2.4<a class="headerlink" href="#id8" title="Link to this heading"></a></h2>
337345
<ul class="simple">
338346
<li><p>Add <code class="docutils literal notranslate"><span class="pre">map</span></code> method for <code class="docutils literal notranslate"><span class="pre">tupledict</span></code> class</p></li>
339347
<li><p>Add type stubs for C++ extension modules</p></li>
340348
</ul>
341349
</section>
342-
<section id="id8">
343-
<h2>0.2.3<a class="headerlink" href="#id8" title="Link to this heading"></a></h2>
350+
<section id="id9">
351+
<h2>0.2.3<a class="headerlink" href="#id9" title="Link to this heading"></a></h2>
344352
<ul class="simple">
345353
<li><p>Fix a bug when deleting constraint in HiGHS</p></li>
346354
</ul>
347355
</section>
348-
<section id="id9">
349-
<h2>0.2.2<a class="headerlink" href="#id9" title="Link to this heading"></a></h2>
356+
<section id="id10">
357+
<h2>0.2.2<a class="headerlink" href="#id10" title="Link to this heading"></a></h2>
350358
<ul class="simple">
351359
<li><p>Fix the performance issue with HiGHS optimizer</p></li>
352360
</ul>
353361
</section>
354-
<section id="id10">
355-
<h2>0.2.1<a class="headerlink" href="#id10" title="Link to this heading"></a></h2>
362+
<section id="id11">
363+
<h2>0.2.1<a class="headerlink" href="#id11" title="Link to this heading"></a></h2>
356364
<ul class="simple">
357365
<li><p>Fix the DLL search paths on Windows</p></li>
358366
</ul>
359367
</section>
360-
<section id="id11">
361-
<h2>0.2.0<a class="headerlink" href="#id11" title="Link to this heading"></a></h2>
368+
<section id="id12">
369+
<h2>0.2.0<a class="headerlink" href="#id12" title="Link to this heading"></a></h2>
362370
<ul class="simple">
363371
<li><p>Supports callback for Gurobi and COPT</p></li>
364372
<li><p>Release GIL when calling <code class="docutils literal notranslate"><span class="pre">model.optimize()</span></code></p></li>
365373
</ul>
366374
</section>
367-
<section id="id12">
368-
<h2>0.1.1<a class="headerlink" href="#id12" title="Link to this heading"></a></h2>
375+
<section id="id13">
376+
<h2>0.1.1<a class="headerlink" href="#id13" title="Link to this heading"></a></h2>
369377
<ul class="simple">
370378
<li><p>Add <code class="docutils literal notranslate"><span class="pre">Model.write</span></code> method to write model to files</p></li>
371379
</ul>
372380
</section>
373-
<section id="id13">
374-
<h2>0.1.0<a class="headerlink" href="#id13" title="Link to this heading"></a></h2>
381+
<section id="id14">
382+
<h2>0.1.0<a class="headerlink" href="#id14" title="Link to this heading"></a></h2>
375383
<ul class="simple">
376384
<li><p>First release on PyPI</p></li>
377385
</ul>
@@ -434,19 +442,20 @@ <h2>0.1.0<a class="headerlink" href="#id13" title="Link to this heading">¶</a><
434442
<div class="toc-tree">
435443
<ul>
436444
<li><a class="reference internal" href="#">Changelog</a><ul>
437-
<li><a class="reference internal" href="#id1">0.4.0</a></li>
438-
<li><a class="reference internal" href="#id2">0.3.0</a></li>
439-
<li><a class="reference internal" href="#id3">0.2.8</a></li>
440-
<li><a class="reference internal" href="#id4">0.2.7</a></li>
441-
<li><a class="reference internal" href="#id5">0.2.6</a></li>
442-
<li><a class="reference internal" href="#id6">0.2.5</a></li>
443-
<li><a class="reference internal" href="#id7">0.2.4</a></li>
444-
<li><a class="reference internal" href="#id8">0.2.3</a></li>
445-
<li><a class="reference internal" href="#id9">0.2.2</a></li>
446-
<li><a class="reference internal" href="#id10">0.2.1</a></li>
447-
<li><a class="reference internal" href="#id11">0.2.0</a></li>
448-
<li><a class="reference internal" href="#id12">0.1.1</a></li>
449-
<li><a class="reference internal" href="#id13">0.1.0</a></li>
445+
<li><a class="reference internal" href="#id1">0.4.1</a></li>
446+
<li><a class="reference internal" href="#id2">0.4.0</a></li>
447+
<li><a class="reference internal" href="#id3">0.3.0</a></li>
448+
<li><a class="reference internal" href="#id4">0.2.8</a></li>
449+
<li><a class="reference internal" href="#id5">0.2.7</a></li>
450+
<li><a class="reference internal" href="#id6">0.2.6</a></li>
451+
<li><a class="reference internal" href="#id7">0.2.5</a></li>
452+
<li><a class="reference internal" href="#id8">0.2.4</a></li>
453+
<li><a class="reference internal" href="#id9">0.2.3</a></li>
454+
<li><a class="reference internal" href="#id10">0.2.2</a></li>
455+
<li><a class="reference internal" href="#id11">0.2.1</a></li>
456+
<li><a class="reference internal" href="#id12">0.2.0</a></li>
457+
<li><a class="reference internal" href="#id13">0.1.1</a></li>
458+
<li><a class="reference internal" href="#id14">0.1.0</a></li>
450459
</ul>
451460
</li>
452461
</ul>

constraint.html

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -307,12 +307,12 @@ <h1>Constraint<a class="headerlink" href="#constraint" title="Link to this headi
307307
</div>
308308
</div>
309309
<div class="cell_output docutils container">
310-
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>2025-03-19 06:31:05 [INFO] checks license for COPT v7.2.4 20241206
311-
2025-03-19 06:31:05 [WARN] no license files in current working folder: /home/runner/work/PyOptInterface/PyOptInterface/docs/source
312-
2025-03-19 06:31:05 [WARN] no license files in binary folder: /opt/hostedtoolcache/Python/3.12.9/x64/bin
313-
2025-03-19 06:31:05 [WARN] no license files in HOME folder: /home/runner/copt
314-
2025-03-19 06:31:05 [INFO] empty environment variable: COPT_LICENSE_DIR
315-
2025-03-19 06:31:05 [WARN] no license files in EV &#39;COPT_LICENSE_DIR&#39;:
310+
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>2025-03-19 06:46:12 [INFO] checks license for COPT v7.2.4 20241206
311+
2025-03-19 06:46:12 [WARN] no license files in current working folder: /home/runner/work/PyOptInterface/PyOptInterface/docs/source
312+
2025-03-19 06:46:12 [WARN] no license files in binary folder: /opt/hostedtoolcache/Python/3.12.9/x64/bin
313+
2025-03-19 06:46:12 [WARN] no license files in HOME folder: /home/runner/copt
314+
2025-03-19 06:46:12 [INFO] empty environment variable: COPT_LICENSE_DIR
315+
2025-03-19 06:46:12 [WARN] no license files in EV &#39;COPT_LICENSE_DIR&#39;:
316316

317317
No license found. Starting COPT with size limitations for non-commercial use
318318
Please apply for a license from www.shanshu.ai/copt
@@ -624,7 +624,7 @@ <h2>Create constraint with comparison operator<a class="headerlink" href="#creat
624624
</div>
625625
</div>
626626
<div class="cell_output docutils container">
627-
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>&lt;pyoptinterface._src.core_ext.ConstraintIndex at 0x7f192c200690&gt;
627+
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>&lt;pyoptinterface._src.core_ext.ConstraintIndex at 0x7f9fcff10b50&gt;
628628
</pre></div>
629629
</div>
630630
</div>

container.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -499,10 +499,10 @@ <h2>Building a model with <code class="docutils literal notranslate"><span class
499499
300 2.3611112 150 0.01s
500500
360 2.0000001 180 0.01s
501501
Model status : Optimal
502+
QP ASM iterations: 360
502503
</pre></div>
503504
</div>
504-
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>QP ASM iterations: 360
505-
Objective value : 2.0000000000e+00
505+
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Objective value : 2.0000000000e+00
506506
HiGHS run time : 0.01
507507
</pre></div>
508508
</div>

examples/economic_dispatch.html

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -418,13 +418,13 @@ <h2>Implementation<a class="headerlink" href="#implementation" title="Link to th
418418
0 14328.52 0 0.00s
419419
100 12722.021 1 0.00s
420420
108 12684.021 0 0.00s
421+
TerminationStatusCode.OPTIMAL
422+
Objective value: 12684.0
421423
Model status : Optimal
422424
Simplex iterations: 63
423425
QP ASM iterations: 108
424426
Objective value : 1.2684000000e+04
425427
HiGHS run time : 0.00
426-
TerminationStatusCode.OPTIMAL
427-
Objective value: 12684.0
428428
</pre></div>
429429
</div>
430430
</div>
@@ -488,13 +488,9 @@ <h2>Change the load and solve the model again<a class="headerlink" href="#change
488488
RHS [2e+01, 2e+02]
489489
Iteration Objective NullspaceDim
490490
0 15430.248 0 0.00s
491-
100 14091.031 3 0.00s
491+
100 14091.031 3 0.01s
492492
169 13740.237 10 0.01s
493493
Model status : Optimal
494-
Simplex iterations: 86
495-
QP ASM iterations: 169
496-
Objective value : 1.3740213571e+04
497-
HiGHS run time : 0.01
498494
TerminationStatusCode.OPTIMAL
499495
Objective value: 13740.213571429404
500496
[[100. 100. 100. 100. 100.
@@ -514,6 +510,12 @@ <h2>Change the load and solve the model again<a class="headerlink" href="#change
514510
52.85719184 53.28576347 53.7143351 54.14290673]]
515511
</pre></div>
516512
</div>
513+
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Simplex iterations: 86
514+
QP ASM iterations: 169
515+
Objective value : 1.3740213571e+04
516+
HiGHS run time : 0.01
517+
</pre></div>
518+
</div>
517519
</div>
518520
</div>
519521
</section>

examples/optimal_control_rocket.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ <h2>Implementation<a class="headerlink" href="#implementation" title="Link to th
480480
Number of equality constraint Jacobian evaluations = 24
481481
Number of inequality constraint Jacobian evaluations = 0
482482
Number of Lagrangian Hessian evaluations = 23
483-
Total CPU secs in IPOPT (w/o function evaluations) = 0.123
483+
Total CPU secs in IPOPT (w/o function evaluations) = 0.127
484484
Total CPU secs in NLP function evaluations = 0.005
485485

486486
EXIT: Optimal Solution Found.

examples/optimal_power_flow.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,7 @@ <h2>Implementation<a class="headerlink" href="#implementation" title="Link to th
608608
Number of equality constraint Jacobian evaluations = 19
609609
Number of inequality constraint Jacobian evaluations = 19
610610
Number of Lagrangian Hessian evaluations = 18
611-
Total CPU secs in IPOPT (w/o function evaluations) = 0.013
611+
Total CPU secs in IPOPT (w/o function evaluations) = 0.007
612612
Total CPU secs in NLP function evaluations = 0.001
613613

614614
EXIT: Optimal Solution Found.

expression.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -364,8 +364,8 @@ <h2>Efficient expression construction<a class="headerlink" href="#efficient-expr
364364
</div>
365365
</div>
366366
<div class="cell_output docutils container">
367-
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>CPU times: user 0 ns, sys: 708 μs, total: 708 μs
368-
Wall time: 712 μs
367+
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>CPU times: user 729 μs, sys: 0 ns, total: 729 μs
368+
Wall time: 732 μs
369369
</pre></div>
370370
</div>
371371
</div>
@@ -377,8 +377,8 @@ <h2>Efficient expression construction<a class="headerlink" href="#efficient-expr
377377
</div>
378378
</div>
379379
<div class="cell_output docutils container">
380-
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>CPU times: user 20.5 ms, sys: 0 ns, total: 20.5 ms
381-
Wall time: 20.3 ms
380+
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>CPU times: user 20 ms, sys: 0 ns, total: 20 ms
381+
Wall time: 19.9 ms
382382
</pre></div>
383383
</div>
384384
</div>

getting_started.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,9 @@ <h2>Let’s build a simple model and solve it<a class="headerlink" href="#let-s-
562562
Cost [0e+00, 0e+00]
563563
Bound [0e+00, 0e+00]
564564
RHS [1e+00, 1e+00]
565-
Iteration Objective NullspaceDim
565+
</pre></div>
566+
</div>
567+
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span> Iteration Objective NullspaceDim
566568
0 2.0000001 0 0.00s
567569
2 0.66666669 1 0.00s
568570
Model status : Optimal

gurobi.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,16 @@ <h2>Initial setup<a class="headerlink" href="#initial-setup" title="Link to this
308308
<span class="n">model</span> <span class="o">=</span> <span class="n">gurobi</span><span class="o">.</span><span class="n">Model</span><span class="p">(</span><span class="n">env</span><span class="p">)</span>
309309
</pre></div>
310310
</div>
311+
<p>For users who want to release the license immediately after the optimization, you can call the <code class="docutils literal notranslate"><span class="pre">close</span></code> method of all models created and the <code class="docutils literal notranslate"><span class="pre">gurobi.Env</span></code> object. It applies to other commercial solvers supported as well.</p>
312+
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">env</span> <span class="o">=</span> <span class="n">gurobi</span><span class="o">.</span><span class="n">Env</span><span class="p">()</span>
313+
<span class="n">model</span> <span class="o">=</span> <span class="n">gurobi</span><span class="o">.</span><span class="n">Model</span><span class="p">(</span><span class="n">env</span><span class="p">)</span>
314+
315+
<span class="c1"># do something with the model</span>
316+
317+
<span class="n">model</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
318+
<span class="n">env</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
319+
</pre></div>
320+
</div>
311321
</section>
312322
<section id="the-capability-of-gurobi-model">
313323
<h2>The capability of <code class="docutils literal notranslate"><span class="pre">gurobi.Model</span></code><a class="headerlink" href="#the-capability-of-gurobi-model" title="Link to this heading"></a></h2>

0 commit comments

Comments
 (0)