Why do i met converged to an infeasible point
3 次查看(过去 30 天)
显示 更早的评论
I have met this problem while doing power flow optimization.
Converged to an infeasible point.
fmincon stopped because the size of the current step is less than
the value of the step size tolerance but constraints are not
satisfied to within the value of the constraint tolerance.
<stopping criteria details>
i tried both sqp and interior point method. they showed similar results. like below
i am not sure how to solve this
codes are provided below.
a=1;
b=1;
c=1;
d=1;
e=1;
f=1;
g=1;
h=1;
function Impedance= Z(R,L,C)
w = 3.141592653589793e+02;
Impedance = R+L*w*j-C*w*j;
end
Z12 = Z(88e-3,130e-6,0);
Z15 = Z(13e-3,280e-6,0);
Z35 = Z(78e-3,50e-3,0);
Z45 = Z(29e-3,467e-6,0);
Z6 = Z(30e-3,147e-6,0);
Y12 = 1/Z12;
Y15 = 1/Z15;
Y35 = 1/Z35;
Y45 = 1/Z45;
Y6 = 1/Z6;
Y = [Y15+Y12 -Y12 0 0 -Y15 0;
-Y12 Y12 0 0 0 0;
0 0 Y35 0 -Y35 0;
0 0 0 Y45 -Y45 0;
-Y15 0 -Y35 -Y45 Y15+Y35+Y45+Y6 -Y6;
0 0 0 0 -Y6 Y6;
];
G = full(real(Y));
B = full(imag(Y));
%% Define Objective Function
fun = @(x) a*x(13)+b*x(13)^2+c*x(14)+d*x(14)^2+e*x(15)+f*x(15)^2+g*x(18)+h*x(18)^2;
%% Set Parameters for fmincon
A = [];
b = [];
Aeq = [];
beq = [];
lb = [0;0;0;0;0;0;
220;220;220;220;220;220;
0;0;0;0;0;0;
-89600;-89600;-89600;0;0;-89600];
ub = [2*pi;2*pi;2*pi;2*pi;2*pi;2*pi;
240;240;240;240;240;240;
89600;89600;89600;0;0;89600;
89600;89600;89600;0;0;89600;
];
%% Define Nonlinear Constraints
nonlcon = @(x)power(x,G,B);
%% Provide Initial Point for fmincon
x0 = zeros(24,1);
%An=x(1:6);
%V=x(7:12);
%P=x(13:18);
%Q=x(19:24);
% x1~6angle, x7~12V, x13~18P,x19~24Q
% V1 V2 V3 V4 V5 V6
%x(7) x(8) x(9) x(10) x(11) x(12)
%% Set Parameters for fmincon and Call fmincon
%options = optimoptions('fmincon','Algorithm','interior-point','OptimalityTolerance',1e-9,'StepTolerance',1e-9,'ConstraintTolerance',1e-9);
options = optimoptions('fmincon','Algorithm','sqp');
[x,fval] = fmincon(@(x)fun(x),x0,A,b,Aeq,beq,lb,ub,nonlcon,options);
function [c,ceq] = power(x,G,B)
w = 3.141592653589793e+02;
PL1 = 24e3;
QL1 = 18e3;
PL2 = 41e3;
QL2 = 28e3;
PL3 = 50e3;
QL3 = 34e3;
PL4 = 44e3;
ceq=[x(7)*(x(11)*(G(1,5)*cos(x(1)-x(5))+w*B(1,5)*sin(x(1)-x(5)))+x(8)*(G(1,2)*cos(x(1)-x(2))+w*B(1,2)*sin(x(1)-x(2))))+PL1-x(13);%P1
x(7)*(x(11)*(G(1,5)*sin(x(1)-x(5))+w*B(1,5)*cos(x(1)-x(5)))+x(8)*(G(1,2)*sin(x(1)-x(2))+w*B(1,2)*cos(x(1)-x(2))))+QL1-x(19);%Q1
x(8)*(x(1)*(G(2,1)*cos(x(2)-x(1))+w*B(2,1)*sin(x(2)-x(1))))+PL2-x(14);%P2
x(8)*(x(1)*(G(2,1)*sin(x(2)-x(1))+w*B(2,1)*cos(x(2)-x(1))))+QL2-x(20);%Q2
x(9)*(x(11)*(G(3,5)*cos(x(3)-x(5))+w*B(3,5)*sin(x(3)-x(5))))+PL3-x(15);%P3
x(9)*(x(11)*(G(3,5)*sin(x(3)-x(5))+w*B(3,5)*cos(x(3)-x(5))))+QL3-x(21);%Q3
x(10)*(x(11)*(G(4,5)*cos(x(4)-x(5))+w*B(4,5)*sin(x(4)-x(5))))+PL4;%P4
x(10)*(x(11)*(G(4,5)*sin(x(4)-x(5))+w*B(4,5)*cos(x(4)-x(5))));%Q4
x(11)*(x(7)*(G(1,5)*cos(x(5)-x(1))+w*B(1,5)*sin(x(5)-x(1)))+x(9)*(G(3,5)*cos(x(5)-x(3))+w*B(3,5)*sin(x(5)-x(3)))+x(10)*(G(4,5)*cos(x(5)-x(4))+w*B(4,5)*sin(x(5)-x(4)))+x(12)*(G(5,6)*cos(x(5)-x(6))+w*B(5,6)*sin(x(5)-x(6))))-x(17);%P5
x(11)*(x(7)*(G(1,5)*sin(x(5)-x(1))+w*B(1,5)*cos(x(5)-x(1)))+x(9)*(G(3,5)*sin(x(5)-x(3))+w*B(3,5)*cos(x(5)-x(3)))+x(10)*(G(4,5)*sin(x(5)-x(4))+w*B(4,5)*cos(x(5)-x(4)))+x(12)*(G(5,6)*sin(x(5)-x(6))+w*B(5,6)*cos(x(5)-x(6))))-x(23);%Q5
x(12)*(x(11)*(G(6,5)*cos(x(6)-x(5))+w*B(6,5)*sin(x(6)-x(5))))-x(18);%P6
x(12)*(x(11)*(G(6,5)*sin(x(4)-x(5))+w*B(6,5)*cos(x(6)-x(5))))-x(24);%Q6
];
c=[];
end
1 个评论
Mitchell Thurston
2024-4-1
I don't know very much about this problem, but my guess is its in your lower bound and upper bounds. For example, the 16th, 17th, 22nd, and 23rd index of the bounds define your parameters to be zero. When I get rid of the bounds, it's able to converge
x = [3.82, 4.79, 3.87, 3.39, 4.96, 4.97, -13.87, -9.59, 984.72, 7.46, 2.86, 4.43, -0.50, -0.50, -0.50, 0.00, -32347.81, -0.50, 63686.87, 0.00, 60053.68, 0.00, 28775.68, 60729.14]'
回答(1 个)
Nipun
2024-4-17
Hi Tsam,
I understand that you are facing an "infeasible point" error while doing power flow optimization using "fmincon" in MATLAB.
"fmincon" is a gradient based solver based on the bounds provided. Upon careful investigation of the given information, I can confirm that the lower bound and upper bounds force the parameters to be zero. I recommend reconsidering the provided bounds to get a feasible point.
Another possible resolution for this problem is using the gradient as "GradObj" in the "fmincon" solver. This can be done by setting the "GradObj" in "optimoptions. For more information on available options for "fmincon" function, refer to the following MathWorks documentation:
You may find the following MATLAB answer useful that addresses dealing with infeasible solutions given the "fmincon" solver:
Hope this helps.
Regards,
Nipun
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!