Package tests.testCoevolution
Class CoevolutionaryMaxOnes
- java.lang.Object
-
- ec.Problem
-
- tests.testCoevolution.CoevolutionaryMaxOnes
-
- All Implemented Interfaces:
ec.coevolve.GroupedProblemForm
,ec.Prototype
,ec.Setup
,java.io.Serializable
,java.lang.Cloneable
public class CoevolutionaryMaxOnes extends ec.Problem implements ec.coevolve.GroupedProblemForm
Dummy test for coevolutionary problems. Maximize the number of ones in a bitvector in a coevolutionary way- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
P_SHOULD_SET_CONTEXT
Parameter to decide whether to include the context or not
-
Constructor Summary
Constructors Constructor Description CoevolutionaryMaxOnes()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
evaluate(ec.EvolutionState state, ec.Individual[] inds, boolean[] updateFitness, boolean countVictoriesOnly, int[] subpops, int threadnum)
Evaluates the individual (in not already evaluated)boolean
isOptimal(int fitness)
Return true if the fitness is optimalvoid
postprocessPopulation(ec.EvolutionState state, ec.Population pop, boolean[] assessFitness, boolean countVictoriesOnly)
Called after evaluation of a Population to form final Fitness scores for the individuals based on the various performance scores they accumulated during trialsvoid
preprocessPopulation(ec.EvolutionState state, ec.Population pop, boolean[] prepareForAssessment, boolean countVictoriesOnly)
Prepare the fitness of individuals belonging to a population (clear trials) before their evaluationvoid
setup(ec.EvolutionState state, ec.util.Parameter base)
Sets up the problem by reading it from the parameters stored in state, built off of the parameter base base.
-
-
-
Field Detail
-
P_SHOULD_SET_CONTEXT
public static final java.lang.String P_SHOULD_SET_CONTEXT
Parameter to decide whether to include the context or not- See Also:
- Constant Field Values
-
-
Method Detail
-
setup
public void setup(ec.EvolutionState state, ec.util.Parameter base)
Sets up the problem by reading it from the parameters stored in state, built off of the parameter base base.- Specified by:
setup
in interfaceec.Prototype
- Specified by:
setup
in interfaceec.Setup
- Overrides:
setup
in classec.Problem
- Parameters:
state
- The evolution statebase
- The parameter base
-
preprocessPopulation
public void preprocessPopulation(ec.EvolutionState state, ec.Population pop, boolean[] prepareForAssessment, boolean countVictoriesOnly)
Prepare the fitness of individuals belonging to a population (clear trials) before their evaluation- Specified by:
preprocessPopulation
in interfaceec.coevolve.GroupedProblemForm
- Parameters:
state
- The state of the evolutionary processpop
- The populationprepareForAssessment
- Only clear the trials for Individuals in Subpopulations for which prepareForAssessment is truecountVictoriesOnly
- Can be neglected in cooperative coevolution
-
postprocessPopulation
public void postprocessPopulation(ec.EvolutionState state, ec.Population pop, boolean[] assessFitness, boolean countVictoriesOnly)
Called after evaluation of a Population to form final Fitness scores for the individuals based on the various performance scores they accumulated during trials- Specified by:
postprocessPopulation
in interfaceec.coevolve.GroupedProblemForm
- Parameters:
state
- The state of the evolutionary processpop
- The populationassessFitness
- Only assess the Fitness and set the evaluated flags for Individuals in Subpopulations for which assessFitness is truecountVictoriesOnly
- Can be neglected in cooperative coevolution
-
isOptimal
public boolean isOptimal(int fitness)
Return true if the fitness is optimal- Parameters:
fitness
- The fitness
-
evaluate
public void evaluate(ec.EvolutionState state, ec.Individual[] inds, boolean[] updateFitness, boolean countVictoriesOnly, int[] subpops, int threadnum)
Evaluates the individual (in not already evaluated)- Specified by:
evaluate
in interfaceec.coevolve.GroupedProblemForm
- Parameters:
state
- The state of the evolutionary processinds
- The individuals to evaluate togetherupdateFitness
- Should this individuals' fitness be updated?countVictoriesOnly
- Can be neglected in cooperative coevolutionsubpops
- Subpopulationsthreadnum
- The thread of execution
-
-