How to make Gurobi return the exact result of whether the model is infeasible or unbounded?

63 views
Skip to first unread message

Xinwei Shen

unread,
Jul 5, 2017, 5:33:11 AM7/5/17
to YALMIP
I was trying to know if a model formulation is infeasible or unbounded, however, the sol.problem that I get from optimize() is 12. (the solver is gurobi)

"12" means "infeasible or unbounded"
How can I know whether the model is infeasible or unbounded?

Thanks.

Johan Löfberg

unread,
Jul 5, 2017, 5:40:55 AM7/5/17
to YALMIP
Solve the problem without objective, then you will know

Xinwei Shen

unread,
Jul 5, 2017, 6:19:14 AM7/5/17
to YALMIP
Thanks.

For those who concerns this, some additional infor. is at https://yalmip.github.io/command/optimize/

If we only look for a feasible solution, we can omit the objective function

optimize(F);

A diagnostic structure is returned which can be used, e.g, to check feasibility as reported by the solver (see yalmiperror for the possible return values)

diagnostics = optimize(F);
if diagnostics.problem == 0
 disp('Solver thinks it is feasible')
elseif diagnostics.problem == 1
 disp('Solver thinks it is infeasible')
else
 disp('Something else happened')
end


Johan Löfberg

unread,
Jul 5, 2017, 6:22:27 AM7/5/17
to YALMIP
Just so no-one is confused here. Normally, solvers return infeasibility indicator for infeasible problems also when you have an objective. It is just in some cases where a lot of presolve has been performed where the solver cannot distinguish unbounded from infeasible, and if that happens, you can remove the objective to see if it was infeasible or unbounded

Erling D. Andersen

unread,
Jul 6, 2017, 2:56:17 AM7/6/17
to YALMIP
Btw in MOSEK presolve always returns whether the problem is primal or dual infeasible and certificate to verify the conclusion.  

So it can done in the continuous case if you want. In the mixed-integer case things are more tricky.





 
Reply all
Reply to author
Forward
0 new messages