jenes.stage.operator.common
Class OnePointCrossover<T extends Chromosome>

java.lang.Object
  extended by jenes.stage.AbstractStage<T>
      extended by jenes.stage.operator.Operator<T>
          extended by jenes.stage.operator.Crossover<T>
              extended by jenes.stage.operator.common.OnePointCrossover<T>
Type Parameters:
T - The class of chromosomes to work with.

public class OnePointCrossover<T extends Chromosome>
extends Crossover<T>

A one-point crossover operator. It performes the simplest crossover algorithm according to a specified probability. It represents a 2-parents and 2-children crossover. A cross-point is randomly chosen and the genes are crossed.

Since:
1.0
Version:
1.2
Author:
Luigi Troiano, Pierpaolo Lombardi, Giuseppe Pascale, Thierry Bodhuin
See Also:
Individual, Chromosome

Nested Class Summary
 
Nested classes/interfaces inherited from class jenes.stage.operator.Crossover
Crossover.Statistics
 
Field Summary
 
Fields inherited from class jenes.stage.operator.Crossover
probability
 
Fields inherited from class jenes.stage.operator.Operator
random, statistics
 
Fields inherited from class jenes.stage.AbstractStage
biggerIsBetter, ga
 
Constructor Summary
OnePointCrossover(double probability)
          Constructs a new one-point crossover with the specified probability
 
Method Summary
protected  void cross(Individual<T>[] offsprings)
          Executes the crossover.
protected  int spread()
          Returns the number of individuals involved by this crossover operator
 
Methods inherited from class jenes.stage.operator.Crossover
getProbability, init, process, setProbability
 
Methods inherited from class jenes.stage.operator.Operator
getStatistics, updateStatistics
 
Methods inherited from class jenes.stage.AbstractStage
dispose, isBiggerBetter, setBiggerIsBetter, setBiggerIsBetter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OnePointCrossover

public OnePointCrossover(double probability)
Constructs a new one-point crossover with the specified probability

Parameters:
probability - the crossover probability
Method Detail

spread

protected int spread()
Description copied from class: Crossover
Returns the number of individuals involved by this crossover operator

Specified by:
spread in class Crossover<T extends Chromosome>
Returns:
the number of individuals required by crossover

cross

protected void cross(Individual<T>[] offsprings)
Description copied from class: Crossover
Executes the crossover. At the invocation time the specified array contains the individuals to be modify by cross; at the return time it contains the output crossover individuals.

Specified by:
cross in class Crossover<T extends Chromosome>
Parameters:
offsprings - the individuals to be modified.