Documentation of 'ec.app.majority.MajorityGA' Java class
MajorityGA
ec.app.majority

Class MajorityGA

  • All Implemented Interfaces:
    Prototype, Setup, SimpleProblemForm, java.io.Serializable, java.lang.Cloneable


    public class MajorityGA
    extends Problem
    implements SimpleProblemForm
    MajorityGA.java Implements a GA-style vector rule for the one-dimensional Majority-Ones cellular automaton problem. This code is in the spirit of Das, Crutchfield, Mitchel, and Hanson, "Evolving Globally Synchronized Cellular Automata", http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.55.7754&rep=rep1&type=pdf The primary difference is in the trials mechanism, in which we're using 25/25/50 rather than 50/50/0. If you run java ec.app.majority.MajorityGA, it'll test using the ABK rule instead (0.8342 using 10000 tests, 0.82528 if you use 100000 tests, 0.823961 if you use 1000000 tests)
    See Also:
    Serialized Form
    • Constructor Detail

      • MajorityGA

        public MajorityGA()
    • Method Detail

      • generateTrials

        public void generateTrials(EvolutionState state,
                                   int thread)
      • setup

        public void setup(EvolutionState state,
                          Parameter base)
        Description copied from interface: Prototype
        Sets 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.

        For prototypes, setup(...) is typically called once for the prototype instance; cloned instances do not receive the setup(...) call. setup(...) may be called more than once; the only guarantee is that it will get called at least once on an instance or some "parent" object from which it was ultimately cloned.

        Specified by:
        setup in interface Prototype
        Specified by:
        setup in interface Setup
        Overrides:
        setup in class Problem
      • prepareToEvaluate

        public void prepareToEvaluate(EvolutionState state,
                                      int threadnum)
        Description copied from class: Problem
        May be called by the Evaluator prior to a series of individuals to evaluate, and then ended with a finishEvaluating(...). If this is the case then the Problem is free to delay modifying the individuals or their fitnesses until at finishEvaluating(...). If no prepareToEvaluate(...) is called prior to evaluation, the Problem must complete its modification of the individuals and their fitnesses as they are evaluated as stipulated in the relevant evaluate(...) documentation for SimpleProblemForm or GroupedProblemForm. The default method does nothing. Note that prepareToEvaluate() can be called *multiple times* prior to finishEvaluating() being called -- in this case, the subsequent calls may be ignored.
        Overrides:
        prepareToEvaluate in class Problem
      • finishEvaluating

        public void finishEvaluating(EvolutionState state,
                                     int threadnum)
        Description copied from class: Problem
        Will be called by the Evaluator after prepareToEvaluate(...) is called and then a series of individuals are evaluated. However individuals may be evaluated without prepareToEvaluate or finishEvaluating being called at all. See the documentation for prepareToEvaluate for more information. The default method does nothing.
        Overrides:
        finishEvaluating in class Problem
      • all

        public static boolean all(int[] vals,
                                  int val)
      • evaluate

        public void evaluate(EvolutionState state,
                             Individual ind,
                             int subpopulation,
                             int threadnum)
        Description copied from interface: SimpleProblemForm
        Evaluates the individual in ind, if necessary (perhaps not evaluating them if their evaluated flags are true), and sets their fitness appropriately.
        Specified by:
        evaluate in interface SimpleProblemForm
      • describe

        public void describe(EvolutionState state,
                             Individual ind,
                             int subpopulation,
                             int threadnum,
                             int log)
        Description copied from class: Problem
        Part of SimpleProblemForm. Included here so you don't have to write the default version, which usually does nothing.
        Specified by:
        describe in interface SimpleProblemForm
        Overrides:
        describe in class Problem
      • main

        public static void main(java.lang.String[] args)

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.