getbounds.m

25 views
Skip to first unread message

Jimi Hendrix

unread,
Jan 29, 2013, 2:29:44 PM1/29/13
to yal...@googlegroups.com
Hi,

I have a yalmip constraint object and need to determine the implied lower and upper bounds for the decision variables in the constraint.  Is the function getbounds.m going to return what I need, and will the returned bounds be tight?  

Thanks!

Johan Löfberg

unread,
Jan 29, 2013, 2:42:00 PM1/29/13
to
No, the functionality you are intested in is probably boundingbox (it will only be of use if your model is convex and the bounds actually can be computed efficiently. Additionally, if you have a complex model, it might be important to use a second argument to specify which variables you are interested in, since YALMIP creates variables internally also)

sdpvar x1 x2
P
= [x1 + x2 <= 1, x1 - x2 <= 1, -x1 + x2 <= 1, -x1-x2 <= 1]
[B,L,U] = boundingbox(P);
L
U
hold on
plot
(B,[],'y');
plot
(P);

Unfortunately, there is a silly bug in some versions which causes the generated object to be wrong (the bounds are correct though). Edit lmi/boundingbox and line 91 looks like this

B = [B, (xUf >= L(Uf)):'Finite upper bounds'];

It should be changed to

B = [B, (xUf <= U(Uf)):'Finite upper bounds'];




Jimi Hendrix

unread,
Jan 29, 2013, 3:15:31 PM1/29/13
to yal...@googlegroups.com
Thanks Johan for the quick response.

Are the elements of B and L ordered corresponding to the indices returned from getvariables.m?  Or is it best to always pass in the sdpvar object as the third input argument?

Thanks!

Johan Löfberg

unread,
Jan 29, 2013, 3:35:05 PM1/29/13
to yal...@googlegroups.com
Safest to explicitly specify variables through the third argument (it is easy to miss that the model often contains variables which aren't defined by you)

Jimi Hendrix

unread,
Jan 29, 2013, 3:38:59 PM1/29/13
to yal...@googlegroups.com
Thanks!
Reply all
Reply to author
Forward
0 new messages