I
- Type of individuals in populationpublic class NeuralNetAlgorithm<I extends IIndividual>
extends <any>
Base implementation for all neural net algorithms
Modifier and Type | Field and Description |
---|---|
protected I |
bestIndividual
Best individual of last generation
|
protected java.util.List<I> |
bset
Current individuals set
|
protected double |
cratio
Ratio "elements created"/"elements remaining"
|
protected java.util.List<I> |
cset
Individuals generated
|
protected double |
currentBest
Current best fitness
|
protected double |
currentMean
Current mean fitness
|
protected <any> |
evaluator
Individuals evaluator
|
protected double |
fitDif
Difference between two fitness that we consider
enoung to say that the fitness has improved
|
protected int |
generation
Current generation
|
protected java.util.Comparator<I> |
individualsComparator
Comparator of individuals
|
protected int |
maxOfGenerations
Maximum of generations (stop criterium)
|
protected int |
mogbest
Maximum number of generations allowed without improving
the best fitness
|
protected int |
mogmean
Maximum number of generations allowed without improving
the fitness mean of best individuals
|
protected <any> |
mutator1
Individual mutator1
|
protected <any> |
mutator2
Individual mutator2
|
protected int |
nofselSecondMutator
Number of parents mutated with second mutator
|
protected int |
nogbest
Number of generations without improving best fitness
|
protected int |
nogmean
Number of generations without improving mean fitness
|
protected int |
percentageSecondMutator
Percentage of parents mutated with second mutator
|
protected int |
populationSize
Population size
|
protected double |
previousBest
Previous best fitness
|
protected double |
previousMean
Previous mean fitness
|
protected <any> |
provider
Individuals provider
|
protected java.util.List<I> |
pset1
Individuals selected as parents for first mutator
|
protected java.util.List<I> |
pset2
Individuals selected as parents for second mutator
|
protected IRandGenFactory |
randGenFactory
Random generators factory
|
protected java.util.List<I> |
rset
Individuals to replace
|
protected <any> |
species
Individual species
|
Constructor and Description |
---|
NeuralNetAlgorithm()
Empty constructor
|
Modifier and Type | Method and Description |
---|---|
void |
configure(Configuration configuration)
Configuration parameters for NeuralNetAlgorithm class are:
species: ISpecies (complex)
Individual species
evaluator IEvaluator (complex)
Individuals evaluator
population-size (int)
Population size
max-of-generations (int)
Maximum number of generations
provider: IProvider (complex)
Individuals provider
mutator1: IMutator (complex)
Individuals mutator1
mutator2: IMutator (complex)
Individuals mutator2
creation-ratio (double)
Ratio "elements created"/"elements remaining"
percentage-second-mutator (int)
Percentage of individuals mutated with second mutator
max-generations-without-improving-mean (int)
Maximum number of generations without improving mean fitness
max-generations-without-improving-best (int)
Maximum number of generations without improving best fitness
fitness-difference (double)
Difference between two fitness that we consider
enough to say that the fitness has improved
|
IRandGen |
createRandGen()
Factory method.
|
protected void |
doControl()
Check if evolution is finished.
|
protected void |
doGeneration()
Implementation for the Generation task
IMPORTANT NOTE: Parametric and structural mutators work directly with
the individuals instead of returning a mutated copy of them.
|
void |
doInit()
Create individuals in population, evaluating before start rest
of evolution
|
void |
doIterate()
Iteration of the algorithm
|
protected void |
doReplacement()
Implementation for the Replacement task
|
protected void |
doSelection()
Implementation for the Selection task
|
protected void |
doSort()
Sort individuals in bset
|
protected void |
doUpdate()
Implementation for the Update task
|
boolean |
equals(java.lang.Object other)
Compare this algorithm to another
|
I |
getBestIndividual()
Returns the best individual of the population
|
double |
getCratio()
Returns creation ratio of the algorithm
|
double |
getCurrentBest()
Returns best individual fitness of the population
|
double |
getCurrentMean()
Returns fitness mean of the percentageFirstMutator of population
|
<any> |
getEvaluator()
Access to system evaluator
|
double |
getFitDif()
Returns significative fitness difference
|
int |
getGeneration()
Access to current generation
|
java.util.List<I> |
getInhabitants()
Access to population inhabitants
|
int |
getMaxOfGenerations()
Get the maximum number of iterations for this algorithm
|
int |
getMogbest()
Returns maximum number of generations allowed without
improving best fitness
|
int |
getMogmean()
Returns maximum number of generations allowed without
improving mean fitness
|
<any> |
getMutator1()
Returns first individual mutator
|
<any> |
getMutator2()
Returns first second mutator
|
int |
getNogbest()
Returns current number of generations without
improving best fitness
|
int |
getNogmean()
Returns current number of generations without
improving mean fitness
|
int |
getPercentageSecondMutator()
Returns percentage of census selected to be mutated
with second mutator
|
int |
getPopulationSize()
Returns population size of the algorithm
|
double |
getPreviousBest()
Returns previous best fitness
|
double |
getPreviousMean()
Returns previous mean fitness
|
<any> |
getProvider()
Returns individual provider
|
IRandGenFactory |
getRandGenFactory()
Returns randgen factory
|
<any> |
getSpecies()
Access to system species
|
void |
setCratio(double cratio)
Sets creation ratio of the algorithm
|
void |
setEvaluator(<any> evaluator)
Sets the system evaluator
|
void |
setFitDif(double fitDif)
Sets significative fitness difference
|
void |
setGeneration(int generation)
Sets the current generation
|
void |
setInhabitants(java.util.List<I> inhabitants)
Sets the population inhabitants
|
void |
setMaxOfGenerations(int maxOfGenerations)
Set the maximum number of iterations for this algorithm
|
void |
setMogbest(int mogbest)
Sets maximum number of generations allowed without
improving best fitness
|
void |
setMogmean(int mogmean)
Sets maximum number of generations allowed without
improving mean fitness
|
void |
setMutator1(<any> mutator1)
Sets first individual mutator
|
void |
setMutator2(<any> mutator2)
Sets second individual mutator
|
void |
setPercentageSecondMutator(int percentageSecondMutator)
Sets percentage of census selected to be mutated
with second mutator
|
void |
setPopulationSize(int populationSize)
Sets population size of the algorithm
|
void |
setProvider(<any> provider)
Sets the individuals provider used in the init task
|
void |
setRandGenFactory(IRandGenFactory randGenFactory)
Sets the randgen factory
|
void |
setSpecies(<any> species)
Sets the system species
|
protected IRandGenFactory randGenFactory
protected <any> species
protected <any> evaluator
protected <any> provider
protected int populationSize
protected int maxOfGenerations
protected <any> mutator1
protected <any> mutator2
protected double cratio
protected int percentageSecondMutator
protected int nofselSecondMutator
protected int mogmean
protected int mogbest
protected double fitDif
protected int generation
protected java.util.List<I extends IIndividual> bset
protected java.util.List<I extends IIndividual> pset1
protected java.util.List<I extends IIndividual> pset2
protected java.util.List<I extends IIndividual> cset
protected java.util.List<I extends IIndividual> rset
protected double currentBest
protected double currentMean
protected double previousBest
protected double previousMean
protected int nogbest
protected int nogmean
protected I extends IIndividual bestIndividual
protected java.util.Comparator<I extends IIndividual> individualsComparator
public final <any> getSpecies()
Access to system species
public final <any> getEvaluator()
Access to system evaluator
public final int getGeneration()
Access to current generation
public java.util.List<I> getInhabitants()
Access to population inhabitants
public double getCurrentBest()
Returns best individual fitness of the population
public double getCurrentMean()
Returns fitness mean of the percentageFirstMutator of population
public int getNogbest()
Returns current number of generations without improving best fitness
public int getNogmean()
Returns current number of generations without improving mean fitness
public double getPreviousBest()
Returns previous best fitness
public double getPreviousMean()
Returns previous mean fitness
public I getBestIndividual()
Returns the best individual of the population
public final void setSpecies(<any> species)
Sets the system species
species
- New system speciespublic final void setEvaluator(<any> evaluator)
Sets the system evaluator
evaluator
- New system evaluatorpublic final void setGeneration(int generation)
Sets the current generation
generation
- New current generationpublic final void setInhabitants(java.util.List<I> inhabitants)
Sets the population inhabitants
inhabitants
- new population inhabitantspublic IRandGenFactory getRandGenFactory()
Returns randgen factory
public void setRandGenFactory(IRandGenFactory randGenFactory)
Sets the randgen factory
randGenFactory
- New randgen factorypublic final <any> getProvider()
Returns individual provider
public final void setProvider(<any> provider)
Sets the individuals provider used in the init task
provider
- New individuals providerpublic final int getPopulationSize()
Returns population size of the algorithm
public final void setPopulationSize(int populationSize)
Sets population size of the algorithm
populationSize
- New population size to setpublic final int getMaxOfGenerations()
Get the maximum number of iterations for this algorithm
public final void setMaxOfGenerations(int maxOfGenerations)
Set the maximum number of iterations for this algorithm
maxOfGenerations
- Max of generationspublic <any> getMutator1()
Returns first individual mutator
public void setMutator1(<any> mutator1)
Sets first individual mutator
mutator1
- First individual mutatorpublic <any> getMutator2()
Returns first second mutator
public void setMutator2(<any> mutator2)
Sets second individual mutator
mutator2
- Second individual mutatorpublic double getCratio()
Returns creation ratio of the algorithm
public void setCratio(double cratio)
Sets creation ratio of the algorithm
cratio
- New creation ratio to setpublic int getPercentageSecondMutator()
Returns percentage of census selected to be mutated with second mutator
public void setPercentageSecondMutator(int percentageSecondMutator)
Sets percentage of census selected to be mutated with second mutator
percentageSecondMutator
- New percentage of censuspublic double getFitDif()
Returns significative fitness difference
public void setFitDif(double fitDif)
Sets significative fitness difference
fitDif
- New significative fitness differencepublic int getMogbest()
Returns maximum number of generations allowed without improving best fitness
public void setMogbest(int mogbest)
Sets maximum number of generations allowed without improving best fitness
mogbest
- Maximum number of generationspublic int getMogmean()
Returns maximum number of generations allowed without improving mean fitness
public void setMogmean(int mogmean)
Sets maximum number of generations allowed without improving mean fitness
mogmean
- Maximum number of generationspublic boolean equals(java.lang.Object other)
Compare this algorithm to another
other
- Object to compare with.public void doInit()
Create individuals in population, evaluating before start rest of evolution
public void doIterate()
Iteration of the algorithm
protected void doControl()
Check if evolution is finished. Default implementation of this method performs the operations:
protected void doSelection()
Implementation for the Selection task
protected void doGeneration()
Implementation for the Generation task IMPORTANT NOTE: Parametric and structural mutators work directly with the individuals instead of returning a mutated copy of them. This is for performance reasons. If you want to use another mutator you have to consider that individuals will be changed when you use these mutators.
protected void doReplacement()
Implementation for the Replacement task
protected void doUpdate()
Implementation for the Update task
protected void doSort()
Sort individuals in bset
public IRandGen createRandGen()
Factory method.
public void configure(Configuration configuration)
Configuration parameters for NeuralNetAlgorithm class are:
species: ISpecies (complex)
Individual species
evaluator IEvaluator (complex)
Individuals evaluator
population-size (int)
Population size
max-of-generations (int)
Maximum number of generations
provider: IProvider (complex)
Individuals provider
mutator1: IMutator (complex)
Individuals mutator1
mutator2: IMutator (complex)
Individuals mutator2
creation-ratio (double)
Ratio "elements created"/"elements remaining"
percentage-second-mutator (int)
Percentage of individuals mutated with second mutator
max-generations-without-improving-mean (int)
Maximum number of generations without improving mean fitness
max-generations-without-improving-best (int)
Maximum number of generations without improving best fitness
fitness-difference (double)
Difference between two fitness that we consider
enough to say that the fitness has improved
configuration
- Configuration object to obtain the parameters