Skip to content

Commit dd96564

Browse files
1 parent 7036638 commit dd96564

39 files changed

+290
-154
lines changed

bazel.html

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -345,26 +345,30 @@ <h1 id="proprietary-solvers">Proprietary Solvers</h1>
345345
<p>The Drake Bazel build currently supports the following proprietary solvers:</p>
346346

347347
<ul>
348-
<li>Gurobi 10.0</li>
348+
<li>Gurobi 12.0</li>
349349
<li>MOSEK<a href="/tm.html"></a> 10.0</li>
350350
<li>SNOPT 7.4</li>
351351
</ul>
352352

353-
<h2 id="gurobi-100">Gurobi 10.0</h2>
353+
<h2 id="gurobi-120">Gurobi 12.0</h2>
354354

355355
<h3 id="install-on-ubuntu">Install on Ubuntu</h3>
356356

357357
<ol>
358358
<li>Register for an account on <a href="https://www.gurobi.com">https://www.gurobi.com</a>.</li>
359359
<li>Set up your Gurobi license file in accordance with Gurobi documentation.</li>
360360
<li><code class="language-plaintext highlighter-rouge">export GRB_LICENSE_FILE=/path/to/gurobi.lic</code>.</li>
361-
<li>Download <code class="language-plaintext highlighter-rouge">gurobi10.0.2_linux64.tar.gz</code>. You may need to manually edit the URL to get the correct version.</li>
362-
<li>Unzip it. We suggest that you use <code class="language-plaintext highlighter-rouge">/opt/gurobi1002</code> to simplify working with Drake installations.</li>
363-
<li>If you unzipped into a location other than <code class="language-plaintext highlighter-rouge">/opt/gurobi1002</code>, then call <code class="language-plaintext highlighter-rouge">export GUROBI_HOME=GUROBI_UNZIP_PATH/linux64</code> to set the path you used, where in <code class="language-plaintext highlighter-rouge">GUROBI_HOME</code> folder you can find <code class="language-plaintext highlighter-rouge">bin</code> folder.</li>
361+
<li>Download <code class="language-plaintext highlighter-rouge">gurobi12.0.3_linux64.tar.gz</code>. You may need to manually edit the
362+
URL to get the correct version.</li>
363+
<li>Unzip it. We suggest that you use <code class="language-plaintext highlighter-rouge">/opt/gurobi1203</code> to simplify working
364+
with Drake installations.</li>
365+
<li>If you unzipped into a location other than <code class="language-plaintext highlighter-rouge">/opt/gurobi1203</code>, then call
366+
<code class="language-plaintext highlighter-rouge">export GUROBI_HOME=GUROBI_UNZIP_PATH/linux64</code> to set the path you used,
367+
where in <code class="language-plaintext highlighter-rouge">GUROBI_HOME</code> folder you can find <code class="language-plaintext highlighter-rouge">bin</code> folder.</li>
364368
</ol>
365369

366-
<p>Drake supports any patch version of Gurobi 10.0. At time of writing, the most
367-
recent available version was 10.0.2; if using a newer patch version, the paths
370+
<p>Drake supports any patch version of Gurobi 12.0. At time of writing, the most
371+
recent available version was 12.0.3; if using a newer patch version, the paths
368372
and file names above should be adjusted accordingly.</p>
369373

370374
<h3 id="install-on-macos">Install on macOS</h3>
@@ -373,7 +377,7 @@ <h3 id="install-on-macos">Install on macOS</h3>
373377
<li>Register for an account on <a href="http://www.gurobi.com">http://www.gurobi.com</a>.</li>
374378
<li>Set up your Gurobi license file in accordance with Gurobi documentation.</li>
375379
<li><code class="language-plaintext highlighter-rouge">export GRB_LICENSE_FILE=/path/to/gurobi.lic</code></li>
376-
<li>Download and install <code class="language-plaintext highlighter-rouge">gurobi10.0.2_mac64.pkg</code>.</li>
380+
<li>Download and install <code class="language-plaintext highlighter-rouge">gurobi12.0.3_mac64.pkg</code>.</li>
377381
</ol>
378382

379383
<p>To confirm that your setup was successful, run the tests that require Gurobi:</p>

