Problem solves using gurobi, but not cplex

45 views
Skip to first unread message

Cody Rooks

unread,
Jul 26, 2019, 2:51:11 PM7/26/19
to YALMIP
I'm a relatively new user of Yalmip, so I apologize if this is a well-known phenomena. I did not see existing postings on this topic, however. 

I have a problem that is solving successfully using Gurobi as the solver, but the exact same problem is infeasible when I use CPLEX as the solver. Any ideas as to what is going on here? 

Thank you, 

Cody 

Johan Löfberg

unread,
Jul 26, 2019, 2:53:52 PM7/26/19
to YALMIP
either a bug in either solver, or perhaps the problem numerically ill-posed so the problem almost feasible and gurobi accepts the violation, while cplex does not, with default setting

i.e impossible to answer without reproducible code

Cody Rooks

unread,
Jul 26, 2019, 3:27:39 PM7/26/19
to YALMIP
Thanks for your reply. 

The problem I am trying to solve is a fairly simple MPC to control the HVAC systems of a fleet of homes, which are described by unique, linear thermal models of the form: temp_in_t+1 = a*temp_in_t + b*u_hvac + g*temp_out_t.

I have just observed another peculiarity: when the homes are homogeneous (meaning all parameters a,b,g are the same for each home), both cplex and gurobi solvers run successfully. When I change these slightly to a heterogeneous case, gurobi works but cplex does not. 

For reference I have attached the fleet controller function (called dynamic_varying_hvac.m) and the main test code (main_cody1.m) I'm using to troubleshoot it. In main_cody1 I have the variable called "solver" right at the top to change the solver used by Yalmip. If you change this from 'gurobi' to 'cplex', you can see how one solves and one doesn't (except if all homes are homogeneous). 

Thank you, 

Cody
main_cody1.m
dynamic_varying_hvac.m

Johan Löfberg

unread,
Jul 27, 2019, 12:52:43 AM7/27/19
to YALMIP
Both cplex and gurobi fail to solve already the first problem (infeasible and infeasible or unbounded (ie. infeasible)). You are neither looking at the diagnostic output from the optimizer object nor cranking up the display to see solver messages, so you would not know though...

Johan Löfberg

unread,
Jul 27, 2019, 1:18:58 AM7/27/19
to YALMIP
btw, your model is a bit weird as you call d a disturbance, but then you let the optimizer select the best possible sequence d(2), d(3) etc
Reply all
Reply to author
Forward
0 new messages