public abstract class Evaluator extends java.lang.Object implements Singleton
Evaluators typically do their work by applying an instance of some subclass of Problem to individuals in the population. Evaluators come with a Problem prototype which they may clone as necessary to create new Problem spaces to evaluate individuals in (Problems may be reused to prevent constant cloning).
Evaluators may be multithreaded, with one Problem instance per thread usually. The number of threads they may spawn (excepting a parent "gathering" thread) is governed by the EvolutionState's evalthreads value.
Be careful about spawning threads -- this system has no few synchronized methods for efficiency's sake, so you must either divvy up evaluation in a thread-safe fashion, or otherwise you must obtain the appropriate locks on individuals in the population and other objects as necessary.
Parameters
base.problem classname, inherits and != ec.Problem |
(the class for the Problem prototype p_problem) |
base.masterproblem classname, inherits |
(the class for the MasterProblem prototype masterproblem) |
Modifier and Type | Field and Description |
---|---|
MasterProblem |
masterproblem |
static java.lang.String |
P_IAMSLAVE |
static java.lang.String |
P_MASTERPROBLEM |
Problem |
p_problem |
static java.lang.String |
P_PROBLEM |
Constructor and Description |
---|
Evaluator() |
Modifier and Type | Method and Description |
---|---|
void |
closeContacts(EvolutionState state,
int result)
Called to shut down remote evaluation network contacts when the run is completed.
|
abstract void |
evaluatePopulation(EvolutionState state)
Evaluates the fitness of an entire population.
|
void |
initializeContacts(EvolutionState state)
Called to set up remote evaluation network contacts when the run is started.
|
void |
reinitializeContacts(EvolutionState state)
Called to reinitialize remote evaluation network contacts when the run is restarted from checkpoint.
|
abstract boolean |
runComplete(EvolutionState state)
Returns true if an ideal individual has been found or some
other run result has shortcircuited the run so that it should
end prematurely right now.
|
void |
setup(EvolutionState state,
Parameter base)
Sets up the object by reading it from the parameters stored
in state, built off of the parameter base base.
|
public static final java.lang.String P_PROBLEM
public Problem p_problem
public MasterProblem masterproblem
public static final java.lang.String P_MASTERPROBLEM
public static final java.lang.String P_IAMSLAVE
public abstract void evaluatePopulation(EvolutionState state)
public abstract boolean runComplete(EvolutionState state)
public void setup(EvolutionState state, Parameter base)
Setup
public void initializeContacts(EvolutionState state)
public void reinitializeContacts(EvolutionState state)
public void closeContacts(EvolutionState state, int result)