MATLAB Answers

Converged to an infeasible point.

6 views (last 30 days)
Sarah Kern
Sarah Kern on 20 Jan 2020
Commented: Sarah Kern on 20 Jan 2020
Hello,
can someone help me with this problem?
Thats my optimization problem
if f_lag > 0 % decision braking or driving mode
fun =@(x) (A/SOC_1)*abs(x(1))+(A/SOC_2)*abs(x(2))+(A/SOC_3)*abs(x(3))+(A/SOC_4)*abs(x(4))+d_delay_1-(SW_1+x(5))+d_delay_2-(SW_2+x(6))+d_delay_3-(SW_3+x(7))+d_delay_4-(SW_4+x(8));
else
fun =@(x) ((B*M_reg_1)/SOC_1)*(1/x(1))+((B*M_reg_2)/SOC_2)*(1/x(2))+((B*M_reg_3)/SOC_3)*(1/x(3))+((B*M_reg_4)/SOC_4)*(1/x(4))+d_delay_1-(SW_1+x(5))+d_delay_2-(SW_2+x(6))+d_delay_3-(SW_3+x(7))+d_delay_4-(SW_4+x(8));
end
x0 = [1,1,1,1,1,1,1,1];
A = [];
b = [];
Aeq = [0 0 0 0 1 0 0 0; 0 0 0 0 0 1 0 0; 0 0 0 0 0 0 1 0; 0 0 0 0 0 0 0 1; 0 0 0 0 0 0 0 0; 0 0 0 0 0 0 0 0];
SOC_dif1=SOC_1-(SOC_1+SOC_2+SOC_3+SOC_4);
SOC_dif2=SOC_2-(SOC_1+SOC_2+SOC_3+SOC_4);
SOC_dif3=SOC_3-(SOC_1+SOC_2+SOC_3+SOC_4);
SOC_dif4=SOC_4-(SOC_1+SOC_2+SOC_3+SOC_4);
if f_lag==1
if (SOC_dif1 < 0.15) % state of charge of one actor is really low, actor is only used for steering %during driving mode
%SOC_krit = 0.15
Aeq(6,1) = 1;
end
if (SOC_dif2 < 0.15) % state of charge of one actor is really low, actor is only used for steering %during driving mode
Aeq(6,2) = 1;
end
if (SOC_dif3 < 0.15) % state of charge of one actor is really low, actor is only used for steering %during driving mode
Aeq(6,3) = 1;
end
if (SOC_dif4 < 0.15) % state of charge of one actor is really low, actor is only used for steering %during driving mode
Aeq(6,4) = 1;
end
end
beq = [d_1-SW_1, d_2-SW_2, d_3-SW_3, d_4-SW_4, 0, 0];
if flag > 0 %if it is possible the regenerative braking torque is the limit
if (Fx_v-sum(Fx(i),(1:4)) == 0) && (Fy_v-sum(Fy(i),(1:4)) == 0) && (Mz_v-sum(Mz(i),(1:4)) == 0) %if it is not possible to follow the target trajectory the maximum of the manual braking is used
% max. regenerative braking torque
lb = [-M_reg_1/r_dyn_1, -M_reg_2/r_dyn_2, -M_reg_3/r_dyn_3, -M_reg_4/r_dyn_4, d_min_vl-SW_1, d_min_vr-SW_2, d_min_hl-SW_3, d_min_hr-SW_4]; %d and betato the left side are positive, to the right side are negative %regenerative braking torque must be positive
% mechanical braking
else
lb = [FxB_max, FxB_max, FxB_max, FxB_max, d_min_vl-SW_1, d_min_vr-SW_2, d_min_hl-SW_3, d_min_hr-SW_4]; %d and betato the left side are positive, to the right side are negative %FxB_max is negative
end % close conditions for braking loop, max braking torque is positive
%driving mode
else
lb = [P_min_1, P_min_2, P_min_3, P_min_4, d_min_vl-SW_1, d_min_vr-SW_2, d_min_hl-SW_3, d_min_hr-SW_4];
end
ub = [P_max_1/(r_dyn_1*w_1), P_max_2/(r_dyn_2*w_2), P_max_3/(r_dyn_3*w_3), P_max_4/(r_dyn_4*w_4), d_max_vl-SW_1, d_max_vr-SW_2, d_max_hl-SW_3, d_max_hr-SW_4];
nonlcon = @circlecon;
x = fmincon(fun,x0,A,b,Aeq,beq,lb,ub,nonlcon);
with this following nonlinear constraints
function [c,ceq] = circlecon(x)
coder.extrinsic('ParameterSarah')
ParameterSarah;
ceq =[Fy_v-sin(d_1)*x(1)-cos(d_1)*x(5)*c_w+sin(d_2)*x(2)-cos(d_2)*x(6)*c_w+sin(d_3)*x(3)-cos(d_3)*x(7)*c_w+sin(d_4)*x(4)-cos(d_4)*x(8)*c_w; Mz_v-(-w_vl)*(cos(d_1)*x(1)-sin(d_1)*x(5)*c_w)+w_vr*(cos(d_2)*x(2)-sin(d_2)*x(6)*c_w)-w_hl*(cos(d_3)*x(3)-sin(d_3)*x(7)*c_w)+w_hr*(cos(d_4)*x(4)-sin(d_4)*x(8)*c_w)+l_v*(sin(d_1)*x(1)-cos(d_1)*x(5)*c_w+sin(d_2)*x(2)-cos(d_2)*x(6)*c_w)-l_h*(sin(d_3)*x(3)-cos(d_3)*x(7)*c_w+sin(d_4)*x(4)*c_w-cos(d_4)*x(8)*c_w); Fx_v-(x(1)/cos(d_1))-c_w*sin(d_1)*x(5)+(x(2)/cos(d_2))-c_w*sin(d_2)*x(6)+(x(3)/cos(d_3))-c_w*sin(d_3)*x(7)+(x(4)/cos(d_4))-c_w*sin(d_4)*x(8)];
c = [];
end
but I get the error
Converged to an infeasible point.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>
Can someone help me whats the problem?

  0 Comments

Sign in to comment.

Accepted Answer

Matt J
Matt J on 20 Jan 2020
The initial guess you have chosen
x0 = [1,1,1,1,1,1,1,1];
seems very arbitrary. You should devise an initial guess more likely to be close to expected solution values.
Also, your "nonlinear constraints" look very linear to me. Unless I'm mistaken, all the x(i) appear to be coefficients of sine and cosine terms. You should therefore use the Aeq,beq matrices, not the nonlcon input, to express them.
Finally, the abs(x(i)) expressions in your objective function are non-differentiable and will cause problems if any x(i) near zero are searched. Just impose lower bounds x(i)>=0.

  1 Comment

Sarah Kern
Sarah Kern on 20 Jan 2020
thank you very much!

Sign in to comment.

More Answers (0)

Sign in to answer this question.