Problem is feasible without an objective function, infeasible with (objective is bounded)

31 views
Skip to first unread message

Tom Holden

unread,
Mar 2, 2020, 6:25:47 AM3/2/20
to YALMIP
Hi,

The attached example "ProblemTest.m" illustrates a situation in which when run with an objective, the solver (Mosek or Gurobi) reports it is infeasible, but when run without it reports a feasible solution.

To run the file, you just need to have the "ProblemWorkspace.mat" file in the same folder you are running from.

Note also that the objective is bounded below, as the objective is given by:

  Objective = -( sum( Switch ) * numel( Buffer ) * 10 + sum( Buffer(:) ) );

where Switch is a vector with elements equal to 1, 0 or -1, and Buffer is a vector with elements all less than 0.5.

Do you have any idea what is causing this? I expect it is to do with the fact that Switch is defined as:

  Switch = sign( Buffer - 1e-4 );

Do you have any suggestions for a work-around? I have solved many similar problems without issue.

Thanks in advance,

Tom


ProblemTest.m
ProblemWorkspace.mat

Johan Löfberg

unread,
Mar 2, 2020, 7:26:37 AM3/2/20
to YALMIP
YALMIP assumes models are well-scaled when doing big-M modelling, so unbounded variables are capped at 10^4. This is not feasible in your model which appears to be badly scaled (solving the feasibility problem leads to buffer in the order of 10^6)

Tom Holden

unread,
Mar 2, 2020, 7:33:44 AM3/2/20
to YALMIP
Is there an option to change that value? Is it possible to find out why YALMIP is resorting to Big-M bounds? It shouldn't be necessary here I thought.

Johan Löfberg

unread,
Mar 2, 2020, 7:36:52 AM3/2/20
to YALMIP
Not unless you hack the code.

sign is an operator which requires a big-M model (and it is a horrible operator to model as it is discontinuous, even worse that it has a point with a specific value). 

 Preferred alternative is to model the sign operator manually, to understand why it is such a bad operator to work with, and how that can lead to very bad results

Tom Holden

unread,
Mar 2, 2020, 7:42:16 AM3/2/20
to YALMIP
Do you have any suggestions for this particular example? Essentially I want as many elements of Buffer as possible to be positive. Conditional on that, I want the elements of Buffer to be as large as possible.

Johan Löfberg

unread,
Mar 2, 2020, 7:47:57 AM3/2/20
to YALMIP
Use other units (don't work with euro, work with MEUR etc)

But for your practical problem here, don't model that with sign. Best is always to understand what the MILP model sohlud be, in this case maximize sum(d) where d is a binary vector and Buffer >= (1-d)*lowerbound

Tom Holden

unread,
Mar 2, 2020, 7:49:09 AM3/2/20
to YALMIP
Thanks for the advice!
Reply all
Reply to author
Forward
0 new messages