A question of sdpvar in Yalmip #1000
Replies: 1 comment 6 replies
-
Does it actually work. Mosek fails on my machine K>> optimize(F,f,ops) Concerning the error, on second iteration i =
K>> b |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
load ins
k=panel(:,1)
e=panel(:,2)
v=panel(:,3)
s=panel(:,4)
r=panel(:,5)
g=panel(:,6)
y=panel(:,7)
b=panel(:,8)
gk=gpanel(:,1)
ge=gpanel(:,2)
gv1=gpanel(:,3)
gs1=gpanel(:,4)
gr=gpanel(:,5)
gg=gpanel(:,6)
gy=gpanel(:,7)
gb=gpanel(:,8)
gv2=gpanel(:,9)
gs2=gpanel(:,10)
H=87
% k e v s r g y b gm1 gm2 ee1 ee2 ee3 ee4
% 1 2 3 4 5 6 7 8 9 10 11 12 13 14
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
z1_result=[]
z2_result=[]
z3_result=[]
z4_result=[]
z5_result=[]
z6_result=[]
z7_result=[]
z8_result=[]
z9_result=[]
z10_result=[]
z11_result=[]
x_result=[]
for i=1:H
x=sdpvar(1,14);
T=x(1)*k(i)+x(2)*e(i)+x(5)*r(i)-x(4)*s(i)+x(9);
M=x(1)*gk(i)+x(2)*ge(i)+x(5)*gr(i)+x(4)*gs2(i);
Q=x(4)*s(i)+x(5)*r(i)+x(3)*v(i)+x(8)*b(i)-x(6)*g(i)-x(7)*y(i)+x(10);
N=x(4)*gs1(i)+x(5)*gr(i)+x(3)*gv1(i)+x(8)*gb(i)+x(6)*gg(i)+x(7)*gy(i);
T1=x(1)*k+x(2)*e+x(5)*r-x(4)*s+x(9)*ones(87,1);
M1=x(1)*gk+x(2)*ge+x(5)*gr+x(4)*gs2;
Q1=x(4)*s+x(5)*r+x(3)*v+x(8)*b-x(6)*g-x(7)*y+x(10)*ones(87,1);
N1=x(4)*gs1+x(5)*gr+x(3)*gv1+x(8)*gb+x(6)*gg+x(7)*gy;
a=T+1;
b=x(11)-M;
c=x(11)+M;
HL=[a;b];
aa=Q+1;
bb=x(12)-N;
cc=x(12)+N;
dd=x(13);
ff=x(14);
dd1=x(9);
ff1=x(10);
HH=[aa;bb];
f=x(11)+x(12)+x(13)+x(14);
F=[norm(HL,2)<=c,norm(HH,2)<=cc,norm(dd1,2)<=dd,norm(ff1,2)<=ff,T1>=zeros(87,1),Q1>=zeros(87,1),x(1)>=0.00000001,x(2)>=0.00000001,x(3)>=0.00000001,x(4)>=0.00000001,x(5)>=0.00000001,x(6)>=0.00000001,x(7)>=0.00000001,x(8)>=0.00000001,T>=0,M>=0,Q>=0,N>=0,T<=1,M<=1,Q<=1,N<=1];
ops=sdpsettings('solver','mosek');
optimize(F,f,ops)
z1=T/M
z2=Q/N
z3=z1+z2
z1_result=[z1_result;value(z1)']
z2_result=[z2_result;value(z2)']
z3_result=[z3_result;value(z3)']
x_result=[x_result;value(x)]
end
By if I run this code in matlab, I always get a mistake as follows. What can I do to solve this problem?
"Error using sdpvar/subsref (line 161)
Index exceeds matrix dimensions.
Error in pins (line 44)
Q=x(4)*s(i)+x(5)*r(i)+x(3)*v(i)+x(8)*b(i)-x(6)*g(i)-x(7)*y(i)+x(10);"
The data file is also provided here.
ins.zip
Beta Was this translation helpful? Give feedback.
All reactions