|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectadams.core.ConsoleObject
adams.core.option.AbstractOptionHandler
adams.optimise.AbstractOptimiser
adams.optimise.genetic.AbstractGeneticAlgorithm
adams.optimise.genetic.PackDataGeneticAlgorithm
adams.optimise.GeneticAlgorithm
public class GeneticAlgorithm
Morticia (GEX).
Valid options are:-D (property: debug)
If set to true, scheme may output additional info to the console.
-num-chrom <int> (property: numChrom)
The number of chromosomes, ie, the population size.
default: 50
-num-iter <int> (property: numIterations)
The number of iterations to perform.
default: 10000000
-seed <int> (property: seed)
The seed value for the random number generator.
default: 1
-favor-zeroes (property: favorZeroes)
Whether to favor 0s instead of 1s.
-best <java.lang.String> (property: bestRange)
The range of the best attributes.
default: -none-
-max-train <int> (property: maxTrainTime)
The maximum number of seconds to training time (0 = unlimited time).
default: 0
-notify <int> (property: notificationInterval)
The time interval in seconds after which notification events about changes
in the fitness can be sent (-1 = never send notifications; 0 = whenever
a change occurs).
default: -1
| Nested Class Summary | |
|---|---|
static class |
GeneticAlgorithm.GAJob
Class for multithreading the ga. |
| Field Summary | |
|---|---|
protected int |
m_bits
|
protected FitnessFunction |
m_fitnessfn
|
protected Long |
m_LastNotificationTime
the timestamp the last notification got sent. |
protected PackDataDef |
m_pdd
|
Hashtable<String,Double> |
m_StoredResults
the cache for results. |
protected int |
m_zerocount
|
| Fields inherited from class adams.optimise.genetic.AbstractGeneticAlgorithm |
|---|
m_BestRange, m_FavorZeroes, m_Fitness, m_Genes, m_Iterations, m_MaxTrainTime, m_NumChrom, m_NumGenes, m_Random, m_Running, m_Seed, m_TrainStart, PROPS_FILTER, PROPS_MASK, PROPS_RELATION |
| Fields inherited from class adams.optimise.AbstractOptimiser |
|---|
m_bestf, m_bestv |
| Fields inherited from class adams.core.option.AbstractOptionHandler |
|---|
m_DebugLevel, m_OptionManager |
| Constructor Summary | |
|---|---|
GeneticAlgorithm()
The default constructor. |
|
| Method Summary | |
|---|---|
protected void |
addResult(String key,
Double val)
Adds a result to the cache. |
String |
bitsTipText()
Returns the tip text for this property. |
void |
calcFitness()
Calculates the fitness of the population. |
double |
calcNewFitness(FitnessFunction ff,
int[] weights)
Calculates the new fitness. |
void |
checkBest(Double fitness,
OptData vars,
FitnessFunction ff,
int zerocount)
|
void |
cleanUp()
Cleans up data structures, frees up memory. |
protected void |
clearResults()
Clears all currently stored results. |
void |
defineOptions()
Adds options to the internal list of options. |
int |
getBits()
Gets the number of bits. |
PackDataDef |
getDataDef()
|
Vector<PackData> |
getDataSetups()
|
protected Double |
getResult(String key)
Returns a value from the cache. |
String |
globalInfo()
Returns a string describing the object. |
protected void |
initialize()
Initializes the members. |
static void |
main(String[] args)
|
OptData |
optimise(OptData datadef,
FitnessFunction fitness)
|
protected void |
preRun()
Some more initializations. |
void |
reset()
Resets the genetic algorihtm. |
void |
setBits(int value)
Bits per gene. |
String |
weightsToString(int[] weights)
Turns the weights into a string representation. |
| Methods inherited from class adams.optimise.genetic.PackDataGeneticAlgorithm |
|---|
getInitialSetups, init, print, printBits |
| Methods inherited from class adams.optimise.genetic.AbstractGeneticAlgorithm |
|---|
bestRangeTipText, copyGene, doCrossovers, doMutations, doMutations2, favorZeroesTipText, forCommandLine, forName, getBestRange, getFavorZeroes, getFitness, getGene, getGeneticAlgorithms, getIterations, getMaxTrainTime, getNumChrom, getNumGenes, getSeed, hasMoreZeroes, init, isRunning, iterationsTipText, maxTrainTimeTipText, numChromTipText, postRun, run, runGeneticAlgorithm, seedTipText, setBestRange, setBestRange, setFavorZeroes, setGene, setGene, setIterations, setMaxTrainTime, setNumChrom, setSeed, sort, stop, storeSetup, updateHeader |
| Methods inherited from class adams.optimise.AbstractOptimiser |
|---|
checkBest, compareTo, destroy, equals, getOptimisers, shallowCopy, shallowCopy |
| Methods inherited from class adams.core.option.AbstractOptionHandler |
|---|
cleanUpOptions, debug, debug, debugLevelTipText, finishInit, getDebugLevel, getOptionManager, isDebugOn, newOptionManager, setDebugLevel, toCommandLine, toString |
| Methods inherited from class adams.core.ConsoleObject |
|---|
getDebugging, getSystemErr, getSystemOut, sizeOf |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected int m_bits
protected int m_zerocount
protected PackDataDef m_pdd
protected FitnessFunction m_fitnessfn
protected Long m_LastNotificationTime
public Hashtable<String,Double> m_StoredResults
| Constructor Detail |
|---|
public GeneticAlgorithm()
| Method Detail |
|---|
protected void addResult(String key,
Double val)
key - the key of the resultval - the value to addpublic void reset()
reset in class AbstractGeneticAlgorithmprotected Double getResult(String key)
key - the key of the result
protected void clearResults()
public String weightsToString(int[] weights)
weights - the weights to turn into a string
public double calcNewFitness(FitnessFunction ff,
int[] weights)
public void checkBest(Double fitness,
OptData vars,
FitnessFunction ff,
int zerocount)
public String globalInfo()
globalInfo in class AbstractOptionHandlerprotected void initialize()
initialize in class AbstractGeneticAlgorithmpublic void defineOptions()
defineOptions in interface OptionHandlerdefineOptions in class AbstractGeneticAlgorithmpublic void setBits(int value)
value - the number of bits.public int getBits()
public String bitsTipText()
public void calcFitness()
calcFitness in class AbstractGeneticAlgorithmprotected void preRun()
preRun in class AbstractGeneticAlgorithmpublic PackDataDef getDataDef()
getDataDef in class PackDataGeneticAlgorithmpublic Vector<PackData> getDataSetups()
getDataSetups in class PackDataGeneticAlgorithm
public OptData optimise(OptData datadef,
FitnessFunction fitness)
optimise in class AbstractOptimiserpublic void cleanUp()
cleanUp in interface CleanUpHandlercleanUp in class AbstractOptimiserpublic static void main(String[] args)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||