Dear Löfberg,
Is it possible that yalmip optimize n variables, but valued with only specified number variables?
For example, I defined 5 sdpvars x = [x1,x2,x3,x4,x5]. For 100 elements, every element is assigned a variable (one of x) with some constraints. I want to get the specific value x in each element.
I defined this problem as follows:
cons1 = [];
cons2 = [];
cons5 = [];
for i = 1:5
E{i} = sdpvar(3);
cons2 = [cons2, E{i} >= 0];
cons1 = [cons1, l <= trace(E{i}) <= u];
cons5 = [cons5,E{i} - delta*eye(3) >= 0];
end
trE = 0;
cons6 = [];
for i = 1:100
idx{i} = intvar(1);
cons6 = [cons6, 1 <= idx{i} <= 5];
Ei = E{idx{i}};
trE = trE + trace(Ei);
sE(:, i) = [Ei(1, 1); Ei(1, 2); Ei(1, 3); Ei(2, 2); Ei(2, 3); Ei(3, 3)];
end
But the yalmip said "Unable to use a value of type sdpvar as an index."
How to define the problem correctly?
Thank you in advance.