From 8189116ea4b5db4675e31dfd04a5687d55e29262 Mon Sep 17 00:00:00 2001 From: Eduardo Pedroni Date: Tue, 6 May 2014 14:29:37 +0100 Subject: Added javadocs, made minor changes to the comments --- doc/jcgp/JCGP.html | 704 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 704 insertions(+) create mode 100644 doc/jcgp/JCGP.html (limited to 'doc/jcgp/JCGP.html') diff --git a/doc/jcgp/JCGP.html b/doc/jcgp/JCGP.html new file mode 100644 index 0000000..9005792 --- /dev/null +++ b/doc/jcgp/JCGP.html @@ -0,0 +1,704 @@ + + + + + +JCGP + + + + + + + + +
+ + + + + + + +
+ + + +
+
jcgp
+

Class JCGP

+
+
+ +
+
    +
  • +
    +
    +
    public class JCGP
    +extends java.lang.Object
    +
    Top-level JCGP class. This class is the entry point for a CGP experiment. +

    + An instance of JCGP encapsulates the entire experiment. It contains a Resources + object which can be retrieved via a getter. Modules can be selected using their + respective setters. +

    + The flow of the experiment is controlled using start(), nextGeneration() + and reset(). Files can be loaded with their respective load methods and + chromosome configurations can be saved with saveChromosome(). +

    + JCGP supports an extra console in addition to System.console(), so that messages + can also be printed to a GUI, for example. This extra console can be set with setConsole(), + and must implement jcgp.resources.Console.
    +
    +
    Author:
    +
    Eduardo Pedroni
    +
    +
  • +
