Gurobi got a wrong result when showing "Solved" in a simple question

#1

Here’s my code in matlab:
cvx_begin
cvx_solver gurobi
variable x1;
variable x2;
variable S;
maximize S
subject to
S1 = -(x1 - 9).^2 - (x2 - 17).^2;
S2 = -(x1 - 16).^2 - (x2 - 8).^2;
S <= S1;
S <= S2;
cvx_end
The cvx output is:
Status: Solved
Optimal value (cvx_optval): -81
When I chose other solvers such as sdpt3 or sedumi, I could get the correct value “-32.5”. I wish someone could tell me why this would happen and how may I set the gurobi solver to get the right value?

(Mark L. Stone) #2

I got cvx_optval = 0 with Gurobi, and -32.5 with other solvers. So this appears to be a bug either in Gurobi or in the CVX/Gurobi interface. Similar to what was found at Gurobi ignores constraints .

Therefore, I recommend you don’t use Gurobi under CVX.

Warnings during CVX setup
#3

Ok, thanks for you consideration.

#4

Hi, I’m back here.
I found this maybe the problem of version 3.0beta. I reran the code in cvx 2.1 today, which showed right outputs with both gurobi and sdpt3.
However, sometimes it costs a long time for cvx 2.1 to start the solver. Is there any method to accelerate this progress? Or can I get a stable 3.0 version now?

(Mark L. Stone) #5

There is no stable CVX 3.0 version now, and I;m not sure there ever will be.

I got the (wrong) Gurobi result using Version 2.1, December 2018, Build 1127.

#6

Are there many different versions of cvx 2.1?
The information I got from command “cvx_version” is below:
“CVX: Software for Disciplined Convex Programming ©2014 CVX Research
Version 2.1, Build 1127 (95903bf) Sat Dec 15 18:52:07 2018”

(Mark L. Stone) #7

That is the current version (build).