Why each time algorithm "interior point" is shown in output even if I use different algorithm?

My fitness function is as below:
function out=myfitness(b)
u = [1 2 3 4];
out1 = u-b;
out = sum(out1.^2,2);
end
When I use the following code
clear all
clc
FUN = @myfitness;
%OPTIONS =optimoptions('fmincon','Algorithm','sqp'); % For SQP
%OPTIONS =optimoptions('fmincon','Algorithm','sqp-legacy'); % For SQP-Legacy
%OPTIONS =optimoptions('fmincon','Algorithm','trust-region-reflective'); % For Trust-region reflective
OPTIONS =optimoptions('fmincon','Algorithm','active-set'); % For Active Set
xo = [pi/2 pi/2 pi/2 pi/2]; % Starting point
%[x,fval] = patternsearch(ObjectiveFunction,x0); % For patternsearch
[x,fval,exitflag,output]= fmincon(FUN,xo);
It gives me my result. But when I check output variable "output", I see that each time "interior-point" is written in the algorithm inspite of the fact I use active-set or sqp or sqp-legacy i.e.,
output =
struct with fields:
iterations: 2
funcCount: 15
constrviolation: 0
stepsize: 2.9075
algorithm: 'interior-point'
firstorderopt: 3.9890e-08
cgiterations: 0
message: 'Local minimum found that satisfies the constra…'
Why it is so?

 Accepted Answer

You didn't pass the options to fmincon.
[x,fval,exitflag,output]= fmincon(FUN,xo,[],[],[],[],[],[],[],OPTIONS);
Alan Weiss
MATLAB mathematical toolbox documentation

8 Comments

Thank you very much dear Alan Weiss for your guidance. Yes, you are right. Now it works. Thank you very much once again. But now there is a problem. it gives error when I un-comment the following:
OPTIONS =optimoptions('fmincon','Algorithm','trust-region-reflective'); % For Trust-region reflective
and it works for all other options. So what to do now?
The 'trust-region-reflective' algorithm requires you to provide a gradient in the objective function. For details, see Including Gradients and Hessians. For an example, see Include Gradient.
Alan Weiss
MATLAB mathematical toolbox documentation
Thanks for your guidance dear Alan Weiss. Last two questions.
  1. Each time when run the code, about the following message is displayed in command window:
Local minimum found that satisfies the constraints.
Optimization completed because the objective function is non-decreasing in
feasible directions, to within the default value of the optimality tolerance,
and constraints are satisfied to within the default value of the constraint tolerance.
<stopping criteria details>
Can we suppress this message from displaying each time?
2.Can I change the default tolerance and set it to my desired value in options? if yes, then how?
For more details on options and tolerances, see Set Options. In particular, see Set and Change Options and Options in Common Use: Tuning and Troubleshooting.
Alan Weiss
MATLAB mathematical toolbox documentation
Thanks dear Walter Roberson. Yes, you are right. It works. But what about the 2nd question?
I will not be at my desk for several hours; I answered the part that I knew from memory.
Ok thanks to both of you dear Alas Weiss and Walter Roberson.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!