Skip to content

Add metaclass MetaFitness in base. #77

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

cmd-ntrf
Copy link
Member

@cmd-ntrf cmd-ntrf commented May 5, 2015

The metaclass verifies that weights are provided at Fitness class creation and that they are a sequence. We should probably add a verification that weights are actually a sequence of numbers too.

This check was in Fitness init before, so it was ran every time a new fitness instance was created. With MetaFitness, the check is done only at class creation and fail earlier if it has to fail, avoiding tedious debugging.

This could be added in 1.1.0 as it should not break the API, but metaclasses could also be seen as the main point of 2.0. The following paragraphs can only be considered for 2.0 however.

This commit also makes DEAP base Fitness class a mono-objective maximization fitness. This simplifies MetaFitness check as it would fail otherwise when defining base.Fitness and it also means that user won't have to define a fitness for basic problems.

This is just the beginning as this class could be used to avoid having to provides a sequence for mono-objective fitness. It could also be used to define an alternative dominance strategy to Pareto dominance. Instead of defining a dominates method and comparisons operators (>,<,<=,...), we could only define comparisons operators that uses the defined dominance strategy (Pareto, lexicographic, etc.). The keyword 'dominance' would be required at Fitness class creation only if there is more than one values in the weights sequence.

@cmd-ntrf cmd-ntrf self-assigned this May 5, 2015
The metaclass verifies that weights are provided
at class creation and that they are a sequence.
We should probably add a verification that weights
are actually a sequence of numbers.

This commit also makes DEAP base Fitness class
a mono-objective maximization fitness. This
simplifies MetaFitness check as it would fail
otherwise when defining base.Fitness and it
also means that user won't have to define a
fitness for basic problems.

This is just the beginning as this class could be
used to avoid having to provides a sequence for
mono-objective fitness. It could also be used to
defined an alternative dominance strategy to Pareto
dominance.
@cmd-ntrf cmd-ntrf added this to the 2.0 milestone May 5, 2015
@bje-
Copy link
Contributor

bje- commented Jul 14, 2023

Is it possible that we might be able to get this merged after 8 years, please?

@fmder
Copy link
Member

fmder commented Jul 15, 2023 via email

@bje-
Copy link
Contributor

bje- commented Jul 15, 2023

I understand, i stopped when i realized the amount of documentation that would need to be changed

Sorry, wrong PR. I meant #76

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants