フィルターのクリア

How to give function tolerance value, crowding distance function, selection function in custom made function using gaoptimset?

3 ビュー (過去 30 日間)
I have prepared custom made creation, mution and crossover function. And this code calls them for gamultiobj solver, with options set using gaoptimset as shown in code. I wish to confirm that this is the right way to initialize the tournament selection type, genotype distance crowding, and tolerance value as 0.003 as shown in code, and that the code is actually using these values and not bypassing or ignoring it with any default values. I am new to this, hence asking here.
Also how to initialize intial population solutions, if i have a matrix? Can anyone please tell how to do that in code?
fitnessFunction = @new; % Function handle to the fitness function
numberOfVariables = 80; % Number of decision variables
populationSize = 200; stallGenLimit =550; generations = 20000;
% Bound Constraints
lb = [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11]; % Lower bound
ub = [13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13]; % Upper bound
Bound = [lb; ub];
options = gaoptimset('PopulationSize',populationSize,...
'CreationFcn', @int_pop,...
'MutationFcn', @int_mutation,...
'CrossoverFcn',@int_crossoverarithmetic,...
'StallGenLimit', stallGenLimit, 'SelectionFcn',@selectiontournament ...
,'Generations', generations,...
'PopulationSize',populationSize,...
'PopInitRange', Bound, 'PlotFcn',{@gaplotpareto,@gaplotdistance});
options.DistanceMeasureFcn = {@distancecrowding,'phenotype'};
options = gaoptimset(options,'ParetoFraction',0.3);
%options.InitialPopulationMatrix={J};
options.FunctionTolerance= {0.003}; %is this correct way to change function tolerance value?
%options.nonlcon={@mycon}; %Non linear constraint file
[x1, f1, exitflag1, output1, population1, score1] = gamultiobj(fitnessFunction,...
numberOfVariables, [],[], [], [], lb, ub,@consnew,options);

回答 (1 件)

Ameer Hamza
Ameer Hamza 2020 年 5 月 3 日
Everything looks fine. However, note that the FunctionTolerance is the difference between the value of two consecutive iterations, not the absolute value of the function. So consider this factor when deciding its value.
To generate the matrix for the initial population, It should have these dimensions PopulationSize*numberOfVariables. So you can create it according to your choice while keeping the same dimensions. For example, a uniformly distributed random matrix
options.InitialPopulationMatrix = rand(populationSize, numberOfVariables)
  2 件のコメント
Aryan Agarwal
Aryan Agarwal 2020 年 5 月 4 日
Thanks for the reply! I have one more question related to this, that i had asked separately on MATLAB answers. Can you please have a look at it as well and suggest any solution? Thanks a lot for your help! Link to the other question:
https://in.mathworks.com/matlabcentral/answers/522704-how-to-change-mutation-probability-in-this-custom-mutation-function-of-gamultiobj
Ameer Hamza
Ameer Hamza 2020 年 5 月 4 日
That problem is related to the implementation of the genetic algorithm. I never had a chance to study it in detail, so I don't have much idea about implementing mutation and crossover functions.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeGenetic Algorithm についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by