2""" @brief Run Evolife without any display.
5#============================================================================#
6# EVOLIFE http://evolife.telecom-paris.fr Jean-Louis Dessalles
40 """ Launches Evolife in a non-interactive way.
41 Useful for repetitive simulation to explore parameter space.
44 def __init__(self, SimulationStep, Obs):
45 """ Stores Obs as observer
46 and SimulationStep
as the function that processes one step of the simulation.
47 Creates curves
from Obs
's CurveNames.
52 self.
Curves.Curvenames(Obs.get_info(
'CurveNames'))
59 """ Stops the simulation thread
65 """ (re)starts the simulation thread
72 """ The simulation thread returns the best current phenotype
76 error(
"Evolife_Batch",
"Inexistent buzy mode")
78 if self.
Obs.Visible():
86 """ Retrieves plot orders from observer as a list of (CurveId, Point)
87 and add points to curves accordingly
89 for (CurveId, Point)
in self.
Obs.get_info(
'PlotOrders'):
93 error(
"Evolife_Batch: unknown curve ID")
96 """ Stops the simulation and dumps data into output file
99 x_values_ignored = self.Obs.get_info('ResultOffset')
100 self.
Curves.Curvenames(self.
Obs.get_info(
'CurveNames'))
101 self.
Curves.dump(self.
Obs.get_info(
'ResultFile'), self.
Obs.get_info(
'ResultHeader'), x_values_ignored)
109 """ SimulationStep is a function that performs a simulation step
110 Obs is the observer that stores statistics
112 # No display, batch mode
113 Evolife = Evolife_Batch(SimulationStep, Obs)
114 Evolife.Simulation_launch(True)
117 if os.path.exists(
'stop'):
118 Evolife.Simulation_stop()
120 if not Evolife.simulation.isAlive():
122 Evolife.Destruction()
127__author__ =
'Dessalles'
Stores a list of 'Curves'.
Simulation in batch mode (no vizualisation) #.
def Simulation_stop(self)
Stops the simulation thread.
def Process_graph_orders(self, BestPhenotype)
Retrieves plot orders from observer as a list of (CurveId, Point) and add points to curves accordingl...
def Destruction(self, event=None)
Stops the simulation and dumps data into output file.
def Simulation_launch(self, functioning_mode)
(re)starts the simulation thread
def ReturnFromThread(self, Best)
The simulation thread returns the best current phenotype.
Stores data that can be used to plot curves and stored into a file.
def EvolifeColourID(Colour_designation, default=(4, 'red'))
Recognizes Colour_designation as a number, a name, a (R,V,B) tuple or a #RRVVBB pattern.
def Start(SimulationStep, Obs)
SimulationStep is a function that performs a simulation step Obs is the observer that stores statisti...