## Matlab fmincon(function based) optimality issue :: constrained nonlinear optimization

### jisoo jung (view profile)

on 15 Oct 2019
Latest activity Commented on by Matt J

on 16 Oct 2019

### Matt J (view profile)

Hi,
I trying to optimize my problem.
Now i am using matlab fmincon with constrainted problem ('sqp' algorithm).
But , in my case, optimality is very large even though the objective fval is converge (please check img.)
So, when I see the exitflag = -2,2 , just keep trying rerun from final result.
My question is
1.
Why did objective function value is converge, but optimality is so great? I have tried a lot to solve this problem.
2.
Is it ok if I rerun to the last value even if exitflag didn't get 1?
( Ex. reulst is exitflag = -2( Constrint is not satisfied.) --> I try to make optimalityTolerence be small for obtaining exitflag = 1.)
I mean this approach is trick ?
3.
If I don't get an exitflag of 1 through sqp and rerun it doesn't work, is this a good approach to get the result using a nonderivative method instead of the sqp algorithm?
(Ex. pattern search )
the below fig is exitflag = 2 situation.
My solver option is
options = optimoptions('fmincon',...
'StepTolerance',1e-20,'Display','iter',...
'Algorithm','sqp','Display','iter', 'MaxFunEvals',1e4,'MaxIter',1e4,...
'FiniteDifferenceType','central','ConstraintTolerance',1.0e-3); % 'FiniteDifferenceStepSize',1e-2, , 'ScaleProblem','obj-and-constr' 'FiniteDifferenceType','central',
ConstraintTolerance is adjusted whenver the exitflag isnot 1. 1,1 = x axis : iter , y axixs :current Variable value --> 6 variable
1,2 = (x axis : iter , y axis : function value)
2,1 = x axis: iter ,y axis : optimality
2,2 = x axis : iter , y axis : constraint violate

on 15 Oct 2019
Edited by Matt J

### Matt J (view profile)

on 15 Oct 2019

But , in my case, optimality is very large even though the objective fval is converge (please check img.)
Your plots are uninterpretable to many in the forum (and definitely to me), because they are not labelled in English. A few thoughts I can offer, however:
(1) It may be that fval is converging, but it is converging to something non-optimal. That could explain why the optimality measure is large, and is especially likely if fmincon is telling you that it cannot find even a feasible point.
(2) It is important to keep in mind that the optimality measure is not a normalized quantity and therefore you often can't be sure what to consider "very large" or "very small". For example, the point x0=1e-6 is quite close to the minima of both these functions: f(x)=x.^2 and g(x)=1e20*x^2. However, the gradients and the value of g(x0) are quite a bit larger than for f(x0).
Is it ok if I rerun to the last value even if exitflag didn't get 1?
I wouldn't have a lot of faith in it. It would be better to pursue improved initial guess strategies. If it is very hard to devise a good initial guess, it often means that the problem is infeasible and there is just no point trying to solve it.
If I don't get an exitflag of 1 through sqp and rerun it doesn't work, is this a good approach to get the result using a nonderivative method instead of the sqp algorithm?
Questions like that are not answerable without seeing the objective function and constraints.

Show 1 older comment
Matt J

### Matt J (view profile)

on 15 Oct 2019
and If i rerun from the above result( = thus the init value is changed ), I also obtain some value. and do it again. is it different from what you are saying ?
No, I am saying you should find a way to initialize so that it finds a feasible solution and converges in the first attempt. How are you choosing your very first initial point?
jisoo jung

### jisoo jung (view profile)

on 16 Oct 2019
I just try any value & and I can find some init value with satisfied constraint.
Is there any method to find init value ?
and in that how can i proof my solution is global?
In my case, I try to show the same convergence at differenct init valu.e
Matt J

### Matt J (view profile)

on 16 Oct 2019
We have to see the optimization problem to answer these questions.