QDpy
Loading...
Searching...
No Matches
qdpy.phenotype.Fitness Class Reference
Inheritance diagram for qdpy.phenotype.Fitness:
qdpy.phenotype.Score qdpy.phenotype.FitnessLike qdpy.phenotype.ScoreLike qdpy.phenotype.ScoreLike qdpy.algorithms.sampling.SampledFitness

Public Member Functions

 __setstate__ (self, state)
 Verify that a snapshot stores unweighted objective values.
ScoreValuesLike weighted_values (self, ScoreValuesLike weights)
bool valid (self)
FitnessValuesLike values (self)
Public Member Functions inherited from qdpy.phenotype.Score
bool dominates (self, Any other, Any obj=slice(None), Optional[ScoreValuesLike] weights=None)

Detailed Description

Store raw objectives and their comparison weights.

Supply one weight per objective. Negative weights minimise and
positive weights maximise. A weight of zero ignores its objective
in a weighted comparison. The default is minimisation.

Assigning weights keeps the raw objective values unchanged.
Empty fitness and fitness containing NaN are invalid. Use container
domains to specify which otherwise valid scores may enter an archive.

Definition at line 309 of file phenotype.py.

Member Function Documentation

◆ __setstate__()

qdpy.phenotype.Fitness.__setstate__ ( self,
state )

Verify that a snapshot stores unweighted objective values.

Parameters
stateSerialized fitness attributes with a format marker.
Exceptions
ValueErrorIf the marker is absent or unsupported. An older weighted tuple could otherwise be read as a raw objective.

Definition at line 333 of file phenotype.py.

◆ valid()

bool qdpy.phenotype.Fitness.valid ( self)
Whether the fitness has at least one objective and contains no NaN values.

Reimplemented from qdpy.phenotype.Score.

Definition at line 353 of file phenotype.py.

◆ values()

FitnessValuesLike qdpy.phenotype.Fitness.values ( self)
Objective values before applying weights.

Reimplemented from qdpy.phenotype.Score.

Definition at line 358 of file phenotype.py.

◆ weighted_values()

ScoreValuesLike qdpy.phenotype.Fitness.weighted_values ( self,
ScoreValuesLike weights )
Return one weighted value per objective in the same order.

:param weights: Comparison weights for this calculation.
:raises ValueError: If a nonempty fitness and the weights differ
    in length.

Reimplemented from qdpy.phenotype.Score.

Definition at line 341 of file phenotype.py.


The documentation for this class was generated from the following file: