culebra.abc.Solution
class¶
- class Solution(species: Species, fitness_cls: Type[Fitness])¶
Construct a default solution.
- Parameters:
species (
species_cls
) – The species the solution will belong tofitness (Any subclass of
Fitness
) – The solutions’s fitness class
- Raises:
Class attributes¶
Class methods¶
- classmethod Solution.load_pickle(filename: str) Base ¶
Load a pickled object from a file.
- Parameters:
filename (
str
) – The file name.- Raises:
TypeError – If filename is not a valid file name
ValueError – If the filename extension is not
PICKLE_FILE_EXTENSION
Properties¶
Methods¶
- Solution.save_pickle(filename: str) None ¶
Pickle this object and save it to a file.
- Parameters:
filename (
str
) – The file name.- Raises:
TypeError – If filename is not a valid file name
ValueError – If the filename extension is not
PICKLE_FILE_EXTENSION
Dunder methods¶
Intended to compare (lexicographically) two solutions according to their fitness.
- Solution.__hash__() int ¶
Return the hash number for this solution.
The hash number is used for equality comparisons. Currently is implemented as the hash of the solution’s string representation.