One of the constraints evaluates to a DOUBLE variable

535 views
Skip to first unread message

Mohamed Heteba

unread,
Apr 27, 2015, 6:18:19 AM4/27/15
to yal...@googlegroups.com
Hi johan,

when i was trying to expand my constraints list with this command:

Constraints = [Constraints, -cos(obst(o,3))*State(k,1,v) - sin(obst(o,3))*State(k,2,v) <= -avoidanceDist 
             - obst(o,4)*k*dt - cos(obst(o,3))*obst(o,1) - sin(obst(o,3))*obst(o,2) 
             + bigM*(bObstAvoid(k,1,o,v)+bObstAvoid(k,2,o,v))];

this error is throw to me,
One of the constraints evaluates to a DOUBLE variable 

and when i check for the length of the constraints list i found that it is expanded by two inequalities of size 1*1 while it is expected to be expanded only by one inequalitz of size 1*1, as when i was trying to evaluate the constraint in the command window while debugging its' result is really what is expected, one inequality of size 1*1. 

State(k,1,v), State(k,2,v), (bObstAvoid(k,1,o,v), bObstAvoid(k,2,o,v); these elements are variable , the State are real variables and the bObstAvoid are integer variables.

hope that you could help me.
Thanks in advance 

Johan Löfberg

unread,
Apr 27, 2015, 6:23:31 AM4/27/15
to yal...@googlegroups.com
Please supply a simple example which can be run.

Mohamed Heteba

unread,
Apr 27, 2015, 6:42:05 AM4/27/15
to yal...@googlegroups.com
Constraints = [];
State = sdpvar(10,5,1);
bObstAvoid = binvar(10,2,1,1);
Constraints = [Constraints, -cos(0)*State(1,1,1) - sin(0)*State(1,2,1) <= -4.5014 
             - 10 + 10000*(bObstAvoid(1,1,1,1)+bObstAvoid(1,2,1,1))];

in this piece of code the there is no warning, if when run the code and then try to check for the constraints list you will find that it contains two inequalitites while only one inequalitiy is added to the empy constraint list 

Johan Löfberg

unread,
Apr 27, 2015, 6:58:28 AM4/27/15
to yal...@googlegroups.com
Looks like you're doing this

>> [1 <= 2
 
+7]


ans
=

     
1
     
7


Reply all
Reply to author
Forward
0 new messages