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
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 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
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 propabilityrangePercentage
- 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 propabilitylBound
- lower bound for reversinguBound
- upper bound for reversing
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
Copyright © 2000-2001 Technical University of Ilmenau, Department ESS