Alan Papalia
Alan Papalia

Reputation: 11

How do I obtain an intermediate solution using the pydrake interface to Gurobi

I'm using pydrake to interface with Gurobi and solve a second-order cone program. I am hoping to get the solution at each iterate so I can see how the solution evolves.

Whenever termination is due to number of iterates, the early termination appears to return the variable solutions as NaNs, regardless of the number of iterates.

The result info is as follows: result.get_solution_result() == SolutionResult.kUnknownError and result.is_success() == False

Inspection of the GurobiSolverDetails shows the following:

Other hopefully relevant info:

I was originally working with Ubuntu 18.04 and Gurobi 9.1

I thought that updating to latest version of things might fix these issues but it seems I'm getting identical solutions. My back up plan is to just implement this in gurobipy without using Drake at all but would prefer to see if that's avoidable.

Upvotes: 1

Views: 81

Answers (1)

Russ Tedrake
Russ Tedrake

Reputation: 5543

Have you looked at the "debug mathematical program" tutorial? https://deepnote.com/workspace/Drake-0b3b2c53-a7ad-441b-80f8-bf8350752305/project/Tutorials-2b4fc509-aef2-417d-a40d-6071dfed9199/notebook/debug_mathematical_program-9acce39e5eb642e392d86d0809fa5c76 In particular, for gurobi we often turn on the solver verbosity.

There are also some gurobi-specific solution results available via https://drake.mit.edu/doxygen_cxx/structdrake_1_1solvers_1_1_gurobi_solver_details.html

Upvotes: 0

Related Questions