📄 userdefinedparameters.m
字号:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% File: userDefinedParameters.m
%
% Description: Contains all the user-defined eCGA parameters
%
% @return parameters is a cell array with parameter values such as number
% of variables, population size, alphabet cardinalities, selection method,
% parameters for the selection method, replacement method, parameters for
% the replacement method (if any), termination critiera and parameters for
% the termination criteria.
%
% Author: Kumara Sastry
%
% Date: March 2007
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function parameters = userDefinedParameters()
% Number of variables, Change it appropriately for your problem
numVariables = 24;
% Population size. Change it based on the number of decision variables,
% sub-structural complexity, signal-to-noise ratio, error tolerance, and
% substructural scaling.
populationSize = 400;
% Alphabet cardinalities. Change it appropriately for your problem
ranges(1:numVariables) = 2;
% Selection method: Tournament and trucation selection. Available options
% are 1. TOURNAMENT, and 2. TRUNCATION. Default is tournament selection
selectionMethod = 'TOURNAMENT';
if(strcmpi(selectionMethod, 'TRUNCATION'))
% Truncation parameter: Should be in the range (0, 1)
selectionParameter = 0.5;
% Makes sure that the parameter is within the acceptable range.
if(selectionParameter < 0.0 || selectionParameter > 1.0)
selectionParameter = 0.5;
end
else
% Tournament size
selectionParameter = 8;
% Make sure that the population size is a multiple of tournament size
populationSize = populationSize + mod(populationSize,selectionParameter);
end
selection = {selectionMethod, selectionParameter};
% Replacement stragegy: Default is generational replacement. Available
% options are: 1. RTR, 2. ELITIST, and 3. DEFAULT
replacementMethod = 'RTR';
if(strcmpi(replacementMethod,'RTR'))
replacementParameter = min(numVariables, populationSize/10);
end
replacement = {replacementMethod, replacementParameter};
% Convergence critieria parameters
% Maximum number of generations
maxGen = 10;
% Maximum fitness variance tolerated
maxFitVar = 1.0e-5;
%Maximum fitness value desired (e.g., fitness of the optimal solution)
maxFit = numVariables/4;
%Maximum number unique individuals in the converged population
maxPopVar = 1;
% The current implementation can handle more than one termination criteria.
% eCGA run is terminated even if one of the criteria is satisfied.
convergenceCriteria = {'MAXGEN', 'MAXFIT', 'FITVAR', 'POPVAR'};
convergenceParameter = {maxGen, maxFit, maxFitVar, maxPopVar};
convergence = {convergenceCriteria, convergenceParameter};
parameterValues = {numVariables, populationSize, ranges, selection, replacement, convergence};
parameterLabels = {'NumVariables', 'PopulationSize', 'Cardinalities', 'Selection', 'Replacement', 'Convergence'};
parameters = cell2struct(parameterValues, parameterLabels, 2);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -