DEAP / deap

Distributed Evolutionary Algorithms in Python
http://deap.readthedocs.org/
GNU Lesser General Public License v3.0
5.84k stars 1.13k forks source link

NSGA-2 example: why "FitnessMin" and not "FitnessMulti" ? #249

Closed SvennoNito closed 6 years ago

SvennoNito commented 6 years ago

Hey there, I'm trying to implement an NSGA-II genetic algorithm using your toolbox - I'm so happy it exists, it makes things so much easier! I'm a bit confused of the fitness creator. In the NSGA-2 example, FitnessMin is used, though it should be a multi-objective problem. There is the option to use FitnessMulti - if it is not used in the NSGA-II algorithm, what is this option there for then? Only if I have a minimizing AND a maximizing objective at the same time? What happens though, if I use creator.create("FitnessMulti", base.Fitness, weights=(-1.0, -1.0)) instead of creator.create("FitnessMin", base.Fitness, weights=(-1.0, -1.0))?

Im reffering to line 31 in your example provided.

fmder commented 6 years ago

The string given to create is just the name of the new class that inherits from base.Fitness. Thus, you could just name the new class FooBar if you want it would not make any difference :) That's the beauty of creating classes at runtime!