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

조회 수: 1 (최근 30일)
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?

채택된 답변

Alan Weiss
Alan Weiss 2021년 4월 22일
You didn't pass the options to fmincon.
[x,fval,exitflag,output]= fmincon(FUN,xo,[],[],[],[],[],[],[],OPTIONS);
Alan Weiss
MATLAB mathematical toolbox documentation
  댓글 수: 8
Walter Roberson
Walter Roberson 2021년 4월 22일
I will not be at my desk for several hours; I answered the part that I knew from memory.
Sadiq Akbar
Sadiq Akbar 2021년 4월 22일
Ok thanks to both of you dear Alas Weiss and Walter Roberson.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Solver Outputs and Iterative Display에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by