MATLAB Answers

gaplotpareto for 3 objective functions

41 views (last 30 days)
Ehsan
Ehsan on 11 Feb 2013
is it possible to generate pareto front for 3 objective functions using GAPLOTPARETO in MATLAB? what about drawing first and third objective function pareto front instead of the 2 first objectives by using GAPLOTPARETO?

  1 Comment

Max
Max on 13 Feb 2013
I'm asking myself that same question. When looking at gaplotpareto, it's obvious, that the function is capable of producing 3D plots when treating an optimization problem of equivalent order, since the 'plot3' function and a variable called 'plot3d' appear inside the code.
However, the first comment line of the function says "GAPLOTPARETO Plots a Pareto front for first two objectives."
Maybe someone else can clarify this. Thanks!

Sign in to comment.

Answers (1)

Alan Weiss
Alan Weiss on 13 Feb 2013
Edited: Alan Weiss on 13 Feb 2013
Without guaranteeing anything, I think you can plot any two objectives using the syntax
objectivesToPlot = [1,3]; % or whatever two objectives you want
plotfn = @(options,state,flag)gaplotpareto(options,state,flag,objectivesToPlot);
options = gaoptimset('PlotFcns',plotfn);
For three objective functions in a 3-D plot, try setting
objectivesToPlot = [2 4 7]; % or whatever you want
Please let me know if it works for you. If so, maybe I should document it.
Alan Weiss
MATLAB mathematical toolbox documentation

  3 Comments

Max
Max on 14 Feb 2013
Thanks for your answer. Your suggestion does the trick for me. My actual problem was that I couldn't figure out how to set
objectivesToPlot
correctly and hand it over to the plot function.
I think that adding an according section to the documentation of this function might be helpful to others as well.
EDIT: I've been using a version of
gaplotpareto
that I modified to produce a plot that fits my needs. It works well for axes labels and so on but I can't seem to set
hold on
for some reason. Does this have to do with the nature of the genetic algorithm repeatedly producing new populations (i.e. points to plot)? What I would like is all points from all generations being displayed so I get more of a pareto 'front' rather than a few scattered points.
Alan Weiss
Alan Weiss on 14 Feb 2013
I think that the code for gaplotpareto overwrites previous points on purpose. As the optimization progresses, the front may change, and you wouldn't want the old points anymore because they might not be on the front.
If you want more points on the front, use a larger population. Set the PopulationSize option to something larger (but be aware that this can slow the algorithm).
If you believe I have answered your questions helpfully, please accept my answer.
Alan Weiss
MATLAB mathematical toolbox documentation
Max
Max on 14 Feb 2013
I figured out that increasing the population size would effectively lead to more of a 'front'. Thanks again.

Sign in to comment.