YALMIP with GOROBI

76 views
Skip to first unread message

Zhenzhen Zheng

unread,
Dec 12, 2012, 7:31:34 AM12/12/12
to yal...@googlegroups.com
Hi everyone,

I use YALMP in matlab and select the solver GOROBI:

                ops=sdpsettings('solver','gurobi');
                sol=solvesdp(F,Obj,ops)

How can I know whether the solver gets the optimal solution or not. 

Thanks, 

Johan Löfberg

unread,
Dec 12, 2012, 7:34:00 AM12/12/12
to
If sol.problem = 0 Gurobi has computed an optimal solution.

Zhenzhen Zheng

unread,
Dec 12, 2012, 7:45:46 AM12/12/12
to yal...@googlegroups.com
I find that the function solvesdp returns 1 if the problem is infeasible in YALMIP Wiki. 

and I have  another question:

Can we call the function that Gurobi provide?

Thanks 

Zhenzhen Zheng

unread,
Dec 12, 2012, 7:54:58 AM12/12/12
to yal...@googlegroups.com
If we directly use the Gurobi,  the solver can return optimal state codes and the following are the state codes of Gurobi may return:

LOADED1Model is loaded, but no solution information is available.
OPTIMAL2Model was solved to optimality (subject to tolerances), and an optimal solution is available.
INFEASIBLE3Model was proven to be infeasible.
INF_OR_UNBD4Model was proven to be either infeasible or unbounded.


Johan Löfberg

unread,
Dec 12, 2012, 8:28:02 AM12/12/12
to yal...@googlegroups.com
As you maybe have noticed, I had a typo in my answer, which I fixed immeditely. As it says now, sol.problem=0 means solved to optimality within tolerances (i.e., Gurobi returned OPTIMAL)

If you want the solver specific return codes, use the option savesolveroutput
sol = solvesdp(F,obj,sdpsettings('savesolveroutput',1));
sol.solveroutput


Reply all
Reply to author
Forward
0 new messages