how to plot objective function with variables
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (1)
Alan Weiss
le 22 Août 2019
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 commentaires
Voir également
Catégories
En savoir plus sur Surrogate Optimization dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!