jenes.tutorials.problem3
Class TSPScrambleMutator

java.lang.Object
  extended by jenes.stage.AbstractStage<T>
      extended by jenes.stage.operator.Operator<T>
          extended by jenes.stage.operator.Mutator<IntegerChromosome>
              extended by jenes.tutorials.problem3.TSPScrambleMutator

public class TSPScrambleMutator
extends Mutator<IntegerChromosome>

Tutorial showing how to implement problem specific operators. The problem faced in this example is the well known Tavel Salesman Problem (TSP) This class implements a specific mutations aimed at preserving permutations. Algorithm description: Two random indexes, i1 and i2, are choosed; the order of the elements within the range [i1,i2] changes randomly. For example:

       i1=0; i2=3
       position:    0 1 2 3 4 5
         start_chrom: 5 2 1 4 6 3
       end_chrom:   2 5 4 1 6 3
 

Since:
1.0
Version:
1.0
Author:
Luigi Troiano, Pierpaolo Lombardi

Nested Class Summary
 
Nested classes/interfaces inherited from class jenes.stage.operator.Mutator
Mutator.Statistics
 
Field Summary
 
Fields inherited from class jenes.stage.operator.Mutator
probability
 
Fields inherited from class jenes.stage.operator.Operator
random, statistics
 
Fields inherited from class jenes.stage.AbstractStage
biggerIsBetter, ga
 
Constructor Summary
TSPScrambleMutator(double pMut)
           
 
Method Summary
protected  void mutate(Individual<IntegerChromosome> t)
          Mutates a single individual.
 void randomize(IntegerChromosome chrom, int min, int max)
          Randomizes the elements chromosome within the range [min,max]
 
Methods inherited from class jenes.stage.operator.Mutator
getProbability, process, setProbability
 
Methods inherited from class jenes.stage.operator.Operator
getStatistics, updateStatistics
 
Methods inherited from class jenes.stage.AbstractStage
dispose, init, isBiggerBetter, setBiggerIsBetter, setBiggerIsBetter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TSPScrambleMutator

public TSPScrambleMutator(double pMut)
Method Detail

mutate

protected void mutate(Individual<IntegerChromosome> t)
Description copied from class: Mutator
Mutates a single individual. This abstract method is implemented according to a mutation policy

Specified by:
mutate in class Mutator<IntegerChromosome>
Parameters:
t - the individual to mutate

randomize

public void randomize(IntegerChromosome chrom,
                      int min,
                      int max)
Randomizes the elements chromosome within the range [min,max]

Parameters:
chrom - the individual to mutate
min - the lower bound
max - the upper bound