Class EvoLudo
- All Implemented Interfaces:
MersenneTwister.Chronometer,CLOProvider
- Direct Known Subclasses:
EvoLudoGWT
EvoLudoJRE and GWT specific code to
EvoLudoGWT. Two distinct
implementations are required e.g. because of significant differences in
input/output routines.- Author:
- Christoph Hauert
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumColoring methods for multiple continuous traits.static interfaceThe interface to execute commands in a manner that is agnostic to the implementation details regarding GWT or JRE environments. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ModelThe active modelprotected ModuleThe active module.protected Set<ChangeListener> List of change listeners that get notified when the model changes.protected StringThe command line options (raw string provided in URL, HTML tag, TextArea or command line)final CLOptionCommand line option to set the delay between subsequent updates.final CLOptionCommand line option to print help message for available command line options.final CLOptionCommand line option to set the type of model (seeType).final CLOptionCommand line option to set module.final CLOptionCommand line option to perform test of random number generator on launch.final CLOptionCommand line option to request that the EvoLudo model immediately starts running after loading.final CLOptionCommand line option to set seed of random number generator.final CLOptionCommand line option to set color scheme for coloring continuous traits.final CLOptionCommand line option to set the color for trajectories.final CLOptionCommand line option to set verbosity level of logging.protected EvoLudo.ColorModelTypeThe coloring method type.static final StringThe copyright string.(package private) doubleStarting time of CPU sampling (negative if not sampling).(package private) doubleMean time of CPU sampling.(package private) intNumber of CPU time samples(package private) doubleVariance of time of CPU sampling.protected intDelay between subsequent updates in milliseconds when model is running.private static final doubleDelay decrement for speed sliderSliderstatic final doubleInitial delay between subsequent updates for speed sliderSliderstatic final doubleMaximum delay between subsequent updates for speed sliderSliderstatic final doubleMinimum delay between subsequent updates for speed sliderSliderprivate booleanFlag to indicate if a backstep is in progress.booleanThe flag to indicate whether the current device/program supports touch eventsfinal intUniqueIDof EvoLudo instance.private static intThe loggers of each EvoLudo lab instance need to have unique names to keep the logs separate.static booleanThe flag to indicate whether EvoLudo is running in a web browser (or ePub) using javascript generated by GWT or in the java JRE.protected booleanThe flag to indicate whether the active model is running.protected booleanThe flag to indicate whether running of the model is suspended.protected LoggerThe logger for keeping track of and reporting events and issues.protected Set<MilestoneListener> List of engine listeners that get notified when the state of the population changed, for example after population reset or completed an update step.The lookup table for all available modules.protected CLOParserThe parser for command line options.protected ChangeListener.PendingActionThe action that is pending (if any).private booleanThe flag to indicate whether the module reqiuires a full reparsing of the command line options.private booleanThe flag to indicate whether a reset of the active model has been requested.protected RNGDistributionThe shared random number generator to ensure reproducibility of results.protected inttimeout for layout process of snapshots in msec. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddChangeListener(ChangeListener newListener) Add a change listener to the list of listeners that get notified when the model changes.voidaddCLOProvider(CLOProvider provider) Registercloas a provider of command line options.voidaddMilestoneListener(MilestoneListener newListener) Add a milestone listener to the list of listeners that get notified when the model reaches milestones.voidAddmoduleto lookup table of modules using the module's key.voidcollectCLO(CLOParser prsr) All providers of command line options must implement this method to collect their options.abstract Network2DcreateNetwork2D(Geometry geometry) Generate 2D network.abstract Network3DcreateNetwork3D(Geometry geometry) Generate 3D network.voiddebug()Advances the EvoLudo model by a single debugging step.voidDecrease delay between subsequent updates by fixed factor.abstract intCalculate elapsed time since instantiation in milliseconds.Encode current state of EvoLudo model as XML string (plist format).protected voidFinish sampling CPU time.abstract voidexecute(EvoLudo.Directive directive) Executedirectivein JRE or GWT environments.abstract voidExport the current state of the engine using the appropriate means available in the current environment (GWT/JRE).voidReport error and stop model execution, if running.voidCalled whenever the state of the model has changed.voidCalled after the model has been re-initialized.voidCalled whenever a new model has finished loading.voidCalled after the model completed its relaxation.voidCalled after the model has been reset.voidCalled whenever the model starts its calculations.voidCalled after the population has reached an absorbing state (or has converged to an equilibrium state).voidCalled whenever a new model has finished loading.voidCalled whenever a new module has finished loading.voidCalled after the state of the model has been restored either through drag'n'drop with the GWT GUI or through the--restorecommand line argument.voidCalled whenever the current module has finished unloading.voidCalled whenever the settings of the model have changed.getCLO()Get the raw command line options, as provided in URL, HTML tag, settings TextArea or command line.Format, encode and output help on command line options.Get the type of color model for translating continuous traits into colors.intgetDelay()Get delay between subsequent updates.abstract StringgetGit()Gets current git version of code base.abstract StringGets the compilation date of the current git version.Get version of JRE (if not running in browser).Note: Instead of sharing logging system, EvoLudo could implement helper routines for logging notifications.getModel()Get the active model.Gets the activeModule.getRNG()Get the shared random number generator to ensure the reproducibility of results.intGets the timeout for the layout process of snapshots in msec.String[]Get the command line options split into an array with option names followed by their arguments (if applicable).Return version string of current model.abstract PDESupervisorhirePDESupervisor(PDE charge) Hire supervisor for managing PDE calculations.voidIncrease delay between subsequent updates by fixed factor.booleanCheck if the active model is running.booleanCheck whether the current model is suspended.voidNotification from GUI that layout process has finished.Set model type and loads the corresponding frameworks for individual based simulations or numerical integration of ODE/SDE/PDE models.loadModule(String newModuleKey) Load new module with keynewModuleKey.voidConvenience method to log errors of simulations.voidlogMessage(String msg) Convenience method to log messages of simulations.abstract voidlogProgress(String msg) Utility method to log progress of simulations.voidlogWarning(String msg) Convenience method to log warnings of simulations.final booleanCheck consistency of parameters in all populations.final voidInitialize all populations and notify all listeners.final voidmodelInit(boolean quiet) Initialize all populations and notify all listeners if requested.final booleanAdvance model by one step (reportFrequpdates) and notify all listeners.final booleanmodelNextDone(boolean cont) Called after the calculations of the next state of the model have finished.final booleanRelax model bytimeRelaxsteps and notify all listeners when done.final booleanmodelRelax(boolean quiet) Relax model bytimeRelaxsteps and notify all listeners if requested.final voidReset all populations and notify all listeners.final voidmodelReset(boolean quiet) Reset all populations and notify all listeners if requested.abstract voidnext()Advances the EvoLudo model by a single step.booleanCalled after parameters have changed.intparseCLO()Parse command line options.protected intPre-process and parse array of command line arguments.protected String[]preprocessCLO(String[] cloarray) Pre-process array of command line arguments.voidprev()Attempts to backtrack a single step of the EvoLudo model.(package private) voidHelper method for handling model changed events and processes pending actions.voidremoveChangeListener(ChangeListener obsoleteListener) Remove the change listener from the list of listeners that get notified when the model changes.voidremoveCLOProvider(CLOProvider provider) Unregistercloas a provider of command line options.voidremoveMilestoneListener(MilestoneListener obsoleteListener) Remove the milestone listener from the list of listeners that get notified when the model reaches milestones.voidRequests aChangeListener.PendingActionto be processed on the next opportunity.voidrequestAction(ChangeListener.PendingAction action, boolean now) Requests aChangeListener.PendingActionto be processed on the next opportunity.voidRequest full reparsing of the command line options.voidrequiresReset(boolean reset) Request reset the active model, e.g.protected voidResets sampling of CPU time.abstract booleanRestore state of EvoLudo model from saved plist, which encodes engine state.booleanrestoreState(Plist plist) Restore state of EvoLudo model from pre-processed plist, which encodes engine state (seeencodeState()).abstract voidrun()Start the EvoLudo model and calculate the dynamics one step at a time.voidSet the raw command line options, as shown e.g.voidsetColorModelType(EvoLudo.ColorModelType colorModelType) Set the type of the color model for translating continuous traits into colors.voidsetDelay(int delay) Set delay between subsequent updates.voidsetSuspended(boolean suspend) Set the flag indicating whether the model is suspended.abstract voidshowHelp()Show help on command line options.voidRun simulation.protected voidStarts sampling CPU time.voidStart or stop EvoLudo model.voidstop()Requests halting of a runningModelon the next opportunity.voidUnload model framework.voidunloadModel(boolean quiet) Unload model framework and, if requested, notifies all registeredMilestoneListener's.voidUnload current module to free up resources.voidConcluding words for report (currently JRE only).voidWrite header of report tooutput(currently JRE only).Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface CLOProvider
adjustCLO
-
Field Details
-
isGWT
public static boolean isGWTThe flag to indicate whether EvoLudo is running in a web browser (or ePub) using javascript generated by GWT or in the java JRE. Special characters in strings can result in headaches when running in an ePub (or, worse still, in XHTML pages).truewhen running as GWT application;falsefor JRE applications. -
hasTouch
public boolean hasTouchThe flag to indicate whether the current device/program supports touch eventsNote: cannot be
staticorfinalto allow disabling touch events for debugging (seeEvoLudoGWT.cloEmulate). -
IDcounter
private static int IDcounterThe loggers of each EvoLudo lab instance need to have unique names to keep the logs separate. UseIDcounterto generate uniqueID's. -
ID
public final int IDUniqueIDof EvoLudo instance.- See Also:
-
logger
The logger for keeping track of and reporting events and issues. -
rng
The shared random number generator to ensure reproducibility of results.- See Also:
-
modules
The lookup table for all available modules. -
activeModel
The active model -
resetRequested
private boolean resetRequestedThe flag to indicate whether a reset of the active model has been requested. This is necessary after certain parameter changes. For example, changing the population size (seeIBSPopulation.nPopulation) requires a reset to (re)generate population geometries and initialize traits. -
reparseCLO
private boolean reparseCLOThe flag to indicate whether the module reqiuires a full reparsing of the command line options. -
milestoneListeners
List of engine listeners that get notified when the state of the population changed, for example after population reset or completed an update step. -
changeListeners
List of change listeners that get notified when the model changes. -
cpu
double cpuStarting time of CPU sampling (negative if not sampling). -
cpuMean
double cpuMeanMean time of CPU sampling. -
cpuVar
double cpuVarVariance of time of CPU sampling. -
cpuSamples
int cpuSamplesNumber of CPU time samples -
clo
The command line options (raw string provided in URL, HTML tag, TextArea or command line) -
isSuspended
protected boolean isSuspendedThe flag to indicate whether running of the model is suspended. For example while parameters are being applied. If the changes do not require a reset of the model the calculations are resumed after new parameters are applied. Also used when command line options are set to immediately start running after loading (seecloRun). -
DELAY_MIN
public static final double DELAY_MINMinimum delay between subsequent updates for speed sliderSlider- See Also:
-
DELAY_MAX
public static final double DELAY_MAXMaximum delay between subsequent updates for speed sliderSlider- See Also:
-
DELAY_INIT
public static final double DELAY_INITInitial delay between subsequent updates for speed sliderSlider- See Also:
-
DELAY_INCR
private static final double DELAY_INCRDelay decrement for speed sliderSlider- See Also:
-
delay
protected int delayDelay between subsequent updates in milliseconds when model is running. -
activeModule
The active module. -
isRunning
protected boolean isRunningThe flag to indicate whether the active model is running. -
doPrev
private boolean doPrevFlag to indicate if a backstep is in progress. -
pendingAction
The action that is pending (if any). -
COPYRIGHT
The copyright string.- See Also:
-
snapLayoutTimeout
protected int snapLayoutTimeouttimeout for layout process of snapshots in msec. -
parser
The parser for command line options. -
cloModule
Command line option to set module. -
cloModel
Command line option to set the type of model (seeType). -
cloSeed
Command line option to set seed of random number generator. -
cloRun
Command line option to request that the EvoLudo model immediately starts running after loading. -
cloDelay
Command line option to set the delay between subsequent updates. -
cloTrajectoryColor
-
cloTraitColorScheme
Command line option to set color scheme for coloring continuous traits.- See Also:
-
cloRNG
Command line option to perform test of random number generator on launch. This takes approximately 10-20 seconds. The test reports (1) whether the generated sequence of random numbers is consistent with the reference implementation ofMersenneTwisterand (2) the performance of MersenneTwister compared toRandom. -
cloVerbose
Command line option to set verbosity level of logging. -
cloHelp
Command line option to print help message for available command line options. -
colorModelType
The coloring method type.
-
-
Constructor Details
-
EvoLudo
public EvoLudo()Create an instance of the EvoLudo controller. EvoLudo manages different module/model implementations and the connection between simulations/numerical calculations and the GUI interface as well as the execution environment. This includes logging (verbosity and output channels), restoring previously saved engine states as well saving the current state of the engine, export its data or graphical snapshots. -
EvoLudo
protected EvoLudo(boolean loadModules) Constructor to instantiate a new EvoLudo controller. IfloadModules == true, load all available modules. Otherwise a specific module needs to be loaded by the caller.- Parameters:
loadModules- the flag to indicate whether to load modules
-
-
Method Details
-
logProgress
Utility method to log progress of simulations. For implementation details seeEvoLudoJREandEvoLudoGWT- Parameters:
msg- progress message
-
logMessage
Convenience method to log messages of simulations.- Parameters:
msg- information message
-
logWarning
Convenience method to log warnings of simulations.- Parameters:
msg- warning message
-
logError
Convenience method to log errors of simulations.- Parameters:
msg- error message
-
getRNG
Get the shared random number generator to ensure the reproducibility of results. This is the only RNG that MUST be used for all calculation, i.e. must be shared with all models including distributions (e.g. for mutations, migration...)Important:
- Must be used for any random numbers related to the modelling.
- Must not be used for anything else, e.g. shared with layout procedures for networks (although it may be desirable to set a seed for the layout routines in a consistent manner if one was set for the simulations, to also ensure visual reproducibility).
- If the number of random numbers drawn changes, any corresponding test fails almost certainly. Tests pass only if the results are identical.
- Returns:
- the one and only random number generator for modelling
- See Also:
-
createNetwork2D
Generate 2D network. This is the factory method to provide different implementations for GWT and JRE. More specifically, the layouting process in GWT uses scheduling (asynchronous execution) to prevent the GUI from stalling, while JRE implementations take advantage of multiple threads for significantly faster execution due to parallelization.- Parameters:
geometry- the geometry backing the 2D network- Returns:
- new instance of a 2D network
-
createNetwork3D
Generate 3D network. This is the factory method to provide different implementations for GWT and JRE. More specifically, the layouting process in GWT uses scheduling (asynchronous execution) to prevent the GUI from stalling, while JRE implementations take advantage of multiple threads for significantly faster execution due to parallelization.Note: The
java3dpackage is obsolete. At present no 3D implementation for java exists.- Parameters:
geometry- the geometry backing the 3D network- Returns:
- new instance of a 3D network
-
loadModel
Set model type and loads the corresponding frameworks for individual based simulations or numerical integration of ODE/SDE/PDE models. Notifies all registeredMilestoneListener's of any changes.- Parameters:
type- the type ofModelto load- Returns:
- new model or
nullif the model type is not supported and no active current model
-
getModel
Get the active model.- Returns:
- the active model
-
requiresReset
public void requiresReset(boolean reset) Request reset the active model, e.g. after change of parameters.- Parameters:
reset-trueif reset is requested
-
requestParseCLO
public void requestParseCLO()Request full reparsing of the command line options. This is necessary if the command line options have changed in a fundamental way, for example if the number of traits in a module has changed. -
addMilestoneListener
Add a milestone listener to the list of listeners that get notified when the model reaches milestones.- Parameters:
newListener- the new milestone listener
-
removeMilestoneListener
Remove the milestone listener from the list of listeners that get notified when the model reaches milestones.- Parameters:
obsoleteListener- the listener to remove from list of milestone listeners
-
addChangeListener
Add a change listener to the list of listeners that get notified when the model changes.- Parameters:
newListener- the new change listener
-
removeChangeListener
Remove the change listener from the list of listeners that get notified when the model changes.- Parameters:
obsoleteListener- the listener to remove from the list of change listeners
-
unloadModel
public void unloadModel()Unload model framework. Notifies all registeredMilestoneListener's. -
unloadModel
public void unloadModel(boolean quiet) Unload model framework and, if requested, notifies all registeredMilestoneListener's.- Parameters:
quiet- set totrueto skip notifying listeners
-
modelCheck
public final boolean modelCheck()Check consistency of parameters in all populations.Note: in multi-species interactions optimizations seem sensible only if all populations involved approve of them.
- Returns:
trueif reset is required
-
modelReset
public final void modelReset()Reset all populations and notify all listeners. -
modelReset
public final void modelReset(boolean quiet) Reset all populations and notify all listeners if requested.Note: if
quiet == truestatistics are preserved.- Parameters:
quiet- set totrueto skip notifying listeners
-
modelInit
public final void modelInit()Initialize all populations and notify all listeners. -
modelInit
public final void modelInit(boolean quiet) Initialize all populations and notify all listeners if requested. In contrast tomodelReset(boolean)this method does not re-generate the population structures.- Parameters:
quiet- set totrueto skip notifying listeners
-
resetCPUSample
protected void resetCPUSample()Resets sampling of CPU time. -
startCPUSample
protected void startCPUSample()Starts sampling CPU time. -
endCPUSample
protected void endCPUSample()Finish sampling CPU time. -
modelRelax
public final boolean modelRelax()Relax model bytimeRelaxsteps and notify all listeners when done. If model converged during relaxation notify listeners that model has stopped.- Returns:
trueif converged- See Also:
-
modelRelax
public final boolean modelRelax(boolean quiet) Relax model bytimeRelaxsteps and notify all listeners if requested.- Parameters:
quiet- set totrueto skip notifying listeners- Returns:
trueif converged- See Also:
-
modelNext
public final boolean modelNext()Advance model by one step (reportFrequpdates) and notify all listeners.- Returns:
trueif not converged, i.e. ifmodelNext()can be called again.
-
modelNextDone
public final boolean modelNextDone(boolean cont) Called after the calculations of the next state of the model have finished. For GWT this method serves as a callback for the asynchronous model computations. For JRE this runs in a separate thread from the GUI andmodelNext()directly calls this.- Parameters:
cont-falseif converged or halting time reached- Returns:
trueif not converged, i.e. ifmodelNext()can be called again.
-
paramsDidChange
public boolean paramsDidChange()Called after parameters have changed. Checks new settings and resets population(s) (and/or GUI) if necessary.- Returns:
trueif reset was necessary
-
getCLO
Get the raw command line options, as provided in URL, HTML tag, settings TextArea or command line.- Returns:
- command line options
-
getSplitCLO
Get the command line options split into an array with option names followed by their arguments (if applicable).- Returns:
- array command line options and arguments
-
setCLO
Set the raw command line options, as shown e.g. in the settings TextArea.- Parameters:
clo- the new command line option string
-
isSuspended
public boolean isSuspended()Check whether the current model is suspended.- Returns:
trueif model is suspended
-
setSuspended
public void setSuspended(boolean suspend) Set the flag indicating whether the model is suspended. A suspended model resumes execution as soon as possible. For example after a new set parameters has been checked.- Parameters:
suspend-trueto indicate that model is suspended.
-
setDelay
public void setDelay(int delay) Set delay between subsequent updates.- Parameters:
delay- in milliseconds
-
getDelay
public int getDelay()Get delay between subsequent updates.- Returns:
- the delay in milliseconds
-
increaseDelay
public void increaseDelay()Increase delay between subsequent updates by fixed factor. -
decreaseDelay
public void decreaseDelay()Decrease delay between subsequent updates by fixed factor. -
loadModule
Load new module with keynewModuleKey. If necessary first unload current module.- Parameters:
newModuleKey- the key of the module to load- Returns:
- new module or
nullif module not found and no active current module
-
unloadModule
public void unloadModule()Unload current module to free up resources.Implementation note:
Called fromloadModule(java.lang.String)to first unload the active module or triggered by GWT'sEvoLudoWeb.onUnload(), i.e. when unloading the GWT application. -
getModule
Gets the activeModule.- Returns:
- the active module
-
addModule
Addmoduleto lookup table of modules using the module's key. If a GUI is present, add GUI as a listener ofmoduleto get notified about state changes.- Parameters:
module- the module to add to lookup table
-
execute
Executedirectivein JRE or GWT environments.- Parameters:
directive- the directive to execute in appropriate GWT or JRE manners
-
isRunning
public boolean isRunning()Check if the active model is running.- Returns:
trueif model is running
-
layoutComplete
public void layoutComplete()Notification from GUI that layout process has finished. Opportunity for taking snapshots. -
stop
public void stop()Requests halting of a runningModelon the next opportunity. -
run
public abstract void run()Start the EvoLudo model and calculate the dynamics one step at a time. -
next
public abstract void next()Advances the EvoLudo model by a single step. Called when pressing the 'Step' button, the 'n' or 'right-arrow' key. -
startStop
public void startStop()Start or stop EvoLudo model. If model is running wait until next update is completed to prevent unexpected side effects. -
prev
public void prev()Attempts to backtrack a single step of the EvoLudo model. Called when pressing the 'Prev' button, the 'p' or 'left-arrow' key. -
debug
public void debug()Advances the EvoLudo model by a single debugging step. Called when pressing the 'Debug' button or 'D' key. -
simulation
public void simulation()Run simulation. Currently only implemented by EvoLudoJRE. Returns control to caller only if the arguments inclodo not match requirements for running a simulation.- See Also:
-
requestAction
Requests aChangeListener.PendingActionto be processed on the next opportunity. If model is not running the action is processed immediately.- Parameters:
action- the action requested
-
requestAction
Requests aChangeListener.PendingActionto be processed on the next opportunity. If model is not running ornowis set totruethe action is processed immediately.- Parameters:
action- the action requestednow-trueto processes action immediately
-
fireModuleLoaded
public void fireModuleLoaded()Called whenever a new module has finished loading. Notifies all registeredMilestoneListeners. -
fireModuleUnloaded
public void fireModuleUnloaded()Called whenever the current module has finished unloading. Notifies all registeredMilestoneListeners. -
fireModuleRestored
public void fireModuleRestored()Called after the state of the model has been restored either through drag'n'drop with the GWT GUI or through the--restorecommand line argument. Notifies all registeredMilestoneListeners.- See Also:
-
fireModelLoaded
public void fireModelLoaded()Called whenever a new model has finished loading. Notifies all registeredMilestoneListeners. -
fireModelUnloaded
public void fireModelUnloaded()Called whenever a new model has finished loading. Notifies all registeredMilestoneListeners. -
fireModelRunning
public void fireModelRunning()Called whenever the model starts its calculations. Fires only when starting to run. Notifies all registeredMilestoneListeners. -
fireModelChanged
public void fireModelChanged()Called whenever the state of the model has changed. For example, to trigger the update of the state displayed in the GUI. Processes pending actions and notifies all registeredModel.MilestoneListeners.- See Also:
-
fireSettingsChanged
public void fireSettingsChanged()Called whenever the settings of the model have changed. For example, to trigger the range of values or markers in the GUI. Notifies all registeredMilestoneListeners.- See Also:
-
processPendingAction
void processPendingAction()Helper method for handling model changed events and processes pending actions.- See Also:
-
fireModelInit
public void fireModelInit()Called after the model has been re-initialized. Notifies all registeredMilestoneListeners. -
fireModelReset
public void fireModelReset()Called after the model has been reset. Notifies all registeredMilestoneListeners. -
fireModelRelaxed
public void fireModelRelaxed()Called after the model completed its relaxation. Notifies all registeredMilestoneListeners. -
fireModelStopped
public void fireModelStopped()Called after the population has reached an absorbing state (or has converged to an equilibrium state). Notifies all registeredMilestoneListeners. -
getLogger
Note: Instead of sharing logging system, EvoLudo could implement helper routines for logging notifications. However, when logging notifications with a severity ofLevel.WARNINGor higher the default logging message includes the name of the calling routine and hence would always refer to the (unhelpful) helper routines.- Returns:
- logger of this EvoLudo controller
-
hirePDESupervisor
Hire supervisor for managing PDE calculations. This is the factory method provide different implementations For GWT and JRE. More specifically, GWT uses asynchronous execution to prevent the GUI from stalling, while JRE implementations take advantage of multiple threads for significantly faster execution due to parallelization.- Parameters:
charge- the PDE model to supervise- Returns:
- supervisor for coordinating PDE calculations
- See Also:
-
elapsedTimeMsec
public abstract int elapsedTimeMsec()Calculate elapsed time since instantiation in milliseconds.Hide GWT/JRE differences in measuring execution time.
- Specified by:
elapsedTimeMsecin interfaceMersenneTwister.Chronometer- Returns:
- time in milliseconds
- See Also:
-
getVersion
Return version string of current model. Version must include reference to git commit to ensure reproducibility of results.- Returns:
- the version string
-
getJavaVersion
Get version of JRE (if not running in browser).- Returns:
- the java version string
-
getGit
Gets current git version of code base.- Returns:
- the git version string
-
getGitDate
Gets the compilation date of the current git version.- Returns:
- the git compilation date as a string
-
getSnapLayoutTimeout
public int getSnapLayoutTimeout()Gets the timeout for the layout process of snapshots in msec.- Returns:
- timeout in msec
-
writeHeader
public void writeHeader()Write header of report tooutput(currently JRE only). The information should include items like the version of the EvoLudo code, the current date and the string of command line options for reproducibility. -
exportState
public abstract void exportState()Export the current state of the engine using the appropriate means available in the current environment (GWT/JRE).- See Also:
-
encodeState
Encode current state of EvoLudo model as XML string (plist format).- Returns:
- encoded state
-
restoreFromFile
public abstract boolean restoreFromFile()Restore state of EvoLudo model from saved plist, which encodes engine state.- Returns:
trueon successfully restoring state- See Also:
-
restoreState
Restore state of EvoLudo model from pre-processed plist, which encodes engine state (seeencodeState()).Note: the appropriate model must already have been loaded and the command line arguments specified with the key
CLOin theplistmust also have been processed already.In JRE the options in
plistare merged with any other command line arguments (albeit the ones inplisthave priority to minimize the chance of complications). In GWTrestoreState(Plist)is overridden to first deal with the command line arguments.- Parameters:
plist- the lookup table with key value pairs- Returns:
trueon successfully restoring state
-
addCLOProvider
Registercloas a provider of command line options. Initialize command line parser if necessary.- Parameters:
provider- the option provider to add
-
removeCLOProvider
Unregistercloas a provider of command line options.- Parameters:
provider- the option provider to remove
-
preprocessCLO
Pre-process array of command line arguments. Some arguments need priority treatment. Examples include the options--module,--verboseor--restore.--module- load module and remove option
--verbose- set verbosity level effective immediately. This ensures that issues when parsing the remaining command line options are already properly reported
- Parameters:
cloarray- array of command line arguments- Returns:
- pre-processed array of command line options
- See Also:
-
parseCLO
public int parseCLO()Parse command line options.- Returns:
- the number of issues that have occurred durin parsing
- See Also:
-
parseCLO
Pre-process and parse array of command line arguments.- Parameters:
cloarray- string array of command line arguments- Returns:
- the number of issues that have occurred durin parsing
- See Also:
-
getCLOHelp
Format, encode and output help on command line options.- Returns:
- the help string
-
showHelp
public abstract void showHelp()Show help on command line options. -
collectCLO
All providers of command line options must implement this method to collect their options.Each command line option is (uniquely) identified by it's name (see
CLOption.getName()), which corresponds to the long version of the option. If an attempt is made to add an option with a name that already exists, theparserissues a warning and ignores the option. Thus, in general, implementing subclasses should first register their options and callsuper.collectCLO(CLOParser)at the end such that subclasses are able to override command line options specified in a parental class.Override this method in subclasses to add further command line options. Subclasses must make sure that they include a call to super.
Note: In contrast to other providers of command line options, the EvoLudo class maintains a reference to the parser (
prsrandparsermust be identical).- Specified by:
collectCLOin interfaceCLOProvider- Parameters:
prsr- the reference to parser that manages command line options- See Also:
-
getColorModelType
Get the type of color model for translating continuous traits into colors.- Returns:
- the type of color model
- See Also:
-
setColorModelType
Set the type of the color model for translating continuous traits into colors.- Parameters:
colorModelType- the new type of color model- See Also:
-
fatal
Report error and stop model execution, if running.IMPORTANT: Does not return control to caller.
- Parameters:
msg- the error message
-