Re: Cplex and Gurobi gave me totally different ans

55 views
Skip to first unread message
Message has been deleted

Johan Löfberg

unread,
Oct 7, 2018, 11:07:49 AM10/7/18
to YALMIP
Both solvers agreed on the objective 2.97e5 on my machine (I only used one of your files, if you get different answers, then you have different models in your two files)

Gurobi is warning you about tiny coefficients. You should investigate why you have numerical noise in your constraints (they're in the order of 10^-20)

Johan Löfberg

unread,
Oct 7, 2018, 11:10:02 AM10/7/18
to YALMIP
it's your matri D which is full of numericals garbage

 min(abs(D(abs(D)>0)))

ans =

   3.2085e-20

Message has been deleted

Johan Löfberg

unread,
Oct 8, 2018, 3:16:49 AM10/8/18
to YALMIP
D(abs(D)<= 1e-8)=0 is perhaps a bit more compact...

cplex is extremely lucky on this model, while gurobi only is very lucky

Kris

unread,
Oct 8, 2018, 8:26:07 AM10/8/18
to YALMIP
Wow, got it!
Thanks for your help!

Best wishes
Kris

Kris

unread,
Oct 9, 2018, 3:41:05 AM10/9/18
to YALMIP
Dear Prof Lofberg;

Sorry for disturbing you again.
You have told me that why different solvers  could offer totally different ans, which helps me solve my problem in ieee118. Appreciated it!
Although Gurobi and Cplex need different time to solve same problem, they give me same ans finally.
Today, I have some new problems. I am working out a  two-stage stochastic linear optimization with linear recourse problem in ieee9. 
After derivation, I change the problem into a conic problem with conic constraints.
I used Cplex to solve it firstly, getting a ans 6.4966e+07 (Compared to the ans,1.8057e+04 is too big, but seems like reasonable). All right ...
Then I tried Gurobi, Which offered me a unreasonable ans, -3.2567e+67 ( Negative cost ). Besides, the command window reported that: "Sub-optimal termination - objective -3.25669808e+67".I guess the report means that the problem can not be solved,so I can get a sub-optimization ans? Or the type of solver caused the problem?

Here are my codes, Appreciated for your kindness!
Best wishes
Kris

Ieee9_Dro_Order2.m

Johan Löfberg

unread,
Oct 9, 2018, 3:58:17 AM10/9/18
to YALMIP
Both cplex and gurobi report this model as unbounded on my machine

  41  -6.1556665e+08  -6.0540498e+08  1.50e+04  0.00e+00  3.41e+02  9.84e-08
  42  -6.3454236e+08  -6.2481823e+08  2.08e+04  0.00e+00  3.08e+02  1.03e-07
  43  -8.3771273e+08  -8.2375077e+08  2.12e+04  0.00e+00  3.01e+02  7.16e-08
  44  -3.1641699e+09  -3.0532619e+09  3.48e+04  0.00e+00  2.69e+02  9.02e-09

ans = 

  struct with fields:

       yalmiptime: 1.533168660423039e+00
       solvertime: 3.268313395769605e-01
             info: 'Unbounded objective function (CPLEX-IBM)'
          problem: 2

Johan Löfberg

unread,
Oct 9, 2018, 4:00:53 AM10/9/18
to YALMIP
and you still have a lot of numerical garbage in your model (coefficient range is not shown in your version)

>> constraint6
++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|   ID|                 Constraint|   Coefficient range|
++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|   #1|   Equality constraint 96x1|      0.12485 to 530|
|   #2|   Equality constraint 96x1|     7.0221e-17 to 1|
|   #3|   Equality constraint 96x1|     7.0221e-17 to 1|
|   #4|   Equality constraint 96x1|     7.0221e-17 to 1|
++++++++++++++++++++++++++++++++++++++++++++++++++++++++


Kris

unread,
Oct 9, 2018, 4:52:38 AM10/9/18
to YALMIP
Dear Prof Lofberg;

Thanks, I will check the reasons cause unbounded again!

Best wishes
Kris
Reply all
Reply to author
Forward
0 new messages