megamek.client.bot.ga
Class GA
java.lang.Object
megamek.client.bot.ga.GA
- Direct Known Subclasses:
- GAAttack, GALance
public abstract class GA
- extends java.lang.Object
|
Constructor Summary |
GA(int chromosomeDim,
int populationDim,
double crossoverProb,
double randomSelectionChance,
int maxGenerations,
double mutationProb)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
mutationProb
final double mutationProb
maxGenerations
final int maxGenerations
randomSelectionChance
final double randomSelectionChance
crossoverProb
final double crossoverProb
chromosomeDim
protected final int chromosomeDim
populationDim
protected final int populationDim
chromosomes
protected final Chromosome[] chromosomes
chromNextGen
Chromosome[] chromNextGen
genAvgDeviation
double[] genAvgDeviation
genAvgFitness
double[] genAvgFitness
best
protected final int best
GA
public GA(int chromosomeDim,
int populationDim,
double crossoverProb,
double randomSelectionChance,
int maxGenerations,
double mutationProb)
initPopulation
protected abstract void initPopulation()
doRandomMutation
protected abstract void doRandomMutation(int index)
getFitness
protected abstract double getFitness(int index)
doHeuristicPass
protected void doHeuristicPass()
getFittestChromosomesFitness
public double getFittestChromosomesFitness()
getRandom
int getRandom(int upperBound)
getRandom
double getRandom(double upperBound)
shouldDoExhaustive
protected boolean shouldDoExhaustive()
doExhaustiveSearch
protected void doExhaustiveSearch()
evolve
public int evolve()
getAvgFitness
protected double getAvgFitness()
getESquared
protected double getESquared()
selectTwoParents
protected int[] selectTwoParents()
computeFitnessRankings
void computeFitnessRankings()
doGeneticMating
void doGeneticMating()
copyNextGenToThisGen
void copyNextGenToThisGen()
doUniformCrossover
void doUniformCrossover(Chromosome c1,
Chromosome c2)