|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjenes.stage.AbstractStage<T>
jenes.stage.operator.Operator<T>
jenes.stage.operator.Crossover<IntegerChromosome>
jenes.tutorials.problem3.TSPCityCenteredCrossover
public class TSPCityCenteredCrossover
Algorithm description: parent1 5 2 1 4 6 3 parent2 1 3 2 4 6 5 child1 _ _ _ _ _ _ child2 _ _ _ _ _ _ Step 1: a city is choosed randomly. We copy all the cities until the selected one from each parent to each child (parent1 in child1 and parent2 in child2) parent1 5 2 1 4 6 3 parent2 1 3 2 4 6 5 child1 5 2 _ _ _ _ child2 1 3 2 _ _ _ Step 2: we fill child1 getting missing elements from parent2; these ones will have the same parent2 order parent1 5 2 1 4 6 3 parent2 1 3 2 4 6 5 child1 5 2 1 3 4 6 child2 1 3 2 5 4 6 We repeat these steps for child2
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 | |
---|---|
TSPCityCenteredCrossover(double pCross)
|
Method Summary | |
---|---|
protected void |
cross(Individual<IntegerChromosome>[] offsprings)
This method implements the crossover operation. |
protected int |
spread()
Returns the number of chromosomes (i.e. 2) this operator entails. |
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 |
---|
public TSPCityCenteredCrossover(double pCross)
Method Detail |
---|
protected int spread()
spread
in class Crossover<IntegerChromosome>
protected void cross(Individual<IntegerChromosome>[] offsprings)
cross
in class Crossover<IntegerChromosome>
offsprings
- the chromosomes to be crossed.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |