Yuki
Yuki

Reputation: 139

Return Specific Constraint that is Infeasible in Drake

I am currently running a MIQP optimization problem in Drake using Gurobi. I keep on getting an infeasible solution to my optimization problem and I wanted to know if Drake can return any more useful information such as which specific constraint is causing the infeasibility.

I already have returned the type of error (ex: GRB_INFEASIBLE, GRB_UNBOUNDED, GRB_INF_OR_UNBD) from the gurobi.cc file.

Otherwise if such helpful function does not exist, could you offer some tips on debugging a large optimization problem? (Other than creating small test cases)

Thank you

Upvotes: 0

Views: 143

Answers (1)

Hongkai Dai
Hongkai Dai

Reputation: 2766

It's tricky to debug the mixed-integer optimization problem. For gurobi, you could try the function computeIIS(). Do you use the pydrake or the C++ version? If you have the C++ source code, then the easiest way is to to add the following code before this line https://github.com/RobotLocomotion/drake/blob/3f1482d4808d238ee63095ba05c18434b47d1fbf/solvers/gurobi_solver.cc#L1058

GRBcompueIIS(model);
GRBwrite(model, `infeasible.ilp`)

Gurobi will write the infeasible constraint to a text file name infeasible.ilp. If you have set the name of the variables, by calling NewContinuousVariable(size, var_name), then the infeasible report infeasible.ilp will use the variable name var_name.

Unfortunately we cannot associate the infeasible constraint in Gurobi computeIIS function to the constraint you added through Drake, namely it doesn't report which Drake constraint causes the infeasibility yet.

BTW, we have a tutorial on debugging MathematicalProgram in Drake. It is mostly for nonlinear optimization with gradient based solvers.

Upvotes: 1

Related Questions