Creation of a lower block triangular matrix of symbolic variables in Yalmip

164 views
Skip to first unread message

Muhammad Yasir

unread,
Aug 20, 2021, 3:11:31 PM8/20/21
to YALMIP
How can I create a Lower Block  Triangular Matrix of the following form which contains symbolic variables, which are evaluated by solving an optimization problem
Screenshot 2021-08-20 230422.jpg
where 
Screenshot 2021-08-20 231022.jpg;  suppose m = 1, d = 3

values of the entries of this matrix will be evaluated later on through the solution of an optimization problem...

I am trying to solve a Stochastic MPC-based optimization problem...

Is the following code correct to create such a lower block triangular matrix with symbolic variables:

clc
clear all

m = 1;
d= 3;

l_1t = sdpvar(m,d);
l_2t = sdpvar(m,d);
l_2tplus1 = sdpvar(m,d);
l_3t = sdpvar(m,d);
l_3tplus1 = sdpvar(m,d);
l_3tplus2 = sdpvar(m,d);


LAMBDA_t = [zeros(m,d) zeros(m,d) zeros(m,d); l_1t zeros(m,d) zeros(m,d); l_2t l_2tplus1 zeros(m,d); l_3t l_3tplus1 l_3tplus2];
size(LAMBDA_t)

Johan Löfberg

unread,
Aug 20, 2021, 3:19:33 PM8/20/21
to YALMIP
LAMBDA_t = tril(sdpvar(N),-1) would be the obvious way to create it from scratch unless I am missing some structure in your notation

Muhammad Yasir

unread,
Aug 21, 2021, 4:48:55 AM8/21/21
to YALMIP
tril is a regular command of Matlab to create a lower triangular matrix with a second input argument equal to -1.  While  sdpvar(N) will create an NxN matrix. 
However, the catch here, in this case, is that I want to create a lower block triangular matrix where the dimension of each block matrix is mxd = 1x3
So this regular form of tril command does not seem to work for the creation above mentioned lower block triangular matrix

Muhammad Yasir

unread,
Aug 21, 2021, 5:14:59 AM8/21/21
to YALMIP
A similar kind of technique is also discussed on the help page of Yalmip for command 'blkvar'

Johan Löfberg

unread,
Aug 21, 2021, 6:26:07 AM8/21/21
to YALMIP
sound lke you want to combine it with a kron then

>> L = kron(tril(ones(4),-1),ones(2,3));
>> spy(L)
>> L = L.*sdpvar(8,12)

Muhammad Yasir

unread,
Sep 15, 2021, 11:52:02 AM9/15/21
to YALMIP

This technique does not seem to work...

Muhammad Yasir

unread,
Sep 15, 2021, 12:01:18 PM9/15/21
to YALMIP
I want to implement the following constraint

m = 1;
d = 3;

THETA_t = [zeros(m,d) zeros(m,d) zeros(m,d) zeros(m,d); sdpvar(m,d) zeros(m,d) zeros(m,d) zeros(m,d);... 
    sdpvar(m,d) sdpvar(m,d) zeros(m,d) zeros(m,d); sdpvar(m,d) sdpvar(m,d) sdpvar(m,d) sdpvar(m,d)];

ETA_t = [sdpvar; sdpvar; sdpvar; sdpvar];

constraints1 = [];

constraints1 = [constraints1, abs(ETA_t(i,:))+norm(THETA_t(i,:),1)*phi_max <= Umax];     ---- eq(17)

Screenshot 2021-08-21 184551.jpg

Since ETA_t and THETA_t involve sdpvar variables. So, is it OK to use implement constraints without using 'implies' statement.
I have read Yalmip help regarding use of 'implies', but I could not understand how to use 'implies' for modeling if-else when sdpvar variables are involved....

I am implemented this paper theoretically but my results are not as expected perhaps, I do not properly understand use of Yalmip

Johan Löfberg

unread,
Sep 15, 2021, 1:42:09 PM9/15/21
to YALMIP
I have no idea what you are asking about. All articles about implies and if-else are (of course) involving sdpvars.

Muhammad Yasir

unread,
Sep 15, 2021, 1:46:27 PM9/15/21
to YALMIP
OK let me rephrase the question, then would repost my question ... the crux of the matter is I am unable to understand how to use implies for if-else like constraints based on sdpvar variables...

Johan Löfberg

unread,
Sep 15, 2021, 1:52:37 PM9/15/21
to YALMIP
Reply all
Reply to author
Forward
0 new messages