doxygen_cxx/classdrake_1_1solvers_1_1_gurobi_solver.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,9 @@
172172
<div class="textblock"><p>An implementation of <a class="el" href="classdrake_1_1solvers_1_1_solver_interface.html" title="Interface used by implementations of individual solvers.">SolverInterface</a> for the commercially-licensed Gurobi solver (<a href="https://www.gurobi.com/">https://www.gurobi.com/</a>). </p>
173173
<p>The default build of Drake is not configured to use Gurobi, so therefore <a class="el" href="classdrake_1_1solvers_1_1_solver_interface.html#a1e8fcd942e045810b3847510fd0528fa" title="Returns true iff support for this solver has been compiled into Drake.">SolverInterface::available()</a> will return false. You must compile Drake from source in order to link against Gurobi. For details, refer to the documentation at <a href="https://drake.mit.edu/bazel.html#proprietary-solvers">https://drake.mit.edu/bazel.html#proprietary-solvers</a>.</p>
174174
<p>The GRB_LICENSE_FILE environment variable controls whether or not <a class="el" href="classdrake_1_1solvers_1_1_solver_interface.html#ac90e60f81a12700b6f94e534d625ba25" title="Returns true iff this solver is properly configured for use at runtime.">SolverInterface::enabled()</a> returns true. If it is set to any non-empty value, then the solver is enabled; otherwise, the solver is not enabled.</p>
175-
<p>Gurobi solver supports options/parameters listed in <a href="https://www.gurobi.com/documentation/10.0/refman/parameters.html">https://www.gurobi.com/documentation/10.0/refman/parameters.html</a>. On top of these options, we provide the following additional options</p><ol type="1">
176-
<li>"GRBwrite", set to a file name so that Gurobi solver will write the optimization model to this file, check <a href="https://www.gurobi.com/documentation/10.0/refman/py_model_write.html">https://www.gurobi.com/documentation/10.0/refman/py_model_write.html</a> for more details, such as all supported file extensions. Set this option to "" if you don't want to write to file. Default is not to write to a file.</li>
177-
<li>"GRBcomputeIIS", set to 1 to compute an Irreducible Inconsistent Subsystem (IIS) when the problem is infeasible. Refer to <a href="https://www.gurobi.com/documentation/10.0/refman/py_model_computeiis.html">https://www.gurobi.com/documentation/10.0/refman/py_model_computeiis.html</a> for more details. Often this method is called together with setting GRBwrite to "FILENAME.ilp" to write IIS to a file with extension "ilp". Default is not to compute IIS.</li>
175+
<p>Gurobi solver supports options/parameters listed in <a href="https://docs.gurobi.com/projects/optimizer/en/12.0/concepts/parameters.html">https://docs.gurobi.com/projects/optimizer/en/12.0/concepts/parameters.html</a>. On top of these options, we provide the following additional options</p><ol type="1">
176+
<li>"GRBwrite", set to a file name so that Gurobi solver will write the optimization model to this file, check <a href="https://www.docs.gurobi.com/projects/optimizer/en/12.0/reference/python/model.html#Write">https://www.docs.gurobi.com/projects/optimizer/en/12.0/reference/python/model.html#Write</a> for more details, such as all supported file extensions. Set this option to "" if you don't want to write to file. Default is not to write to a file.</li>
177+
<li>"GRBcomputeIIS", set to 1 to compute an Irreducible Inconsistent Subsystem (IIS) when the problem is infeasible. Refer to <a href="https://docs.gurobi.com/projects/optimizer/en/12.0/reference/python/model.html#Model.computeIIS">https://docs.gurobi.com/projects/optimizer/en/12.0/reference/python/model.html#Model.computeIIS</a> for more details. Often this method is called together with setting GRBwrite to "FILENAME.ilp" to write IIS to a file with extension "ilp". Default is not to compute IIS.</li>
178178
</ol>
179179
<p><a class="el" href="classdrake_1_1solvers_1_1_gurobi_solver.html" title="An implementation of SolverInterface for the commercially-licensed Gurobi solver (https://www....">GurobiSolver</a> supports parallelization during <a class="el" href="classdrake_1_1solvers_1_1_solver_base.html#a00b55f8b4c1c4f19b45621a84deed66c" title="Like SolverInterface::Solve(), but the result is a return value instead of an output argument.">Solve()</a>. If both the "Threads" integer solver option and <a class="el" href="namespacedrake_1_1solvers.html#ae07229124cd16e9d8b62fe359c7d0b40af1d12898262fdbf42df381627646ee00" title="Some solvers are multi-threaded.">CommonSolverOption::kMaxThreads</a> have been set by the user, then the value in "Threads" will be used as the number of threads.</p>
180180
<p>If neither the "Threads" integer solver option nor <a class="el" href="namespacedrake_1_1solvers.html#ae07229124cd16e9d8b62fe359c7d0b40af1d12898262fdbf42df381627646ee00" title="Some solvers are multi-threaded.">CommonSolverOption::kMaxThreads</a> has been set by the user, then GurobiSolver uses the environment variable GUROBI_NUM_THREADS (if set) as a default value for "Threads".</p>
@@ -331,7 +331,7 @@ <h2 class="memtitle"><span class="permalink"><a href="#a060a36d3c72cd6fd5caceff2
331331
</div><div class="memdoc">
332332

333333
<p>Users can supply a callback to be called when the Gurobi solver finds an intermediate solution node, which may not be feasible. </p>
334-
<p>See Gurobi reference manual for more detail on callbacks: <a href="https://www.gurobi.com/documentation/current/refman/cb_codes.html">https://www.gurobi.com/documentation/current/refman/cb_codes.html</a> The user may supply a partial solution in the VectorXd and VectorXDecisionVariable arguments that will be passed to Gurobi as a candidate feasible solution. See gurobi_solver_test.cc for an example of using std::bind to create a callback of this signature, while allowing additional data to be passed through. </p><dl class="params"><dt>Parameters</dt><dd>
334+
<p>See Gurobi reference manual for more detail on callbacks: <a href="https://docs.gurobi.com/projects/optimizer/en/12.0/reference/numericcodes/callbacks.html">https://docs.gurobi.com/projects/optimizer/en/12.0/reference/numericcodes/callbacks.html</a> The user may supply a partial solution in the VectorXd and VectorXDecisionVariable arguments that will be passed to Gurobi as a candidate feasible solution. See gurobi_solver_test.cc for an example of using std::bind to create a callback of this signature, while allowing additional data to be passed through. </p><dl class="params"><dt>Parameters</dt><dd>
335335
<table class="params">
336336
<tr><td class="paramname">MathematicalProgram&amp;</td><td>The optimization wrapper, whose current variable values (accessible via MathematicalProgram::GetSolution) will be set to the intermediate solution values. </td></tr>
337337
<tr><td class="paramname">SolveStatusInfo&amp;</td><td>Intermediate solution status information values queried from Gurobi. </td></tr>
@@ -356,7 +356,7 @@ <h2 class="memtitle"><span class="permalink"><a href="#a8829ecdc721932e0108b16be
356356
</div><div class="memdoc">
357357

358358
<p>Users can supply a callback to be called when the Gurobi solver finds a feasible solution. </p>
359-
<p>See Gurobi reference manual for more detail on callbacks: <a href="https://www.gurobi.com/documentation/current/refman/cb_codes.html">https://www.gurobi.com/documentation/current/refman/cb_codes.html</a> See gurobi_solver_test.cc for an example of using std::bind to create a callback of this signature, while allowing additional data to be passed through. </p><dl class="params"><dt>Parameters</dt><dd>
359+
<p>See Gurobi reference manual for more detail on callbacks: <a href="https://docs.gurobi.com/projects/optimizer/en/12.0/reference/numericcodes/callbacks.html">https://docs.gurobi.com/projects/optimizer/en/12.0/reference/numericcodes/callbacks.html</a> See gurobi_solver_test.cc for an example of using std::bind to create a callback of this signature, while allowing additional data to be passed through. </p><dl class="params"><dt>Parameters</dt><dd>
360360
<table class="params">
361361
<tr><td class="paramname">MathematicalProgram&amp;</td><td>The optimization wrapper, whose current variable values (accessible via MathematicalProgram::GetSolution) will be set to the intermediate solution values. </td></tr>
362362
<tr><td class="paramname">SolveStatusInfo&amp;</td><td>Intermediate solution status information values queried from Gurobi. </td></tr>

doxygen_cxx/classdrake_1_1solvers_1_1_mathematical_program_result.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,7 @@ <h2 class="memtitle"><span class="permalink"><a href="#a83ded6cdb6fee1487b660f06
618618
<p>For a linear inequality constraint lower &lt;= A*x &lt;= upper where lower and upper ∈ ℝⁿ, dual_solution also has n rows. dual_solution(i) is the value of the dual variable for constraint lower(i) &lt;= A(i,:)*x &lt;= upper(i). If neither side of the constraint is active, then dual_solution(i) is 0. If the left hand-side lower(i) &lt;= A(i, :)*x is active (meaning lower(i) = A(i, :)*x at the solution), then dual_solution(i) is non-negative (because the objective is to minimize a cost, increasing the lower bound means the constraint set is tighter, hence the optimal solution cannot decrease. Thus the shadow price is non-negative). If the right hand-side A(i, :)*x&lt;=upper(i) is active (meaning A(i,:)*x=upper(i) at the solution), then dual_solution(i) is non-positive.</p>
619619
<p>For a bounding box constraint lower &lt;= x &lt;= upper, the interpretation of the dual solution is the same as the linear inequality constraint.</p>
620620
<p>For a Lorentz cone or rotated Lorentz cone constraint that Ax + b is in the cone, depending on the solver, the dual solution has different meanings:</p><ol type="1">
621-
<li>If the solver is Gurobi, then the user can only obtain the dual solution by explicitly setting the options for computing dual solution. <div class="fragment"><div class="line"><span class="keyword">auto</span> constraint = prog.AddLorentzConeConstraint(...);</div><div class="line">GurobiSolver solver;</div><div class="line"><span class="comment">// Explicitly tell the solver to compute the dual solution for Lorentz</span></div><div class="line"><span class="comment">// cone or rotated Lorentz cone constraint, check</span></div><div class="line"><span class="comment">// https://www.gurobi.com/documentation/10.1/refman/qcpdual.html for</span></div><div class="line"><span class="comment">// more information.</span></div><div class="line">SolverOptions options;</div><div class="line">options.SetOption(<a class="code" href="classdrake_1_1solvers_1_1_gurobi_solver.html#a4dc451b7db72a168d9f0da1746011b45">GurobiSolver::id</a>(), <span class="stringliteral">&quot;QCPDual&quot;</span>, 1);</div><div class="line"><a class="code" href="classdrake_1_1solvers_1_1_mathematical_program_result.html#a4fd3b5095ed206da42f1451c5dd426c5">MathematicalProgramResult</a> result = solver.Solve(prog, {}, options);</div><div class="line">Eigen::VectorXd dual_solution = result.GetDualSolution(constraint);</div></div><!-- fragment --> The dual solution has size 1, dual_solution(0) is the shadow price for the constraint z₁² + ... +zₙ² ≤ z₀² for Lorentz cone constraint, and the shadow price for the constraint z₂² + ... +zₙ² ≤ z₀z₁ for rotated Lorentz cone constraint, where z is the slack variable representing z = A*x+b and z in the Lorentz cone/rotated Lorentz cone.</li>
621+
<li>If the solver is Gurobi, then the user can only obtain the dual solution by explicitly setting the options for computing dual solution. <div class="fragment"><div class="line"> <span class="keyword">auto</span> constraint = prog.AddLorentzConeConstraint(...);</div><div class="line"> GurobiSolver solver;</div><div class="line"> <span class="comment">// Explicitly tell the solver to compute the dual solution for Lorentz</span></div><div class="line"> <span class="comment">// cone or rotated Lorentz cone constraint, check</span></div><div class="line"> <span class="comment">//</span></div><div class="line">https:<span class="comment">//docs.gurobi.com/projects/optimizer/en/12.0/reference/parameters.html#qcpdual</span></div><div class="line"> <span class="comment">// for more information.</span></div><div class="line"> SolverOptions options;</div><div class="line"> options.SetOption(<a class="code" href="classdrake_1_1solvers_1_1_gurobi_solver.html#a4dc451b7db72a168d9f0da1746011b45">GurobiSolver::id</a>(), <span class="stringliteral">&quot;QCPDual&quot;</span>, 1);</div><div class="line"> <a class="code" href="classdrake_1_1solvers_1_1_mathematical_program_result.html#a4fd3b5095ed206da42f1451c5dd426c5">MathematicalProgramResult</a> result = solver.Solve(prog, {}, options);</div><div class="line"> Eigen::VectorXd dual_solution = result.GetDualSolution(constraint);</div></div><!-- fragment --> The dual solution has size 1, dual_solution(0) is the shadow price for the constraint z₁² + ... +zₙ² ≤ z₀² for Lorentz cone constraint, and the shadow price for the constraint z₂² + ... +zₙ² ≤ z₀z₁ for rotated Lorentz cone constraint, where z is the slack variable representing z = A*x+b and z in the Lorentz cone/rotated Lorentz cone.</li>
622622
<li>For nonlinear solvers like IPOPT, the dual solution for Lorentz cone constraint (with EvalType::kConvex) is the shadow price for z₀ - sqrt(z₁² + ... +zₙ²) ≥ 0, where z = Ax+b.</li>
623623
<li>For other convex conic solver such as SCS, MOSEK<a href="/tm.html"></a>, CSDP, etc, the dual solution to the (rotated) Lorentz cone constraint doesn't have the "shadow price" interpretation, but should lie in the dual cone, and satisfy the KKT condition. For more information, refer to <a href="https://docs.mosek.com/11.0/capi/prob-def-conic.html#duality-for-conic-optimization">https://docs.mosek.com/11.0/capi/prob-def-conic.html#duality-for-conic-optimization</a> as an explanation.</li>
624624
</ol>

0 commit comments

Comments
 (0)