- How does the solver choose the number of points to plot? Or
- How does the solver decide to make a 2-D plot?
Number of plots by gaplotpareto
10 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
asaii
am 22 Nov. 2023
Kommentiert: Alan Weiss
am 28 Nov. 2023
How is the number of plots in the graph from this document defined?
x = -10:0.5:10;
f1 = (x+2).^2 - 10;
f2 = (x-2).^2 + 20;
plot(x,f1);
hold on;
plot(x,f2,'r');
grid on;
title('Plot of objectives ''(x+2)^2 - 10'' and ''(x-2)^2 + 20''');
FitnessFunction = @simple_multiobjective;
numberOfVariables = 1;
[x,fval] = gamultiobj(FitnessFunction,numberOfVariables);
size(x)
size(fval)
A = []; b = [];
Aeq = []; beq = [];
lb = -1.5;
ub = 0;
x = gamultiobj(FitnessFunction,numberOfVariables,A,b,Aeq,beq,lb,ub);
options = optimoptions(@gamultiobj,'PlotFcn',{@gaplotpareto,@gaplotscorediversity});
gamultiobj(FitnessFunction,numberOfVariables,[],[],[],[],lb,ub,options);
FitnessFunction = @(x) vectorized_multiobjective(x);
options = optimoptions(@gamultiobj,'UseVectorized',true);
gamultiobj(FitnessFunction,numberOfVariables,[],[],[],[],lb,ub,options);
0 Kommentare
Akzeptierte Antwort
Alan Weiss
am 27 Nov. 2023
If I understand your question, you are asking either
The first question is asking how does the solver work. You can find out be reading the algorithm description: https://www.mathworks.com/help/gads/gamultiobj-algorithm.html
For the second question, the plot function plots one axis for each objective function as long as there are only 2 or 3 objective functions. This problem has two objective functions, so produces a 2-D plot.
If I misunderstood what you were asking, please ask again in more detail.
Alan Weiss
MATLAB mathematical toolbox documentation
2 Kommentare
Alan Weiss
am 28 Nov. 2023
I'm not sure that I understand what you are asking. If you are asking about the number of points plotted, the last line of the algorithm description of iterations says "Trim the extended population to have PopulationSize individuals by retaining the appropriate number of individuals of each rank." In other words, the number of points plotted grows as the process continues until PopulationSize points are plotted, and then the software keeps the number at PopulationSize. I don't know offhand how to programmatically query how many points are plotted; I supose that you could use an output function to do that, but I don't know for sure.
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Genetic Algorithm finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!