com.parabon.ec
Class Evolve

java.lang.Object
  extended by ec.Evolve
      extended by com.parabon.ec.Evolve

public class Evolve
extends Evolve

ORIGIN evolution main program. Sets up the evolution state and executes a new evolutionary run or restarts an existing run from a checkpoint file.
To programmatically create an instance of ORIGIN do:

     Evolve e = new Evolve();
     e.addParameters(paramfile);   // or e.restartFromCheckpoint(checkpointfile)
     e.evolve();
 


Field Summary
static java.lang.String A_PARAMETER
          Deprecated. Use -D to set system properties instead.
protected static org.apache.commons.logging.Log log
           
 
Fields inherited from class ec.Evolve
A_CHECKPOINT, A_FILE, P_BREEDTHREADS, P_EVALTHREADS, P_FLUSH, P_JOBS, P_PRINTACCESSEDPARAMETERS, P_PRINTALLPARAMETERS, P_PRINTUNACCESSEDPARAMETERS, P_PRINTUNUSEDPARAMETERS, P_PRINTUSEDPARAMETERS, P_SEED, P_STATE, P_STORE, P_VERBOSITY, V_SEED_TIME
 
Constructor Summary
Evolve()
          Constructs evolver.
 
Method Summary
 void addParameters(org.apache.commons.configuration.AbstractConfiguration config)
           
 void addParameters(java.io.File parameterFile)
          Appends the parameters in the specified file to the parameter database.
 void addParameters(java.lang.String parameterFilename)
          Appends the parameters in the specified file to the parameter database.
 void createEvolutionState()
           
 void createEvolutionState(java.lang.String[] args)
          Creates the evolution state for this evolve object from command line arguments.
 void evolve()
          Initializes, executes, and finishes an evolutionary run.
 void finishJob()
          Cleans up at the end of a job.
 void finishJob(java.io.PrintWriter pw)
          Prints parameter statistics and cleans up evolution state at end of job.
 int getCurrentJob()
          Gets the evolutionary run job number.
 int getNumberOfJobs()
           
 CollectionsParameterDatabase getParameterDatabase()
          Gets the current parameter database.
 EvolutionState getState()
          Gets the evolution state
 boolean isRestartedFromCheckpoint()
           
static void main(java.lang.String[] args)
          Main program.
static void processCommandLineArguments(Evolve evolver, java.lang.String[] args)
          Processes command line arguments.
 void restartFromCheckpoint(java.lang.String checkpointFile)
           
 void run()
          Executes a new run, or restarts an existing one from a checkpoint
 void setParameterDatabase(CollectionsParameterDatabase parameters)
          Sets the parameter database used for the run.
 void setState(EvolutionState state)
          Sets the evolution state
 void startJob(int randomSeedOffset)
          Starts an evolutionary run.
 
Methods inherited from class ec.Evolve
cleanup, determineSeed, initialize, loadParameterDatabase, possiblyRestoreFromCheckpoint
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static final org.apache.commons.logging.Log log

A_PARAMETER

public static final java.lang.String A_PARAMETER
Deprecated. Use -D to set system properties instead.
Command line argument setting a parameter value.

See Also:
Constant Field Values
Constructor Detail

Evolve

public Evolve()
Constructs evolver. Evolutionary runs cannot be performed until the evolution state and parameter database are set or restored from a checkpoint file.

Method Detail

setState

public void setState(EvolutionState state)
Sets the evolution state

Parameters:
state - Evolution state

getState

public EvolutionState getState()
Gets the evolution state

Returns:
Evolution state

restartFromCheckpoint

public void restartFromCheckpoint(java.lang.String checkpointFile)
                           throws java.io.IOException,
                                  org.apache.commons.configuration.ConfigurationException
Throws:
java.io.IOException
org.apache.commons.configuration.ConfigurationException

isRestartedFromCheckpoint

public boolean isRestartedFromCheckpoint()

setParameterDatabase

public void setParameterDatabase(CollectionsParameterDatabase parameters)
                          throws org.apache.commons.configuration.ConfigurationException
Sets the parameter database used for the run. The database must have already been loaded.

Parameters:
parameters - Parameter database.
Throws:
org.apache.commons.configuration.ConfigurationException

getParameterDatabase

public CollectionsParameterDatabase getParameterDatabase()
Gets the current parameter database.

Returns:
Parameter database

addParameters

public void addParameters(org.apache.commons.configuration.AbstractConfiguration config)
                   throws org.apache.commons.configuration.ConfigurationException
Throws:
org.apache.commons.configuration.ConfigurationException

addParameters

public void addParameters(java.io.File parameterFile)
                   throws java.io.IOException,
                          org.apache.commons.configuration.ConfigurationException
Appends the parameters in the specified file to the parameter database. If the filename ends in ".xml" the file is assumed to be in XML format, otherwise it's treated as a property file.

Parameters:
parameterFile -
Throws:
java.io.IOException
org.apache.commons.configuration.ConfigurationException

addParameters

public void addParameters(java.lang.String parameterFilename)
                   throws java.io.IOException,
                          org.apache.commons.configuration.ConfigurationException
Appends the parameters in the specified file to the parameter database. If the filename ends in ".xml" the file is assumed to be in XML format, otherwise it's treated as a property file.

Parameters:
parameterFilename -
Throws:
java.io.IOException
org.apache.commons.configuration.ConfigurationException

getCurrentJob

public int getCurrentJob()
Gets the evolutionary run job number. Note that this is not the Frontier job name.

Returns:
Job number.

getNumberOfJobs

public int getNumberOfJobs()

startJob

public void startJob(int randomSeedOffset)
              throws org.apache.commons.configuration.ConfigurationException
Starts an evolutionary run. Creates the output logger and random number generators used for the run.

Parameters:
randomSeedOffset - Offset value for random number generator seed. Ensures that consecutive jobs don't use identical random number sequences.
Throws:
org.apache.commons.configuration.ConfigurationException

createEvolutionState

public void createEvolutionState(java.lang.String[] args)
                          throws org.apache.commons.configuration.ConfigurationException
Creates the evolution state for this evolve object from command line arguments.

Parameters:
args - Command line arguments.
Throws:
org.apache.commons.configuration.ConfigurationException

createEvolutionState

public void createEvolutionState()
                          throws org.apache.commons.configuration.ConfigurationException
Throws:
org.apache.commons.configuration.ConfigurationException

run

public void run()
         throws org.apache.commons.configuration.ConfigurationException
Executes a new run, or restarts an existing one from a checkpoint

Throws:
org.apache.commons.configuration.ConfigurationException

evolve

public void evolve()
            throws org.apache.commons.configuration.ConfigurationException
Initializes, executes, and finishes an evolutionary run.

Throws:
org.apache.commons.configuration.ConfigurationException

finishJob

public void finishJob(java.io.PrintWriter pw)
Prints parameter statistics and cleans up evolution state at end of job.


finishJob

public void finishJob()
Cleans up at the end of a job.


main

public static void main(java.lang.String[] args)
Main program. Either loads a parameter database from a parameter file and executes a new run or restarts execution from a checkpoint file.


processCommandLineArguments

public static void processCommandLineArguments(Evolve evolver,
                                               java.lang.String[] args)
                                        throws org.apache.commons.configuration.ConfigurationException,
                                               java.io.IOException
Processes command line arguments. Either a checkpoint or parameter file must be specified on the command line.

Parameters:
evolver - Evolve object
args - Command line arguments.
Throws:
org.apache.commons.configuration.ConfigurationException
java.io.IOException