soft constraint - lousy big-m warning

369 views
Skip to first unread message

intense

unread,
Mar 5, 2013, 10:55:24 AM3/5/13
to yal...@googlegroups.com
Hi Johan

I've a problem with soft constraints and use implies() to set a boolean variable to 1 or 0. implies() seems to have problems with the soft constraints and posts the following warning:
Warning: You have unbounded variables in IMPLIES leading to a lousy big-M relaxation. 
If I don't use soft constraints it works perfectly. In the following there's a test script that produces this warning (my model being way more complex):

constraints = [];

objective = 0;

for i=1:N 

    % calculate objective

    objective = objective + epsX{i}'*SC*epsX{i}; % if lots of "infeas. or unbound" message reduce SC!!!

 

    % set up constraints:

    %   - state update equations

    constraints = [constraints, x{i+1} == x{i} + 3600*1e-6*q_temp{i}];

    constraints = [constraints, implies(d{i}, q_temp{i} == -10*(x{i}-25)), implies(false(d{i}), q_temp{i} == 0)];

    constraints = [constraints, -1e5 <= q_temp{i} <= 1e5];

    

    %   - soft constraints on states 1:5, hard constr. on states 6:8

    constraints = [constraints, -epsX{i}+24 <= x{i} <= 21+epsX{i}];

%     constraints = [constraints, -10+xRoomNomH <= x{i} <= xRoomNomC+10]; % hard constraints version

    constraints = [constraints, epsX{i} >= 0];

end

.

Is there a constraint missing or do you have an idea how I could improve the code of this small test script?

Thanks

Johan Löfberg

unread,
Mar 5, 2013, 11:24:31 AM3/5/13
to yal...@googlegroups.com
You don't have any bound on x, hence YALMIP complains when trying to create a big-M model. Explicit small but sufficiently large bounds are required for big-M to work.

Also note that your bound on q seems absolutely huge, hence the big-M relaxation will be really poor numerically (just briefly looking at your model the bounds seem unnecessarily large. qtemp is on the order of 10 times x. Saying qtemp is on the order of 10^5 means that you are expecting, in the worst case, states x in the order of 10^4. Is that realistic in any kind of optimal model? To me it looks like x is a room temperature. Could it ever go so bad in your controller that the temperature goes to 10000, or below -273.).

BTW, your soft-constraint seems backwards, clearly you must mean -epsX{i}+21 <= x{i} <= 24+epsX{i}.


Message has been deleted

intense

unread,
Mar 6, 2013, 4:33:25 AM3/6/13
to yal...@googlegroups.com
Sorry, I did a typo concerning the soft-constraint. The model itself was just done to reproduce the warning, and extracted from my bigger model where I do have different model parameters. But for that case, you're right, the bounds are too big.
You're right that it concerns room temperature. I added a constraint for x, where I choose the lower and upper bound sufficiently large to not get an infeasible problem:

   constraints = [constraints, -epsX{i}+21 <= x{i} <= 24+epsX{i}];

   constraints = [constraints, 0 <= x{i} <= 50];

This works now. Thanks a lot.

Johan Löfberg

unread,
Mar 6, 2013, 6:18:36 AM3/6/13
to yal...@googlegroups.com
Note that you still have a pretty crappy model in terms of numerics, since the huge bounds on q are used in the model. You should improve those. From your model, it follows that -250 <= q <= 250 when 0<=x<=50
Reply all
Reply to author
Forward
0 new messages