how to plot objective function with variables
조회 수: 3 (최근 30일)
이전 댓글 표시
xo=[0.0011,0.0049,0.3]; % assumptions
%[Q]=heatload1_new(xo)
%nvars=3;
A=[];
b=[];
Aeq=[];
beq=[];
lb=[0.001,0.002,0.01]; %lower bound
ub=[0.01,0.08,0.5]; %upper bound
nonlincon = @(x)constraint_new(x); % calling constraint function
Fitnessfun = @(x)weight_testvariable(x); %calling objective function
options = optimoptions(@fmincon,'Display','iter-detailed','Algorithm','sqp','MaxIterations',1500)
options = optimset('Display','iter','TolFun',1e-5)
[X,fval]=fmincon(Fitnessfun,xo,[],[],[],[],lb,ub,nonlincon,options)
댓글 수: 0
답변 (1개)
Alan Weiss
2019년 8월 22일
You have two definitions of options, meaning the first definition does nothing:
options = optimoptions(@fmincon,'Display','iter-detailed','Algorithm','sqp','MaxIterations',1500) % gets overwritten
options = optimset('Display','iter','TolFun',1e-5)
If you want to plot the objective function value as the optimization runs, set the PlotFcn argument to 'optimplotfval'. If you also want to plot the current point at the same time, set the PlotFcn argument to a cell array, {@optimplotfval,@optimplotx}.
Alan Weiss
MATLAB mathematical toolbox documentation
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Surrogate Optimization에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!