Error :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 de

52 Ansichten (letzte 30 Tage)
I want to minimize for wxo by means of fmincon, which can be calculated with a certain equation 'theta'. I have the nonlinear constraints:
function [c,ceq] = simple_constraints(wxo)
vxo=0;
vyo=1;
vzo=1;
wyo=0;
Rb=0.1155; %radius ball [m]
g=9.81;
a=0.83;
ez=0.84;
C1=1/(a+1);
C2=a*Rb/(a+1);
C3=ez;
c = [];
ceq= acos((C1*(vxo^2+vyo^2)+C2*(wyo*vxo-wxo*vyo))/(sqrt((C1*vxo+C2*wyo)^2+(C1*vyo-C2*wxo)^2)*sqrt(vxo^2+vyo^2)))-pi;
end
In which I want theta=acos((C1*....)) = pi. This is captured in the equality constraint as ceq = acos((C1*...))-pi;. I use this for the calculation of fmincon:
clear all;
close all;
clc
vxo=0;
vyo=1;
vzo=1;
wyo=0;
objective = @(wxo) (wxo)^2; %minimize wxo;
% initial guess
x0 = 10;
% variable bounds
lb = [];
ub = [];
% show initial objective
disp(['Initial Objective: ' num2str(objective(x0))])
% linear constraints
A = [];
b = [];
Aeq = [];
beq = [];
Rb=0.1155; %radius ball [m]
g=9.81;
a=0.83;
ez=0.84;
C1=1/(a+1);
C2=a*Rb/(a+1);
C3=ez;
% nonlinear constraints
nonlincon = @simple_constraints;
% optimize with fmincon
%[X,FVAL,EXITFLAG,OUTPUT,LAMBDA,GRAD,HESSIAN]
% = fmincon(FUN,X0,A,B,Aeq,Beq,LB,UB,NONLCON,OPTIONS)
options = optimoptions('fmincon', 'Algorithm','sqp', 'MaxIterations', 1000,'ConstraintTolerance', 1e-2, 'OptimalityTolerance', 1e-6, 'StepTolerance', 1e-12, 'MaxFunctionEvaluations', 5000);
wxo = fmincon(objective,x0,A,b,Aeq,beq,lb,ub,nonlincon,options);
% show final objective
disp(['Final Objective: ' num2str(objective(wxo))])
% print solution
disp('Solution')
disp(['min wx0^2 = ' num2str(wxo)])
But then I get the error:
Initial Objective: 100
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>
Final Objective: 6.9676e-16
Solution
min wx0^2 = -2.6396e-08
I know that theta=pi for wxo=>10.43, and theta=0 for wxo<=10.43, but this isn't what comes out of my fmincon. I have no clue why this error is persisting. Changing the steptolerance didn't help. Can someome help me with this?

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 27 Nov. 2020
Your function is discontinuous and has only two values.
fmincon is only for functions that are continuous in at least the first derivative (and second derivative as well for some of the algorithms.)
fmincon is exploring near the initial point you give, and finding that all of the values are the same, so it cannot figure out which direction to search in. You might think that it is obvious that it should search higher wxo values, but you only gave it one starting point, so equally legitimate would be for it to guess that it needs to search wxo values that are near -1000 .
Do not expect fmincon to deal with discontinuities. Do not expect fmincon to deal with functions that are locally constant.
  2 Kommentare
Isabelle
Isabelle am 29 Nov. 2020
Thank you Walter. Is it possible to give multiple starting points? Changing the algortihm from 'sqp' to 'active-set' did give the answer I was looking for, but I won't use this function anymore.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by