用NSGA-II 做简单多目标优化实例,出现—输入参数的数目不足—。
Show older comments
小白,用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);
—出现错误,提示输入参数的数目不足。

Accepted Answer
More Answers (0)
Categories
Find more on Structural Mechanics in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!