Class Evaluator
- All Implemented Interfaces:
Setup,Singleton,Serializable
- Direct Known Subclasses:
CompetitiveEvaluator,MultiPopCoevolutionaryEvaluator,SimpleEvaluator
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:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcloseContacts(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.voidCalled to update some state by considering the current population.voidpostEvaluationLocalUpdate(EvolutionState state, Individual ind, int subpop) Called to update some state by considering a single Individual.voidCalled to reinitialize remote evaluation network contacts when the run is restarted from checkpoint.abstract StringrunComplete(EvolutionState state) Returns non-NULL if the Evaluator believes that the run is finished: perhaps an ideal individual has been found or some other run result has shortcircuited the run so that it should end prematurely right now.voidsetRunComplete(String message) Requests that the Evaluator quit soon for a user-defined reason provided in the message.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 Details
-
P_PROBLEM
- See Also:
-
p_problem
-
masterproblem
-
P_MASTERPROBLEM
- See Also:
-
P_IAMSLAVE
- See Also:
-
runComplete
-
-
Constructor Details
-
Evaluator
public Evaluator()
-
-
Method Details
-
evaluatePopulation
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
Returns non-NULL if the Evaluator believes that the run is finished: perhaps an ideal individual has been found or some other run result has shortcircuited the run so that it should end prematurely right now. Typically a message is stored in the String for the user to know why the system shut down. -
setRunComplete
Requests that the Evaluator quit soon for a user-defined reason provided in the message. -
setup
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
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
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
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) -
postEvaluationGlobalUpdate
Called to update some state by considering the current population. This is used by some algorithms to update additional state (stored the population's Species) beyond fitness values (ex. ACO's pheromone distributions). This method will typically just call a similar hook on a Species, where the actually state update occurs. -
postEvaluationLocalUpdate
Called to update some state by considering a single Individual. This is used by some algorithms to update additional state (stored the population's Species) beyond fitness values (ex. ACO's pheromone distributions). This method will typically just call a similar hook on a Species, where the actually state update occurs.
-