JAGA Homepage

org.jaga.definitions
Interface ReproductionAlgorithm

All Known Implementing Classes:
CombinedReproductionAlgorithm, FunctionTreeMutation, FunctionTreeXOver, Mutation, PolypeptidePatternElongation, PolypeptidePatternMutation, PolypeptidePatternXOver, SimpleBinaryMutation, SimpleBinaryXOver, SimpleBinaryXOverWithMutation, XOver

public interface ReproductionAlgorithm

Basis for all algorithms which perform the reproduction of individuals.

Project: JAGA - Java API for Genetic Algorithms.

Company: University College London and JAGA.Org (http://www.jaga.org).

Copyright: (c) 2004 by G. Paperin.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, ONLY if you include a note of the original author(s) in any redistributed/modified copy.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA or see http://www.gnu.org/licenses/gpl.html

Version:
JAGA public release 1.0 beta
Author:
Greg Paperin (greg@jaga.org)

Method Summary
 java.lang.Class getApplicableClass()
          Returns the class of individuals handled by this reproduction algorithm.
 int getRequiredNumberOfParents()
          Returns, how many individuals are required to produce one new individual whwn using this reproduction algorithm.
 Individual[] reproduce(Individual[] parents, GAParameterSet params)
          Reproduces the specified individuals.
 

Method Detail

getRequiredNumberOfParents

int getRequiredNumberOfParents()
Returns, how many individuals are required to produce one new individual whwn using this reproduction algorithm. If any number of parents is permitted (e.g. for most kinds of mutation), this method should return -1.

Returns:
The required length of the array-parameter parents to the method reproduce or -1 if any length is parmitted.

getApplicableClass

java.lang.Class getApplicableClass()
Returns the class of individuals handled by this reproduction algorithm.

Returns:
The required type of the array-members in the parameter parents to the method ReproductionAlgorithm.reproduce.

reproduce

Individual[] reproduce(Individual[] parents,
                       GAParameterSet params)
                       throws java.lang.ClassCastException,
                              java.lang.IllegalArgumentException
Reproduces the specified individuals.

Parameters:
parents - The individuals to reproduce. The type of objects in this array must be the class returned by getApplicableClass. The number of objects in this array must be the same as returned by getRequiredNumberOfParents.
params - Experiment parameters.
Returns:
The children - i.e. the result of the reproduction of parents.
Throws:
java.lang.ClassCastException - If a parent is not of a class which can be cast to the class returned by getApplicableClass.
java.lang.ClassCastException - If the number of parents does not correspond to the required number obtained via getRequiredNumberOfParents.
java.lang.IllegalArgumentException

JAGA Homepage

Go to JAGA Homepage