You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<li>Download <codeclass="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 <codeclass="language-plaintext highlighter-rouge">/opt/gurobi1002</code> to simplify working with Drake installations.</li>
363
-
<li>If you unzipped into a location other than <codeclass="language-plaintext highlighter-rouge">/opt/gurobi1002</code>, then call <codeclass="language-plaintext highlighter-rouge">export GUROBI_HOME=GUROBI_UNZIP_PATH/linux64</code> to set the path you used, where in <codeclass="language-plaintext highlighter-rouge">GUROBI_HOME</code> folder you can find <codeclass="language-plaintext highlighter-rouge">bin</code> folder.</li>
361
+
<li>Download <codeclass="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 <codeclass="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 <codeclass="language-plaintext highlighter-rouge">/opt/gurobi1203</code>, then call
366
+
<codeclass="language-plaintext highlighter-rouge">export GUROBI_HOME=GUROBI_UNZIP_PATH/linux64</code> to set the path you used,
367
+
where in <codeclass="language-plaintext highlighter-rouge">GUROBI_HOME</code> folder you can find <codeclass="language-plaintext highlighter-rouge">bin</code> folder.</li>
364
368
</ol>
365
369
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
368
372
and file names above should be adjusted accordingly.</p>
369
373
370
374
<h3id="install-on-macos">Install on macOS</h3>
@@ -373,7 +377,7 @@ <h3 id="install-on-macos">Install on macOS</h3>
373
377
<li>Register for an account on <ahref="http://www.gurobi.com">http://www.gurobi.com</a>.</li>
374
378
<li>Set up your Gurobi license file in accordance with Gurobi documentation.</li>
Copy file name to clipboardExpand all lines: doxygen_cxx/classdrake_1_1solvers_1_1_gurobi_solver.html
+5-5Lines changed: 5 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -172,9 +172,9 @@
172
172
<divclass="textblock"><p>An implementation of <aclass="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 (<ahref="https://www.gurobi.com/">https://www.gurobi.com/</a>). </p>
173
173
<p>The default build of Drake is not configured to use Gurobi, so therefore <aclass="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 <ahref="https://drake.mit.edu/bazel.html#proprietary-solvers">https://drake.mit.edu/bazel.html#proprietary-solvers</a>.</p>
174
174
<p>The GRB_LICENSE_FILE environment variable controls whether or not <aclass="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 <ahref="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><oltype="1">
176
-
<li>"GRBwrite", set to a file name so that Gurobi solver will write the optimization model to this file, check <ahref="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 <ahref="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 <ahref="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><oltype="1">
176
+
<li>"GRBwrite", set to a file name so that Gurobi solver will write the optimization model to this file, check <ahref="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 <ahref="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>
178
178
</ol>
179
179
<p><aclass="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 <aclass="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 <aclass="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>
180
180
<p>If neither the "Threads" integer solver option nor <aclass="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>
<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: <ahref="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><dlclass="params"><dt>Parameters</dt><dd>
334
+
<p>See Gurobi reference manual for more detail on callbacks: <ahref="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><dlclass="params"><dt>Parameters</dt><dd>
335
335
<tableclass="params">
336
336
<tr><tdclass="paramname">MathematicalProgram&</td><td>The optimization wrapper, whose current variable values (accessible via MathematicalProgram::GetSolution) will be set to the intermediate solution values. </td></tr>
337
337
<tr><tdclass="paramname">SolveStatusInfo&</td><td>Intermediate solution status information values queried from Gurobi. </td></tr>
<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: <ahref="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><dlclass="params"><dt>Parameters</dt><dd>
359
+
<p>See Gurobi reference manual for more detail on callbacks: <ahref="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><dlclass="params"><dt>Parameters</dt><dd>
360
360
<tableclass="params">
361
361
<tr><tdclass="paramname">MathematicalProgram&</td><td>The optimization wrapper, whose current variable values (accessible via MathematicalProgram::GetSolution) will be set to the intermediate solution values. </td></tr>
362
362
<tr><tdclass="paramname">SolveStatusInfo&</td><td>Intermediate solution status information values queried from Gurobi. </td></tr>
<p>For a linear inequality constraint lower <= A*x <= 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) <= A(i,:)*x <= upper(i). If neither side of the constraint is active, then dual_solution(i) is 0. If the left hand-side lower(i) <= 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<=upper(i) is active (meaning A(i,:)*x=upper(i) at the solution), then dual_solution(i) is non-positive.</p>
619
619
<p>For a bounding box constraint lower <= x <= upper, the interpretation of the dual solution is the same as the linear inequality constraint.</p>
620
620
<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><oltype="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. <divclass="fragment"><divclass="line"><spanclass="keyword">auto</span> constraint = prog.AddLorentzConeConstraint(...);</div><divclass="line">GurobiSolver solver;</div><divclass="line"><spanclass="comment">// Explicitly tell the solver to compute the dual solution for Lorentz</span></div><divclass="line"><spanclass="comment">// cone or rotated Lorentz cone constraint, check</span></div><divclass="line"><spanclass="comment">// https://www.gurobi.com/documentation/10.1/refman/qcpdual.html for</span></div><divclass="line"><spanclass="comment">// more information.</span></div><divclass="line">SolverOptions options;</div><divclass="line">options.SetOption(<aclass="code" href="classdrake_1_1solvers_1_1_gurobi_solver.html#a4dc451b7db72a168d9f0da1746011b45">GurobiSolver::id</a>(), <spanclass="stringliteral">"QCPDual"</span>, 1);</div><divclass="line"><aclass="code" href="classdrake_1_1solvers_1_1_mathematical_program_result.html#a4fd3b5095ed206da42f1451c5dd426c5">MathematicalProgramResult</a> result = solver.Solve(prog, {}, options);</div><divclass="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. <divclass="fragment"><divclass="line"><spanclass="keyword">auto</span> constraint = prog.AddLorentzConeConstraint(...);</div><divclass="line"> GurobiSolver solver;</div><divclass="line"><spanclass="comment">// Explicitly tell the solver to compute the dual solution for Lorentz</span></div><divclass="line"><spanclass="comment">// cone or rotated Lorentz cone constraint, check</span></div><divclass="line"><spanclass="comment">//</span></div><divclass="line">https:<spanclass="comment">//docs.gurobi.com/projects/optimizer/en/12.0/reference/parameters.html#qcpdual</span></div><divclass="line"><spanclass="comment">// for more information.</span></div><divclass="line"> SolverOptions options;</div><divclass="line"> options.SetOption(<aclass="code" href="classdrake_1_1solvers_1_1_gurobi_solver.html#a4dc451b7db72a168d9f0da1746011b45">GurobiSolver::id</a>(), <spanclass="stringliteral">"QCPDual"</span>, 1);</div><divclass="line"><aclass="code" href="classdrake_1_1solvers_1_1_mathematical_program_result.html#a4fd3b5095ed206da42f1451c5dd426c5">MathematicalProgramResult</a> result = solver.Solve(prog, {}, options);</div><divclass="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>
622
622
<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>
623
623
<li>For other convex conic solver such as SCS, MOSEK<ahref="/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 <ahref="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>
0 commit comments