|
dLife Home Page | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectdlife.sys.SerializationBase
dlife.ga.Individual
public class Individual
This class represents an individual in an evolving population. An Individual is essentially a collection of Genes with a fitness value. This class implements Comparable to make the Individuals orderable by their fitness values.
| Constructor Summary | |
|---|---|
Individual()
Construct a new empty Individual with 0 fitness. |
|
| Method Summary | |
|---|---|
void |
addGene(Gene g)
Add a Gene to the genotype of this Individual. |
int |
compareTo(Individual ind)
Compare the fitness of this Individual to the provided Individual. |
Individual |
copy()
Produce a new Individual that is an exact copy of this Individual. |
boolean |
equals(Object obj)
Compare two Individuals and return true if they have exactly the same Genes. |
double |
getFitness()
Get the fitness of this Individual. |
Gene |
getGene(int index)
Get the specified Gene from this Individual. |
ArrayList<Gene> |
getGenes()
Get all of the Genes from this Individual as an ArrayList. |
int |
getSize()
Get the number of Gene's contained in this Individual. |
Iterator<Gene> |
iterator()
Get an Iterator for the Gene's in this Individual |
Individual |
randomCopy()
Produce a new Individual that has the same type and number of Genes as this Individual but the value of the Genes are randomized. |
void |
setFitness(double fitness)
Set the fitness value of this Individual. |
String |
toString()
Get a String representation of this Individual. |
| Methods inherited from class dlife.sys.SerializationBase |
|---|
read, write |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Individual()
| Method Detail |
|---|
public void addGene(Gene g)
g - the Gene to be added.public Gene getGene(int index)
index - the index of the Gene to get.
public ArrayList<Gene> getGenes()
public int getSize()
public String toString()
toString in class Objectpublic int compareTo(Individual ind)
compareTo in interface Comparable<Individual>ind - an Individual to be compared to this one.
public boolean equals(Object obj)
equals in class Objectobj - the Individual to compare to this one.
public void setFitness(double fitness)
fitness - the new fitness for this Individual.public double getFitness()
public Individual copy()
public Individual randomCopy()
public Iterator<Gene> iterator()
iterator in interface Iterable<Gene>
|
dLife Home Page | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||