eaLib API Docs
Last Modified : January 7 2002

mss.ea.mut
Class ReverseArrayMutation

java.lang.Object
  |
  +--mss.ea.core.GeneticOperator
        |
        +--mss.ea.mut.Mutation
              |
              +--mss.ea.mut.ChromosomeMutation
                    |
                    +--mss.ea.mut.ArrayMutation
                          |
                          +--mss.ea.mut.ReverseArrayMutation

public class ReverseArrayMutation
extends ArrayMutation

Swap mutation of a string. This operator will randomly reverse a section of an array..

Since:
0.1
Version:
0.1 (06-13-2001)
Author:
Andreas Rummler

Field Summary
protected  int lowerBound
           
protected  float rangePercentage
           
protected  int upperBound
           
 
Fields inherited from class mss.ea.mut.ArrayMutation
rand
 
Fields inherited from class mss.ea.mut.ChromosomeMutation
mutationPropability
 
Fields inherited from class mss.ea.core.GeneticOperator
description, ID, name
 
Constructor Summary
ReverseArrayMutation()
          Constructor.
ReverseArrayMutation(float propability)
          Constructor with mutation propability.
ReverseArrayMutation(float propability, float rangePercentage)
          Constructor with mutation propability and random range.
ReverseArrayMutation(float propability, int lBound, int uBound)
          Constructor with mutation propability, lower and upper reverse bound.
 
Method Summary
 void mutate(ArrayChromosome cr)
          Performs the mutation.
protected  int[] randomRange(int length)
          Helper for calculating a valid reverse range, dependent from length of array and percentage value.
protected  void reverse(java.lang.Object co)
          Reverses an array of objects.
 
Methods inherited from class mss.ea.mut.ArrayMutation
mutate
 
Methods inherited from class mss.ea.core.GeneticOperator
getDescription, getID, getName, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

lowerBound

protected int lowerBound

upperBound

protected int upperBound

rangePercentage

protected float rangePercentage
Constructor Detail

ReverseArrayMutation

public ReverseArrayMutation()
Constructor. The mutation propability is set to 0.05.

ReverseArrayMutation

public ReverseArrayMutation(float propability)
Constructor with mutation propability.
Parameters:
propability - mutation propability

ReverseArrayMutation

public ReverseArrayMutation(float propability,
                            float rangePercentage)
Constructor with mutation propability and random range.
Parameters:
propability - mutation propability
rangePercentage - percentage value of the length of a randomly selected range to reverse

ReverseArrayMutation

public ReverseArrayMutation(float propability,
                            int lBound,
                            int uBound)
Constructor with mutation propability, lower and upper reverse bound.
Parameters:
propability - mutation propability
lBound - lower bound for reversing
uBound - upper bound for reversing
Method Detail

mutate

public void mutate(ArrayChromosome cr)
            throws MutationException
Performs the mutation.
Overrides:
mutate in class ArrayMutation
Parameters:
cr - chromosome of type array
Throws:
MutationException - thrown, if operator fails

reverse

protected void reverse(java.lang.Object co)
Reverses an array of objects. The reverse is done dependent on lowerBound and upperBound.
Parameters:
co - array to reverse

randomRange

protected int[] randomRange(int length)
Helper for calculating a valid reverse range, dependent from length of array and percentage value.
Parameters:
length - length of the array
Returns:
integer array with lower and upper bound

eaLib API Docs
Last Modified : January 7 2002

Copyright © 2000-2001 Technical University of Ilmenau, Department ESS