clc
clear
close all
%%
Options=gaoptimset(@ga)
Options=gaoptimset(Options,'PlotFcns',@gaplotbestf,'TolFun',1e-12,'TolCon',Inf)
D=100; %/*The number of parameters of the problem to be optimized*/
ub=ones(1,D)*100; %/*lower bounds of the parameters. */
lb=ones(1,D)*(-100);%/*upper bound of the parameters.*/
[x,fval, exitflag]=ga(@fitness,D,[],[],[],[],lb,ub,[],Options)
%% 注释
% Options =
%
% PopulationType: 'doubleVector'
% PopInitRange: []
% PopulationSize: '50 when numberOfVariables <= 5, else 200'
% EliteCount: '0.05*PopulationSize'
% CrossoverFraction: 0.8000
% ParetoFraction: []
% MigrationDirection: 'forward'
% MigrationInterval: 20
% MigrationFraction: 0.2000
% Generations: '100*numberOfVariables'
% TimeLimit: Inf
% FitnessLimit: -Inf
% StallGenLimit: 50
% StallTest: 'averageChange'
% StallTimeLimit: Inf
% TolFun: 1.0000e-20
% TolCon: 1.0000e-20
% InitialPopulation: []
% InitialScores: []
% InitialPenalty: 10
% PenaltyFactor: 100
% PlotInterval: 1
% CreationFcn: @gacreationuniform
% FitnessScalingFcn: @fitscalingrank
% SelectionFcn: @selectionstochunif
% CrossoverFcn: @crossoverscattered
% MutationFcn: {[@mutationgaussian] [1] [1]}
% DistanceMeasureFcn: []
% HybridFcn: []
% Display: 'final'
% PlotFcns: @gaplotbestf
% OutputFcns: []
% Vectorized: 'off'
% UseParallel: 0