用NSGA-II 做简单多目标优化实例,出现—输入参数的数目不足—。
14 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
真人百家家乐app下载【gb2032 .com】
le 14 Oct 2022
Réponse apportée : 真人百家家乐网址【359663.tv】
le 14 Oct 2022
小白,用NSGA-II 做简单多目标优化实例。在网上找了个例子(附图),一步一步来。出现 (输入参数的数目不足)问题?请大佬帮忙解答下,感谢。网上例子用R2009a,windows7,我用R2016a,windows7。
function [ y1,y2 ] =my_target( a,b )
%UNTITLED 此处显示有关此函数的摘要
% 此处显示详细说明
y1=a^4-10.*(a^2)+a.*b+b^4-(a^2).*(b^2)
y2=b^4-(a^2).*(b^2)+a^4+a.*b;
主程序
clear
clc
fitnessfcn = @my_target; % Function handle to the fitness funct ion
nvars = 2; % Number of decision variables
lb = [-5,-5]; % Lower bound
ub = [5, 5];
A= []; b= []; % No linear inequality constraints
Aeq= []; beq= []; % No linear equality constraints
options = gaoptimset ('ParetoFraction',0.3,'PopulationSize ',100,'Generations',200,'StallGenLimit',200,'TolFun',le-100,'PlotFcns',@gaplotpareto);
[x, fval]=gamultiobj(fitnessfcn,nvars, A, b, Aeq, beq, lb, ub, options);
出现问题的语句——
options = gaoptimset ('ParetoFraction',0.3,'PopulationSize ',100,'Generations',200,'StallGenLimit',200,'TolFun',le-100,'PlotFcns',@gaplotpareto);
—出现错误,提示输入参数的数目不足。
0 commentaires
Réponse acceptée
真人百家家乐网址【359663.tv】
le 14 Oct 2022
改成
clear;clc;close all;
nvars = 2; % Number of decision variables
lb = [-5,-5]; % Lower bound
ub = [5, 5];
A= []; b= []; % No linear inequality constraints
Aeq= []; beq= []; % No linear equality constraints
my_target = @(x) [x(1).^4 - 10.*x(1).^2 + x(1).*x(2) + x(2).^4 - x(1).^2.*x(2).^2;
x(2).^4 - x(1).^2.*x(2).^2 + x(1).^4 + x(1).*x(2)];
options = optimoptions('gamultiobj','ParetoFraction',0.3,...
'PopulationSize',100,'Generations',200,'StallGenLimit',200,...
'TolFun',1e-100,'PlotFcn',@gaplotpareto);
[x, fval] = gamultiobj(my_target, nvars, A, b, Aeq, beq, lb, ub, options );
'PopulationSize ',100,
你的代码这里PopulationSize后面多了一个空格,导致无法识别参数
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur 求解器输出和迭代输出 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!