eaLib API Docs
Last Modified : January 7 2002

mss.ea.mut
Class ReverseListMutation

java.lang.Object
  |
  +--mss.ea.core.GeneticOperator
        |
        +--mss.ea.mut.Mutation
              |
              +--mss.ea.mut.ChromosomeMutation
                    |
                    +--mss.ea.mut.ListMutation
                          |
                          +--mss.ea.mut.ReverseListMutation

public class ReverseListMutation
extends ListMutation

Reverse mutation of a list. This operator will randomly reverse a section of a list.

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.ListMutation
rand
 
Fields inherited from class mss.ea.mut.ChromosomeMutation
mutationPropability
 
Fields inherited from class mss.ea.core.GeneticOperator
description, ID, name
 
Constructor Summary
ReverseListMutation()
          Constructor.
ReverseListMutation(float propability)
          Constructor with mutation propability.
ReverseListMutation(float propability, float rangePercentage)
          Constructor with mutation propability and length of reversed section.
ReverseListMutation(float propability, int lBound, int uBound)
          Constructor with mutation propability, lower and upper reverse bound.
 
Method Summary
 void mutate(ListChromosome 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.util.List co)
          Reverses a list.
 
Methods inherited from class mss.ea.mut.ListMutation
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

ReverseListMutation

public ReverseListMutation()
Constructor. The mutation propability is set to 0.05. The length of the reversed section randomly calculated.

ReverseListMutation

public ReverseListMutation(float propability)
Constructor with mutation propability. The length of the reversed section randomly calculated.
Parameters:
propability - mutation propability

ReverseListMutation

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

ReverseListMutation

public ReverseListMutation(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(ListChromosome cr)
            throws MutationException
Performs the mutation.
Overrides:
mutate in class ListMutation
Parameters:
cr - chromosome of type array
Throws:
MutationException - thrown, if operator fails

reverse

protected void reverse(java.util.List co)
                throws java.lang.Exception
Reverses a list. The reverse is done dependent on lowerBound, upperBound and percentageRange.
Parameters:
co - list 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