Which solver should I choose faced with nonlinear MIP?

47 views
Skip to first unread message

TowangEE

unread,
Feb 26, 2018, 8:23:19 PM2/26/18
to YALMIP
Dear Dr.Löfberg:
         Firstly, Thank you for what you've done for all the learners like me. The Q&As in this group often remind me of what things should be solved.It helps a lot.
         As a new learner, I do have trouble when I model a nonlinear MIP thing.Code's attached.
         I wonder is there a solver available for such problem and which solver should I choose?
         Since the constraints of my model are nonlinear, like var1*var2, var3^2, and all those vars are not binary, so I don't know how to linearize the constraints and objective.
         Should I try to simplify my model and linearize constraints? However, the thing I try to model and solve is just the way it shows in the code attached.
         I really don't know how to do for several days, it feels bad.
         look forward your reply.
Best wishes.

hub001.m

Johan Löfberg

unread,
Feb 27, 2018, 2:45:52 AM2/27/18
to YALMIP
Well, fmincon is definitely not applicable as you have binary variables

For YALMIPs global solver bmibnb to work, you have to have explicit bounds on all variables involved in nonlinear operators. I guess at least Sef and Shf are missing bounds

Your quadratic terms must be sparsified before you try to attack this using a global solver (such as bmibnb). Instead of using fd = m*(Tm-Tmbest).^2+n, introduce a new variable e with the constraint  e== Tm-Tmbest, and then use m*e.^2+n. 

The scale appears to be bad as  you have bounds on the order of millions. That typically indicates that you are using the wrong unit. You don't measure power in a city grid in Watts, you measure it in Mega Watts.

Some general comments

ton+toff >= 0 is redundant as both are binaries

can't you require ton + toff == 1? That cuts out one combinatorial case

using the last for-loop is unnecessary, you simply have ton + toff <= 1, Eload == DLG + fd ... etc

TowangEE

unread,
Feb 27, 2018, 3:48:23 AM2/27/18
to YALMIP
Thank you so much for your valuable advice, Dr. Dr.Löfberg.
I feel embarrassed showing you my immature clumsy code.
I think bmibnb may be the right solver for my model after your reminds.
But I wonder:
When you mean  'you have to have explicit bounds on all variables involved in nonlinear operators',  does that means every single variable in each nonlinear formula like constraints and objective must be limited within two CONSTANTS? Can the bounds are other variables?
Thank you again for your time.

Johan Löfberg

unread,
Feb 27, 2018, 4:32:44 AM2/27/18
to yal...@googlegroups.com
Yes, every variable which is involved in a nonlinear operation which bmibnb will apply a branching strategy on, must have lower and upper bounds. YALMIP performs bound propagation to try to derive them and strengthen from other bounds, but if explicitly bounded, it is sure that YALMIP will be able to derive bounds. When I tried you model, upper bounds on Sef and Shf were missing and could not be derived

https://yalmip.github.io/tutorial/envelopesinbmibnb/
https://yalmip.github.io/tutorial/globaloptimization/
https://yalmip.github.io/solver/bmibnb/

TowangEE

unread,
Feb 27, 2018, 5:02:32 AM2/27/18
to YALMIP
A lot of thx! I love this forum!
I'll seek for your generous and unselfish help when I'm trapped.
Thank you again, Dr. Dr.Löfberg.

Johan Löfberg

unread,
Feb 27, 2018, 5:17:04 AM2/27/18
to YALMIP
I would also advice you to look at some of the numbers

>> alpha*exp(beta*(1/Tfc0-1/Tfc))

ans =

   7.9318e-13

That's 0 in a numerical solver. You can just as well remove that and simplify the model.

TowangEE

unread,
Feb 27, 2018, 5:30:01 AM2/27/18
to YALMIP
good advice! I'll check the whole code I've written over again.
Thanks for your patients.

TowangEE

unread,
Feb 27, 2018, 5:31:41 AM2/27/18
to YALMIP
Umm...patience..
Poor English..
Reply all
Reply to author
Forward
0 new messages