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.GroupedProblemFormDummy 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.StringP_SHOULD_SET_CONTEXTParameter 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 voidevaluate(ec.EvolutionState state, ec.Individual[] inds, boolean[] updateFitness, boolean countVictoriesOnly, int[] subpops, int threadnum)Evaluates the individual (in not already evaluated)booleanisOptimal(int fitness)Return true if the fitness is optimalvoidpostprocessPopulation(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 trialsvoidpreprocessPopulation(ec.EvolutionState state, ec.Population pop, boolean[] prepareForAssessment, boolean countVictoriesOnly)Prepare the fitness of individuals belonging to a population (clear trials) before their evaluationvoidsetup(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:
setupin interfaceec.Prototype- Specified by:
setupin interfaceec.Setup- Overrides:
setupin 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:
preprocessPopulationin 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:
postprocessPopulationin 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:
evaluatein 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
-
-