Closed abhinavgaur closed 8 years ago
1) This is a mistake on my part. In the PopulationCollector
, it needs to create a copy of the solution. Otherwise, the rank and crowding attributes are being changed as that solution is being non-dominated sorted in later generations. Update the collect(...)
method as follows:
@Override
public void collect(Accumulator accumulator) {
ArrayList<Solution> list = new ArrayList<Solution>();
Population population = algorithm.getPopulation();
for (Solution solution : population) {
list.add(solution.deepCopy());
}
accumulator.add("Population", list);
}
2) The NaN is occurring because the rank 2 front contains 3 identical solutions. This is handled the same way as Deb's NSGA-II code (in crowddist.c
). One question would be: why are there 3 identical solutions? I would guess that "selection with replacement" combined with the small population size (11) is causing this loss of diversity. Using "selection without replacement" would probably help prevent this.
However, having said that, statistical tests on this problem still show the results are statistically indifferent between the two versions:
Problem problem = new metalCutting2();
Executor executor = new Executor()
.withProblem(problem)
.withProperty("populationSize", 11)
.withMaxEvaluations(10000);
Analyzer analyzer = new Analyzer()
.withProblem(problem)
.includeHypervolume()
.includeInvertedGenerationalDistance()
.includeGenerationalDistance()
.showStatisticalSignificance();
analyzer.addAll("NSGA-II with Replacement", executor.withAlgorithm("NSGA-II").withProperty("withReplacement", true).runSeeds(50));
analyzer.addAll("NSGA-II without Replacement", executor.withAlgorithm("NSGA-II").withProperty("withReplacement", false).runSeeds(50));
analyzer.printAnalysis();
NSGA-II with Replacement:
Hypervolume:
Min: 0.31609412727099256
Median: 0.5143054665632678
Max: 0.5576830030460866
Count: 50
Indifferent: [NSGA-II without Replacement]
GenerationalDistance:
Min: 0.005328191697079058
Median: 0.017774346994537088
Max: 0.07186860178192847
Count: 50
Indifferent: [NSGA-II without Replacement]
InvertedGenerationalDistance:
Min: 0.047127207176900755
Median: 0.0726838689641357
Max: 0.22349802834565763
Count: 50
Indifferent: [NSGA-II without Replacement]
NSGA-II without Replacement:
Hypervolume:
Min: 0.21978558841920523
Median: 0.5141349504256087
Max: 0.5484263066200257
Count: 50
Indifferent: [NSGA-II with Replacement]
GenerationalDistance:
Min: 0.01055840214749359
Median: 0.018784205080687615
Max: 0.1085387029456017
Count: 50
Indifferent: [NSGA-II with Replacement]
InvertedGenerationalDistance:
Min: 0.04785901371042905
Median: 0.07415195967628987
Max: 0.337843383915133
Count: 50
Indifferent: [NSGA-II with Replacement]
Hi David,
I updated the previous question after initial posting. Can you also answer the Question-3 that I have put there regarding NFE
attribute of Accumulator
class?
Thanks
Absolutely. Since the population size is odd (11) and the crossover operator (SBX) takes two parents and produces two offspring, it ends up producing 12 offspring every generation. Thus, the NFE counts you see are:
11 - Random initialization produces 11 solutions
11+12=23 - First generation with 12 offspring
23+12=35 - Second generation with 12 offspring
Thanks David. All the above replies make perfect sense.
Hello David,
I am trying out this bi-objective problem. Based on an earlier code that you shared to collect all population of all generations, I wrote this script that additionally prints ConstraintViolation, Rank and Crowding Distance. The script prints out the Variables, Objectives, Constraints, ConstraintViolation, Rank and CrowdingDistance for each individual of a population and for all generations/FuncEvaluations.
The following is the output for a run.
As you can see in the image, I have three issues.
1) There is no Rank zero individual in the initial population and 1st Generation population. 2) In the second generation,
Crowding Distance
for one of the individuals is evaluated asNaN
. 3) The NFE (# of function evalutations) attribute ofaccumulator
should increase as 11,22,33. Why does it show 11,23,35?Can you tell me what I may be doing wrong here?
Thanks