class EAHistory(fitness_calculator, log_file, progress_dump, database_dump, dump_attrs)

Bases: object

Deals with logging the EA’s history.

fitness_calculator

The FitnessCalculator used to calculate fitness values.

Type

FitnessCalculator

progress_dump

Toggles dumping of progress.

Type

bool

database_dump

Toggles dumping of dp_pop.

Type

bool

progress

A population where each subpopulation is a generation of the EA.

Type

EAPopulation

db_pop

A population which holds every molecule made by the EA.

Type

EAPopulation or NoneType

dump_attrs

The names of attributes of the molecule to be added to the JSON.

Type

list of str, optional

Methods

db(self, mols)

Adds mols to db_pop.

dump(self)

Creates output files for the EA run.

log_pop(self, logger, pop)

Writes pop to logger at level INFO.

log_file_content

pop_log_content

__init__(self, fitness_calculator, log_file, progress_dump, database_dump, dump_attrs)

Initialize self. See help(type(self)) for accurate signature.

db(self, mols)

Adds mols to db_pop.

Only molecules not already present are added.

Parameters

mols (EAPopulation) – A group of molecules made by the EA.

Returns

None

Return type

NoneType

dump(self)

Creates output files for the EA run.

The following files are created:

progress.log

This file holds the progress of the EA in text form. Each generation is reprented by the names of the molecules and their key.

progress.json

A population dump file holding progress. Only made if progress_dump is True.

database.json

A population dump file holding every molecule made by the EA. Only made if db_pop is not None.

static log_file_content(progress)
log_pop(self, logger, pop)

Writes pop to logger at level INFO.

Parameters
  • logger (Logger) – The logger object recording the EA.

  • pop (EAPopulation) – A population which is to be added to the log.

Returns

None

Return type

NoneType

pop_log_content(self, pop, underline, fitness_values)
ea_run(filename, input_file)

Runs the EA.