- 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
7 views (last 30 days)
Show older comments
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 Comments
Accepted Answer
Alan Weiss
on 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 Comments
Alan Weiss
on 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
More Answers (0)
See Also
Categories
Find more on Genetic Algorithm 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!