your code has to be improved a lot
First, separate data generation and modelling. As it is now, the code is hard to follow as you mix these things
Then there are several weirdness, for instance you define x_1 on line 213, and then you redefine it on line 217 etc
You're also missing that MATLAB/YALMIP should be vecotrized for readability and efficiency. For instance
constraint1 = [];
for i = 1:54
constraint1 = constraint1 + [x(i,1) - x(i+108,1) >= Pl(i,1)];
end
is simply
constraint1 = [x(1:54,1) - x((1:54)+108,1) >= Pl(1:54,1)];
etc
This
x1 = sdpvar(186,1);%Öмä¾ö²ß±äÁ¿
for j = 1:186
for i = 1:54
x1(j,1) = piGen(j,i)*x(i,1)+x1(j,1);
end
for i = 1:9
x1(j,1) = x1(j,1)+piVP(j,i)*x1(i+162,1);
end
for i = 1:91
x1(j,1) = x1(j,1)-piLoad(j,i)*P_q(i,1);
end
end
looks weird. The resulting expression of x1 going to be an extremely messy expression in high powers of piGen and pVP, and z. Intended?
To speed up definition of norm operators, you can use the low-level cone operator instead
for i = 1:788
constraint17 = constraint17 + [norm(s5(1:2,i)) <= s5(3,i)];
end
is
constraint17 =cone(s5(1:2,:),s5(3,:));