+
+
+ +
+
+
    +
  • + +
      +
    • + + +

      Constructor Detail

      + + + +
        +
      • +

        JCGP

        +
        public JCGP()
        +
        Creates a new instance of JCGP.
        +
      • +
      +
    • +
    + +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        main

        +
        public static void main(java.lang.String... args)
        +
        JCGP main method, this is used to execute JCGP from the command line. +

        + In this case the program works in the same way as the classic CGP implementation, + requiring a .par file and an optional problem data file. As in the traditional CGP + implementation, the program must be compiled with the right problem type selected.
        +
        +
        Parameters:
        +
        args - one or more files needed to perform the experiment.
        +
        +
      • +
      + + + +
        +
      • +

        getResources

        +
        public ModifiableResources getResources()
        +
        Returns a reference to the ModifiableResources used by the + experiment.
        + Use this with care, since changing experiment parameters may + have unintended effects if not done properly.
        +
        +
        Returns:
        +
        a reference to the experiment's resources.
        +
        +
      • +
      + + + +
        +
      • +

        getPopulation

        +
        public Population getPopulation()
        +
        +
        Returns:
        +
        a reference to the experiment's population.
        +
        +
      • +
      + + + +
        +
      • +

        getMutators

        +
        public java.util.ArrayList<Mutator> getMutators()
        +
        +
        Returns:
        +
        a complete list of the experiment's mutators.
        +
        +
      • +
      + + + +
        +
      • +

        getMutator

        +
        public Mutator getMutator()
        +
        +
        Returns:
        +
        the currently selected mutator.
        +
        +
      • +
      + + + +
        +
      • +

        getEvolutionaryStrategies

        +
        public java.util.ArrayList<EvolutionaryStrategy> getEvolutionaryStrategies()
        +
        +
        Returns:
        +
        a complete list of the experiment's evolutionary strategies.
        +
        +
      • +
      + + + +
        +
      • +

        getEvolutionaryStrategy

        +
        public EvolutionaryStrategy getEvolutionaryStrategy()
        +
        +
        Returns:
        +
        the currently selected evolutionary strategy.
        +
        +
      • +
      + + + +
        +
      • +

        getProblems

        +
        public java.util.ArrayList<Problem> getProblems()
        +
        +
        Returns:
        +
        a complete list of the experiment's problem types.
        +
        +
      • +
      + + + +
        +
      • +

        getProblem

        +
        public Problem getProblem()
        +
        +
        Returns:
        +
        the currently selected problem type.
        +
        +
      • +
      + + + +
        +
      • +

        setMutator

        +
        public void setMutator(int index)
        +
        +
        Parameters:
        +
        index - the index of the desired mutator.
        +
        +
      • +
      + + + +
        +
      • +

        setEvolutionaryStrategy

        +
        public void setEvolutionaryStrategy(int index)
        +
        +
        Parameters:
        +
        index - the index of the desired evolutionary strategy.
        +
        +
      • +
      + + + +
        +
      • +

        setProblem

        +
        public void setProblem(int index)
        +
        +
        Parameters:
        +
        index - the index of the desired problem type.
        +
        +
      • +
      + + + +
        +
      • +

        nextGeneration

        +
        public void nextGeneration()
        +
        Performs one full generational cycle. More specifically, + this method evaluates the current population using the + selected problem, and checks whether a solution has been found. +
        + If the experiment is to continue, a new generation is created + using the selected evolutionary strategy and mutator. +

        + This method also deals with ending runs, in other words, + a new population is created at the end of each run automatically. + When all runs have been performed, this method sets the experiment + finished flag and does nothing until reset() is called.
        +
      • +
      + + + +
        +
      • +

        start

        +
        public void start()
        +
        This method calls nextGeneration() in a loop + until the experiment is flagged as finished. This is + performed on the same thread of execution, so this + method will most likely block for a significant amount + of time (problem-dependent, but anywhere from seconds to days). +
        + Once the experiment is finished, calling this method does + nothing until reset() is called.
        +
      • +
      + + + +
        +
      • +

        reset

        +
        public void reset()
        +
        Resets the experiment. +
        + More specifically: this creates a new population, resets + the current generation and run parameters to 1 and prints + a complete list of the experiment's parameters.
        +
      • +
      + + + +
        +
      • +

        loadParameters

        +
        public void loadParameters(java.io.File file)
        +
        When given a .par file, this method loads the parameters into the + experiment's resources. This causes an experiment-wide reset.
        +
        +
        Parameters:
        +
        file - the file to parse.
        +
        +
      • +
      + + + +
        +
      • +

        loadProblemData

        +
        public void loadProblemData(java.io.File file)
        +
        Parses a problem data file. This is problem-dependent, not + all problems require a data file.
        +
        +
        Parameters:
        +
        file - the file to parse.
        +
        +
      • +
      + + + +
        +
      • +

        loadChromosome

        +
        public void loadChromosome(java.io.File file,
        +                           int chromosomeIndex)
        +
        Loads a chromosome from the given file into + the specified population index.
        +
        +
        Parameters:
        +
        file - the chromosome to parse.
        +
        chromosomeIndex - the population index into which to parse.
        +
        +
      • +
      + + + +
        +
      • +

        saveChromosome

        +
        public void saveChromosome(java.io.File file,
        +                           int chromosomeIndex)
        +
        Saves a copy of the specified chromosome + into the given file.
        +
        +
        Parameters:
        +
        file - the target file.
        +
        chromosomeIndex - the index of the chromosome to save.
        +
        +
      • +
      + + + +
        +
      • +

        isFinished

        +
        public boolean isFinished()
        +
        Returns the experiment's status. When finished, the only + way to continue is by calling reset().
        +
        +
        Returns:
        +
        true if the experiment is finished.
        +
        +
      • +
      + + + +
        +
      • +

        setConsole

        +
        public void setConsole(Console console)
        +
        Sets an extra console. The entire JCGP library prints + messages to System.console() but also to an + additional console, if one is defined. This is used so + that messages are printed on a user interface as well, + or written directly to a file, for example.
        +
        +
        Parameters:
        +
        console - the extra console to be used.
        +
        +
      • +
      +
    • +
    +
  • +
+
+
+ + +
+ + + + + + + +
+ + + + -- cgit v1.2.3