NSGA-II icon indicating copy to clipboard operation
NSGA-II copied to clipboard

Question on the Pareto Front

Open sgirardin opened this issue 4 years ago • 2 comments

Hi @onclave,

I've got a question on how you generate the Pareto front diagram. It seems the last child generation is used to generate the Pareto Front diagram. But as I understand it, the Pareto front should be composed of "optimal" solutions that dominate all the others on at least one axis. (This video explains well how I see it: https://www.youtube.com/watch?v=SL-u_7hIqjA&).

Is there an option that I didn't see? Did you understand it differently? Thanks for your answer. Simon

sgirardin avatar Jun 06 '20 06:06 sgirardin

@sgirardin

Yes, the last child population is taken as the Pareto Front here. Since each population is a collection of probable solution set, being optimized at each generation, it is intuitive that the child population of the last generation should contain the most optimized collection of solution sets along with other solution sets.

Now, what is different in this package is that the NSGA2.run() method returns you the last child population. Since choosing the optimal solution set from the list of solution sets is always problem dependent, the package leaves it up to you to choose which solution set is best for you from the last child population. If the last child population has, say, 100 solution sets, the NSGA2.run() method shall return you this population and leave it up to you to choose your required solution set (aka. Chromosome) from here.

About the plotting; by default what this package really does is take the last child population and consider each solution to be part of the Pareto Front and plots it for you. This is just left as a PoC and I have really not given much thought into it since this part is really problem dependent. What you can do from here is take the last child population, extract all the rank 1 solutions (maybe? or something else) and consider them to be the Pareto Front.

To create a graph plot out of this, you can use the Reporter.plot2DPopulation(Population population, String key, List<AbstractObjectiveFunction> objectives) method. Create a new population by passing it a list of Chromosomes with rank 1, pass this population, a unique key identifier and your list of objectives to plot2DPopulation() and it'd provide you with your required graph plot.

One more thing to note here, since you linked the YouTube video, kindly note that, in that video, the domination logic has been used for objectives as minimization function, meaning the objectives there has been minimized.

A(x1|y1) dominates B(x2|y2) when: (x1 <= x2 and y1 <= y2) and (x1 < x2 or y1 < y2)

But in my package, I've considered objective maximization, hence the opposite of the above. So whenever you are defining objectives, consider objective maximization.

onclave avatar Jun 07 '20 07:06 onclave

Hey. I know I'm a few years late, but OP is right.

It's a relatively simple fix to plot only pareto optimal points. Just take only rank 1 chromosomes.

To make the line plot behave correctly, sort descending on the Y axis and ascending on the X axis.

gravityfox avatar Dec 17 '23 04:12 gravityfox