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.


Constructor Index

 o Ind()
Creates one individual.
 o Ind(Ind)
Copy constructor.
 o Ind(int)
Creates one individual with indSize genes.

Method Index

 o add(Integer)
Adds new gene.
 o calcFitness()
Calculates individual fitness value using Function class.
 o getFitness()
Returns individual fitness value.
 o getGene(int)
Returns gene(pos).
 o getGeneValue(int)
Returns gene(pos) integer value.
 o indexOf(int)
Searches for a gene value and returns its position.
 o mutate()
Calls Function class mutation method.
 o setGene(Integer, int)
Sets gene(pos) value.
 o size()
Returns the individual size (number of genes).

Constructors

 o Ind
 public Ind()
Creates one individual. Number of genes is read from Function class.

 o Ind
 public Ind(int indSize)
Creates one individual with indSize genes.

 o Ind
 public Ind(Ind ind)
Copy constructor.

Methods

 o getGeneValue
 public int getGeneValue(int pos)
Returns gene(pos) integer value.

 o getGene
 public Integer getGene(int pos)
Returns gene(pos).

 o setGene
 public void setGene(Integer gene,
                     int pos)
Sets gene(pos) value.

 o getFitness
 public double getFitness()
Returns individual fitness value.

 o calcFitness
 public void calcFitness()
Calculates individual fitness value using Function class.

 o size
 public int size()
Returns the individual size (number of genes).

 o indexOf
 public int indexOf(int value)
Searches for a gene value and returns its position.

 o mutate
 public void mutate()
Calls Function class mutation method.

 o add
 public void add(Integer gene)
Adds new gene.


All Packages  Class Hierarchy  This Package  Previous  Next  Index