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
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 java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
lowerBound
protected int lowerBound
upperBound
protected int upperBound
rangePercentage
protected float rangePercentage
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 propabilityrangePercentage
- 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 propabilitylBound
- lower bound for reversinguBound
- upper bound for reversing
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
Copyright © 2000-2001 Technical University of Ilmenau, Department ESS