Class Evaluator
- java.lang.Object
-
- ec.Evaluator
-
- Direct Known Subclasses:
- CompetitiveEvaluator, MultiPopCoevolutionaryEvaluator, SimpleEvaluator
public abstract class Evaluator extends java.lang.Object implements Singleton
An Evaluator is a singleton object which is responsible for the evaluation process during the course of an evolutionary run. Only one Evaluator is created in a run, and is stored in the EvolutionState object.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) - See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field and Description MasterProblemmasterproblemstatic java.lang.StringP_IAMSLAVEstatic java.lang.StringP_MASTERPROBLEMProblemp_problemstatic java.lang.StringP_PROBLEM
-
Constructor Summary
Constructors Constructor and Description Evaluator()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method and Description voidcloseContacts(EvolutionState state, int result)Called to shut down remote evaluation network contacts when the run is completed.abstract voidevaluatePopulation(EvolutionState state)Evaluates the fitness of an entire population.voidinitializeContacts(EvolutionState state)Called to set up remote evaluation network contacts when the run is started.voidreinitializeContacts(EvolutionState state)Called to reinitialize remote evaluation network contacts when the run is restarted from checkpoint.abstract booleanrunComplete(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.voidsetup(EvolutionState state, Parameter base)Sets up the object by reading it from the parameters stored in state, built off of the parameter base base.
-
-
-
Field Detail
-
P_PROBLEM
public static final java.lang.String P_PROBLEM
- See Also:
- Constant Field Values
-
p_problem
public Problem p_problem
-
masterproblem
public MasterProblem masterproblem
-
P_MASTERPROBLEM
public static final java.lang.String P_MASTERPROBLEM
- See Also:
- Constant Field Values
-
P_IAMSLAVE
public static final java.lang.String P_IAMSLAVE
- See Also:
- Constant Field Values
-
-
Method Detail
-
evaluatePopulation
public abstract void evaluatePopulation(EvolutionState state)
Evaluates the fitness of an entire population. You will have to determine how to handle multiple threads on your own, as this is a very domain-specific thing.
-
runComplete
public 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.
-
setup
public void setup(EvolutionState state, Parameter base)
Description copied from interface:SetupSets up the object by reading it from the parameters stored in state, built off of the parameter base base. If an ancestor implements this method, be sure to call super.setup(state,base); before you do anything else.
-
initializeContacts
public void initializeContacts(EvolutionState state)
Called to set up remote evaluation network contacts when the run is started. Mostly used for client/server evaluation (see MasterProblem). By default calls p_problem.initializeContacts(state)
-
reinitializeContacts
public void reinitializeContacts(EvolutionState state)
Called to reinitialize remote evaluation network contacts when the run is restarted from checkpoint. Mostly used for client/server evaluation (see MasterProblem). By default calls p_problem.reinitializeContacts(state)
-
closeContacts
public void closeContacts(EvolutionState state, int result)
Called to shut down remote evaluation network contacts when the run is completed. Mostly used for client/server evaluation (see MasterProblem). By default calls p_problem.closeContacts(state,result)
-
-
DMelt 3.0 © DataMelt by jWork.ORG