Replace the 'set' function

900 views
Skip to first unread message

Rajat

unread,
Nov 19, 2015, 7:09:48 AM11/19/15
to YALMIP
First of all, I would like to admit that I am very new to this 'YALMIP' community. Actually, I was going through one's MATLAB code. While understanding his code, I came to know about this platform.

In that MATLAB code, I noticed that he used 'set' function, but when I am trying to run that code by using newest 'YALMIP' package, it is giving me the following error-

"Error using constraint/set (line 6)
Obsolete command."

I tried to fixed it by omitting it from the code, but it is still not working. Few snaps how the code looks like-

1. c = set(A(:)>=0) + set(B(:)>=0);
2. c = c + set (C(:)==0);
3. c = c + set([eye(2), X; X', [Y(ii), Y(ij); Y(ij), Y(jj)]]>=0);
4. c = c + set(S==0, 'Equality');

My try was-

1. c = (A(:)>=0) + (B(:)>=0);
2. c = c + (C(:)==0);
3. c = c + ([eye(2), X; X', [Y(ii), Y(ij); Y(ij), Y(jj)]]>=0);
4. c = c + (S==0);

Please help me to fix the problem. Thanks in advance.

Johan Löfberg

unread,
Nov 19, 2015, 7:11:29 AM11/19/15
to YALMIP
That looks correct so I don't see what the question is

Rajat

unread,
Nov 19, 2015, 2:00:27 PM11/19/15
to YALMIP
Thank you sir. Actually, after modifying the code as I have mentioned earlier, I am getting the following error-

"Error using lmi/subsref (line 27)
LMI 'Equality' not available.

Error in MLESDP_inside_v2 (line 116)
cc = (ConstraintSet('Equality')); num = length(cc);".

My intuition is that this is because I changed the "c = c + set(S==0, 'Equality');". Is it true? If not, do you have any idea why it is showing like that? Or, is it because of any bug inside the code?

Thank you again for your time.

Johan Löfberg

unread,
Nov 19, 2015, 2:11:50 PM11/19/15
to YALMIP
In the original code, one of the constraints have been tagged with the name 'equality' to be used for referencing. hence you have to do the same

c + ((S==0):'Equality')

BTW, using brackets and concatenation instead of + to generate list of constraints is, in my opinion, easier to read

waseem abbasi

unread,
Jun 24, 2019, 8:12:33 PM6/24/19
to YALMIP
actually, I am also facing the problem while using the set command:  

SET has been considered obsolete for many years, and the time has come...
Update your code. https://yalmip.github.io/tutorial/basics/

Error using constraint/set (line 6)
Obsolete command
Error in chap5_1 (line 14)
L=set(FAI<0);


 Kindly guide for the solution. Thanks in advance

Johan Löfberg

unread,
Jun 25, 2019, 2:15:16 AM6/25/19
to YALMIP
Reply all
Reply to author
Forward
0 new messages