Hi Johan,
I have a question about yalmip. My code is follows
r = sdpvar(len_r*2, 1); % The parameters to be optimized
Constr_A = zeros(num_states, 1, num_actions); % num_states = 80, num_actions = 4
Constr_B = zeros(num_states, 1, num_actions);
Constr_A_B = zeros(num_states, 1, num_actions);
Constr_B_A = zeros(num_states, 1, num_actions);
for j = 1 : num_actions
Constr_A(:, :, j) = (B_A(:, :, j) - B)*D*r(1:len_r); % A column vector of 80*1
Constr_B(:, :, j) = (B_B(:, :, j) - B)*D*r((len_r+1):2*len_r); % A column vector of 80*1
Constr_A_B(:, :, j) = (B_A(:, :, j) - B)*D*(r(1:len_r) + r((len_r+1):2*len_r)); % A column vector of 80*1
Constr_B_A(:, :, j) = (B_B(:, :, j) - B)*D*(r(1:len_r) + r((len_r+1):2*len_r)); % A column vector of 80*1
end
Constraints = [-1 <= r <= 1];
bound = 2e-5;
for j = 1 : num_actions
Constraints = [Constraints, Constr_A(:, :, j)<=bound*ones(num_states, 1), ...
Constr_B(:, :, j)<=bound*ones(num_states, 1), ...
Constr_A_B(:, :, j)<=bound*ones(num_states, 1), ...
Constr_B_A(:, :, j)<=bound*ones(num_states, 1)];
end
.........
When running the red part, I encountered a problem: Error using lmi/horzcat (line 21) One of the constraints evaluates to a FALSE LOGICAL variable.
Obviously, Constr_A(:, :, j) is a 80*1 vector. What do you think could be the issue?
Thanks so much for your help