Darwin Neuroevolution Framework
Classes | Public Types | Public Member Functions | Public Attributes | Friends | List of all members
darwin::Evolution Class Reference

The controller for running evolution experiments. More...

#include <evolution.h>

Inheritance diagram for darwin::Evolution:
core::NonCopyable pp::Controller darwin::ProgressMonitor

Classes

struct  Snapshot
 State snapshot of an evolution run. More...
 

Public Types

enum  State {
  State::Invalid,
  State::Initializing,
  State::Running,
  State::Pausing,
  State::Paused,
  State::Canceling,
  State::Stopped
}
 Evolution state. More...
 
enum  EventFlag : uint32_t {
  StateChanged = 1 << 0,
  ProgressUpdate = 1 << 1,
  EndGeneration = 1 << 2,
  EndEvolution = 1 << 3,
  NewExperiment = 1 << 4,
  Reset = 1 << 5,
  All = EventFlag(-1)
}
 Event hints (as bit flags) More...
 

Public Member Functions

bool newExperiment (shared_ptr< Experiment > experiment, const EvolutionConfig &config)
 Sets up a new evolution experiment. More...
 
Snapshot snapshot () const
 Captures a Snapshot of the current evolution state.
 
const Experimentexperiment () const
 Accessor to the associted Experiment instance.
 
const EvolutionConfigconfig () const
 Accessor to the associated EvolutionConfig instance.
 
void run ()
 Start/Resume the evolution. More...
 
void pause ()
 Pause the evolution. More...
 
bool reset ()
 Resets the evolution (stops execution and resets the state) More...
 
void waitForState (State target_state) const
 Blocks until the requested state is reached. More...
 

Public Attributes

core::PubSub< uint32_t > events
 Evolution events notifications.
 
core::PubSub< GenerationSummarygeneration_summary
 Channel for publishing generation summaries.
 
core::PubSub< EvolutionStagetop_stages
 Channel for publishing the completition of a generation's top stage.
 

Friends

Evolutionevolution ()
 Accessor to the Evolution singleton instance.
 

Detailed Description

The controller for running evolution experiments.

Member Enumeration Documentation

◆ EventFlag

Event hints (as bit flags)

Enumerator
StateChanged 

The evolution State has changed.

ProgressUpdate 

Progress update notification.

EndGeneration 

Generation end notification.

EndEvolution 

Evolution run completed successfully.

NewExperiment 

New experiment notification.

Reset 

Experiment reset notification.

All 

Combination of all event flags.

◆ State

Evolution state.

Enumerator
Invalid 

Invalid state tag.

Initializing 

Initializing evolution.

Running 

Evolution experiment is running.

Pausing 

Evolution pause requested.

Paused 

Evolution experiment is paused.

Canceling 

Evolution cancel/stop requested.

Stopped 

Evolution experiment was canceled/stopped.

Member Function Documentation

◆ newExperiment()

bool darwin::Evolution::newExperiment ( shared_ptr< Experiment experiment,
const EvolutionConfig config 
)

Sets up a new evolution experiment.

Parameters
experiment- the Experiment model/state
config- evolution runtime settings

◆ pause()

void darwin::Evolution::pause ( )

Pause the evolution.

Note
It just creates a pause request, the actual transition to State::Paused happens asynchroniously (normally when the evolution workers reach a checkpoint)
See also
State

◆ reset()

bool darwin::Evolution::reset ( )

Resets the evolution (stops execution and resets the state)

Note
It just creates a cancelation request, the actual reset happens asynchroniously (normally when the evolution workers reach a checkpoint)
See also
State

◆ run()

void darwin::Evolution::run ( )

Start/Resume the evolution.

See also
State

◆ waitForState()

void darwin::Evolution::waitForState ( Evolution::State  target_state) const

Blocks until the requested state is reached.

See also
State

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