|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectart.ga.Chromosome
This class contains methods useful to interact with the chromosome, that is a representation in the genetic algorithm's formalism of a "solution" of the simulated agent. Each individual corresponds to a solution of the agent. Each chromosome is composed by different genomes, the genome represent a "rule". A solution is composed by different rules. This is not a standard Holland's approach to genetic algorithm, the standard approach use a single genome for each chromosome and than the solution coincide with the only one rule).
| Constructor Summary | |
Chromosome(GaConfiguration configuration,
Population population)
Constructor of the class |
|
| Method Summary | |
int |
getAge()
Get how many generation ago the Chromosome is born. |
Genome[] |
getBody()
Get the Genomes composing the Chromosome's instance. |
boolean |
getChild()
Get if the chromosome has been generated in the last evolution occurred. |
double |
getFitness()
Get the Chromosome's fitness. |
Genome |
getGenome(int position)
Get a specific Genome of the Chromosome identified by the position in the body's array. |
Population |
getMyPopulation()
Get the Population the Chromosome's instance belong to. |
int |
getNumberOfRules()
|
double |
getRescaledFitness()
Get the fitness rescaled for the roulette wheel selection. |
int[] |
getRule(int ruleNumber)
|
boolean |
getSelectedForDie()
Get if the Chromosome has been selected for die during the "selection for die" event of the last evolution. |
boolean |
getSelectedForReproduction()
Get if the Chromosome has been selected for reproduction during the "selection for reproduction" event of the last evolution. |
void |
initializeChromosome()
Initialize the Chromosome with generated genomes. |
boolean |
isFitnessEvaluated()
Get if fitness has been evaluated for the Chromosome since the last evolution. |
void |
print()
Print to screen some Chromosome's information. |
void |
print(boolean printGenomeDetails)
Print to screen some Chromosome's information. |
void |
setAge(int age)
Get how many generation ago the Chromosome is born. |
void |
setBody(Genome[] body)
Set the Genomes composing the Chromosome's instance. |
void |
setChild(boolean child)
Set if the chromosome has been generated in the last evolution occurred. |
void |
setFitness(double fitness)
Set the Chromosome's fitness. |
void |
setFitnessEvaluated(boolean b)
Set if fitness has been evaluated for the Chromosome since the last evolution. |
void |
setRescaledFitness(double scaleFactor)
Compute and set the fitness rescaled for the roulette wheel selection. |
void |
setRescaledFitnessEvaluated(boolean b)
Set if the fitness is rescaled. |
void |
setSelectedForDie(boolean option)
Set if the Chromosome has been selected for die during the "selection for die" event of the last evolution. |
void |
setSelectedForReproduction(boolean option)
Set if the Chromosome has been selected for reproduction during the "selection for reproduction" event of the last evolution. |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public Chromosome(GaConfiguration configuration,
Population population)
configuration - Configuration from which get required parameterspopulation - Population the Chromosome's instance belonging to.| Method Detail |
public int getAge()
public Genome[] getBody()
public boolean getChild()
public double getFitness()
getFitness in interface GaSolutionEvents.evaluateFitness(Population, Fitness),
GaManager.setFitness(GaSolution, double)public Genome getGenome(int position)
position - Position in the body[] array of the requested Genome
public Population getMyPopulation()
public boolean getSelectedForDie()
Events.selectChromosomeForDie(Population)public boolean getSelectedForReproduction()
Events.selectChromosomeForReproduction(Population)public boolean isFitnessEvaluated()
Events.evaluateFitness(Population, Fitness),
GaManager.setFitness(GaSolution, double)public void print(boolean printGenomeDetails)
printGenomeDetails - Option if print also information on
the Genomes composing the printing Chromosome.public void print()
print in interface GaSolutionpublic void setAge(int age)
age - Chromosome's agepublic void setBody(Genome[] body)
body - Array of Genomes composing chromosome.public void setChild(boolean child)
child - True if the Chromosome is a "child"public void setFitness(double fitness)
setFitness in interface GaSolutionfitness - FitnessEvents.evaluateFitness(Population, Fitness),
GaManager.setFitness(GaSolution, double)public void setFitnessEvaluated(boolean b)
b - If fitness has been evaluatedEvents.evaluateFitness(Population, Fitness),
GaManager.setFitness(GaSolution, double)public void initializeChromosome()
public void setSelectedForDie(boolean option)
option - If selected for dieEvents.selectChromosomeForDie(Population)public void setSelectedForReproduction(boolean option)
option - If selected for reproductionEvents.selectChromosomeForReproduction(Population)public double getRescaledFitness()
public void setRescaledFitnessEvaluated(boolean b)
b - If fitness rescaledpublic void setRescaledFitness(double scaleFactor)
scaleFactor - Scale factor computed as -(minFitness-(stDev/1000))public int[] getRule(int ruleNumber)
getRule in interface GaSolutionpublic int getNumberOfRules()
getNumberOfRules in interface GaSolution
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||