Determining the vertices of a polytopic Yalmip constraint set

146 views
Skip to first unread message

Marc Wijnand

unread,
May 27, 2015, 9:21:27 AM5/27/15
to yal...@googlegroups.com
After some calculations, I obtained a Yalmip constraint set that is in fact a polytope and I want to know the coordinates of its vertices. Using the 'Data cursor' in the Figure window, I can inspect the values and manually enter them in a matrix. How can I do this in an automatic way?

x = sdpvar(2,1);

X = [-1<=x<=1];

plot(X,x)

   xlim([-2 2])

   ylim([-2 2])



Johan Löfberg

unread,
May 27, 2015, 8:23:30 PM5/27/15
to yal...@googlegroups.com
You have to convert to a mpt object

Marc Wijnand

unread,
Jun 2, 2015, 11:16:54 AM6/2/15
to yal...@googlegroups.com
If you know the matrices A,b in Ax<=b (such as in the MWE above), it is straightforward to use an MPT Polyhedron. However, I have situations where a yalmip constraint set appears to be polytopic, but I don't have the matrices. My problem is whether it is possible to determine the vertices of such a yalmip set.

Johan Löfberg

unread,
Jun 2, 2015, 12:48:35 PM6/2/15
to yal...@googlegroups.com
The only thing you can do is to extract the points on the inner approximation of the feasible set that YALMIP computed

W =plot(...)


Marc Wijnand

unread,
Jun 5, 2015, 9:35:51 AM6/5/15
to yal...@googlegroups.com
This works.
x = sdpvar(2,1);
X = [-1<=x<=1];
%plot(X,x)
%   xlim([-2 2])
%   ylim([-2 2])
%hold on
pointlist = plot(X,x);
pointlist = cell2mat(pointlist);
pointlist = (unique(pointlist','rows','stable'))'
pointlist = [pointlist pointlist(:,1)] %close figure
%plot(pointlist(1,:),pointlist(2,:))


Message has been deleted

Marc Wijnand

unread,
Jun 5, 2015, 11:03:12 AM6/5/15
to yal...@googlegroups.com
BTW, this is also the way to 'convert' a nonpolytopic yalmip constraint set to a polytope: extract the vertices via the plot command and define an MPT Polytope with them.
Reply all
Reply to author
Forward
0 new messages