Molecule Record
- class MoleculeRecord(topology_graph)[source]
Bases:
object
An abstract base class for molecular records used by the EA.
Notes
You might notice that the public methods of this abstract base class are implemented. This is a default implementation provided purely for convenience. Subclasses can freely ignore or override this implementation.
Methods
clone
()Return a clone.
get_fitness_value
([normalized])Get the fitness value of the molecule in the record.
Get the molecule held by the record.
Get the topology graph of the molecule.
with_fitness_value
(fitness_value[, normalized])Return a clone holding a different fitness value.
- __init__(topology_graph)[source]
Initialize a
MoleculeRecord
instance.- Parameters
topology_graph (
TopologyGraph
) – The topology graph of aConstructedMolecule
.
- clone()[source]
Return a clone.
- Returns
The clone. Has the same type as the original record.
- Return type
- get_fitness_value(normalized=True)[source]
Get the fitness value of the molecule in the record.
- Parameters
normalized (
bool
, optional) – Toggles the return of the normalized vs unnormalized fitness value. The unnormalized fitness value is guaranteed to be constant for the same molecule across generations, while the normalized one is allowed to change.- Returns
object
– The fitness value.None (
NoneType
) – If a fitness value has not been assigned to the record.
- get_molecule()[source]
Get the molecule held by the record.
- Returns
The molecule held by the record.
- Return type
- get_topology_graph()[source]
Get the topology graph of the molecule.
- Returns
The topology graph.
- Return type