|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
T
- The type of Chromosomes accepted as input and returned by operations.public interface Chromosome<T extends Chromosome>
The abstract class Chromosome is the superclass of all chromosomes, providing the specification of genoma operations used by genetic operators during the algorithm evolution. Concretizations of the Chromosome class are required to actually implement an algorithm. There are some concrete chromosome types based on boolean, double, integer and object values. All of these are fixed length chromosomes, as the number of genes dosen't change during the algorithm iterations.
If necessary, a variable length chromosome can be implemented by subclassing this abstract class and specifying the abstract methods.
Method Summary | |
---|---|
Chromosome |
clone()
Performs a chromosome deep-cloning. |
void |
cross(T chromosome,
int from)
Exchanges the genes chromosome starting from a given position |
void |
cross(T chromosome,
int from,
int to)
Exchanges the genes chromosome within the range [from,to] |
boolean |
equals(T chromosome)
Compares the chromosome with another. |
void |
leftShift(int from,
int to)
Makes a left-shift of the genes between two positions. |
int |
length()
Returns the number of genes contained in the chromosome. |
void |
randomize()
Fills the chromosome with random value. |
void |
randomize(int pos)
Sets a random value in the specified position |
void |
rightShift(int from,
int to)
Makes a right-shift of the genes between two positions. |
void |
setAs(T chromosome)
Makes the chromosome a copy of another chromosome. |
void |
setDefaultValueAt(int pos)
Sets the default value at a given position |
void |
swap(int pos1,
int pos2)
Exchanges two genes at the specified positions |
Method Detail |
---|
void swap(int pos1, int pos2)
pos1
- the position of first genepos2
- the position of second genevoid randomize(int pos)
pos
- a position where to set the random valuevoid leftShift(int from, int to)
from
- the start position to be shiftedto
- the final position to be shiftedvoid rightShift(int from, int to)
from
- the start position to be shiftedto
- the final position to be shiftedvoid setDefaultValueAt(int pos)
pos
- the position where to set the default valueChromosome clone()
int length()
void randomize()
void setAs(T chromosome)
chromosome
- the chromosome to be copiedvoid cross(T chromosome, int from, int to)
chromosome
- the chromosome to cross withfrom
- the start position of the genes to exchangeto
- the final position of the genes to exchangevoid cross(T chromosome, int from)
chromosome
- the chromosome to cross withfrom
- the start position of the genes to exchangeboolean equals(T chromosome)
chromosome
- the cromosome to compare to.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |