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
      • Fields inherited from class ec.Problem

        P_PROBLEM
    • 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 optimal
      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
      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
      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.
      • Methods inherited from class ec.Problem

        canEvaluate, clone, closeContacts, defaultBase, describe, describe, finishEvaluating, initializeContacts, prepareToEvaluate, reinitializeContacts
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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
    • Constructor Detail

      • CoevolutionaryMaxOnes

        public CoevolutionaryMaxOnes()
    • 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 interface ec.Prototype
        Specified by:
        setup in interface ec.Setup
        Overrides:
        setup in class ec.Problem
        Parameters:
        state - The evolution state
        base - 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 interface ec.coevolve.GroupedProblemForm
        Parameters:
        state - The state of the evolutionary process
        pop - The population
        prepareForAssessment - Only clear the trials for Individuals in Subpopulations for which prepareForAssessment is true
        countVictoriesOnly - 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 interface ec.coevolve.GroupedProblemForm
        Parameters:
        state - The state of the evolutionary process
        pop - The population
        assessFitness - Only assess the Fitness and set the evaluated flags for Individuals in Subpopulations for which assessFitness is true
        countVictoriesOnly - 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 interface ec.coevolve.GroupedProblemForm
        Parameters:
        state - The state of the evolutionary process
        inds - The individuals to evaluate together
        updateFitness - Should this individuals' fitness be updated?
        countVictoriesOnly - Can be neglected in cooperative coevolution
        subpops - Subpopulations
        threadnum - The thread of execution