KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jgap > GeneticOperator


1 /*
2  * This file is part of JGAP.
3  *
4  * JGAP offers a dual license model containing the LGPL as well as the MPL.
5  *
6  * For licencing information please see the file license.txt included with JGAP
7  * or have a look at the top of class org.jgap.Chromosome which representatively
8  * includes the JGAP license policy applicable for any file delivered with JGAP.
9  */

10 package org.jgap;
11
12 import java.util.List JavaDoc;
13
14 /**
15  * A GeneticOperator represents an operation that takes place on
16  * a population of Chromosomes during the evolution process. Examples
17  * of genetic operators include reproduction, crossover, and mutation.
18  * This interface contains only one method--operate()--which is responsible
19  * for performing the genetic operation on the current population of
20  * Chromosomes.
21  *
22  * @author Neil Rotstan
23  * @author Klaus Meffert
24  * @since 1.0
25  */

26 public interface GeneticOperator
27     extends java.io.Serializable JavaDoc {
28
29   /** String containing the CVS revision. Read out via reflection!*/
30   final static String JavaDoc CVS_REVISION = "$Revision: 1.12 $";
31
32   /**
33    * The operate method will be invoked on each of the genetic operators
34    * referenced by the current Configuration object during the evolution
35    * phase. Operators are given an opportunity to run in the order that
36    * they are added to the Configuration. Implementations of this method
37    * may reference the population of Chromosomes as it was at the beginning
38    * of the evolutionary phase and/or they may instead reference the
39    * candidate Chromosomes, which are the results of prior genetic operators.
40    * In either case, only Chromosomes added to the list of candidate
41    * chromosomes will be considered for natural selection.<p>
42    * The parameters a_population and a_candidateChromosomes may refer to the same
43    * list of chromosomes for performance issues. Thus would mean an in-place
44    * modification. In ealier JGAP versions it was suggested never modifying the
45    * input population. Please refer to implementations delivered with JGAP to
46    * get a picture of the way non-susceptible in-place modifications are
47    * possible. If wrongly done, ConcurrentModificationException could be risen
48    * when accessing the population by an iterator in a GeneticOperator.
49    * Or, if population.getChromosomes().size() was used inside a loop where
50    * chromosomes were added to the input population this could lead to an
51    * infinite loop in worst case.
52    *
53    * @param a_population the population of chromosomes from the current
54    * evolution prior to exposure to any genetic operators. Chromosomes in this
55    * array should not be modified. Please, notice, that the call in
56    * Genotype.evolve() to the implementations of GeneticOperator overgoes this
57    * due to performance issues
58    * @param a_candidateChromosomes the pool of chromosomes that have been
59    * selected for the next evolved population
60    *
61    * @author Neil Rotstan
62    * @author Klaus Meffert
63    * @since 2.0 (earlier versions referenced the Configuration object)
64    */

65   public void operate(final Population a_population,
66                       final List JavaDoc a_candidateChromosomes);
67 }
68
Popular Tags