All Packages Class Hierarchy This Package Previous Next Index
Class geneticAlgorithm.Ind
java.lang.Object
|
+----geneticAlgorithm.Ind
- public class Ind
- extends Object
- implements Serializable
Ind class responsible for maintaining a vector of genes (integers) and a fitness value.
-
Ind()
- Creates one individual.
-
Ind(Ind)
- Copy constructor.
-
Ind(int)
- Creates one individual with indSize genes.
-
add(Integer)
- Adds new gene.
-
calcFitness()
- Calculates individual fitness value using Function class.
-
getFitness()
- Returns individual fitness value.
-
getGene(int)
- Returns gene(pos).
-
getGeneValue(int)
- Returns gene(pos) integer value.
-
indexOf(int)
- Searches for a gene value and returns its position.
-
mutate()
- Calls Function class mutation method.
-
setGene(Integer, int)
- Sets gene(pos) value.
-
size()
- Returns the individual size (number of genes).
Ind
public Ind()
- Creates one individual. Number of genes is read from Function class.
Ind
public Ind(int indSize)
- Creates one individual with indSize genes.
Ind
public Ind(Ind ind)
- Copy constructor.
getGeneValue
public int getGeneValue(int pos)
- Returns gene(pos) integer value.
getGene
public Integer getGene(int pos)
- Returns gene(pos).
setGene
public void setGene(Integer gene,
int pos)
- Sets gene(pos) value.
getFitness
public double getFitness()
- Returns individual fitness value.
calcFitness
public void calcFitness()
- Calculates individual fitness value using Function class.
size
public int size()
- Returns the individual size (number of genes).
indexOf
public int indexOf(int value)
- Searches for a gene value and returns its position.
mutate
public void mutate()
- Calls Function class mutation method.
add
public void add(Integer gene)
- Adds new gene.
All Packages Class Hierarchy This Package Previous Next Index