public abstract class PBIL extends Object
computeFitness
which must be implemented.
PBIL: http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.61.8554Modifier and Type | Field and Description |
---|---|
protected double |
epsilon |
protected static double |
EPSILON
The default constant used to ensure numerical stability.
|
protected Integer |
generations |
protected int |
genotypeLength |
protected static double |
LEARNING_RATE
The default learning rate.
|
protected double |
learningRate |
protected static double |
MAX_DIVERGENCE
The maximum difference from 0 or 1 each element of the probability vector can have for the set to be still possibly considered
optimized.
|
protected static double |
MUTATION_PROBABILITY
The default probability of mutation applied to the probability vector.
|
protected static double |
MUTATION_SHIFT
The default amount of mutation applied to the probability vector.
|
protected double |
mutationProbability |
protected double |
mutationShift |
protected static double |
NEGATIVE_LEARNING_RATE
The default additional learning rate from 'negative' experience.
|
protected double |
negLearningRate |
protected static int |
POPULATION_SIZE
The default number of genotypes generated per generation.
|
protected int |
populationSize |
Modifier | Constructor and Description |
---|---|
protected |
PBIL(int genotypeLength,
Integer populationSize,
Double mutationProbability,
Double mutationShift,
Double learningRate,
Double negLearningRate,
Integer generations,
Double epsilon,
double[] initialProbabilityVector,
Logger logger)
Constructs an instance with the specified optimization parameters.
|
Modifier and Type | Method and Description |
---|---|
protected abstract double |
computeFitness(String genotype)
Measures the fitness of the genotype.
|
protected int |
getCurrentGeneration()
Returns the index of the current generation in the evolution.
|
protected double |
getCurrentHighestFitness()
Returns the highest fitness score of the current generation so far.
|
double |
getEntropy()
Returns the Shannon entropy of the current generation of genotypes.
|
double[] |
getProbabilityVector()
Returns the probability vector representing the current set.
|
double[] |
optimize()
An implementation of the Population-based Incremental Learning algorithm which optimizes a string of binary digits representing
the parameters of a fitness function.
|
protected static final int POPULATION_SIZE
protected static final double MUTATION_PROBABILITY
protected static final double MUTATION_SHIFT
protected static final double LEARNING_RATE
protected static final double NEGATIVE_LEARNING_RATE
protected static final double MAX_DIVERGENCE
protected static final double EPSILON
protected final int genotypeLength
protected final int populationSize
protected final double mutationProbability
protected final double mutationShift
protected final double learningRate
protected final double negLearningRate
protected final Integer generations
protected final double epsilon
protected PBIL(int genotypeLength, Integer populationSize, Double mutationProbability, Double mutationShift, Double learningRate, Double negLearningRate, Integer generations, Double epsilon, double[] initialProbabilityVector, Logger logger) throws IllegalArgumentException
genotypeLength
- The number of genes in the genotypes, i.e. the number of binary digits needed to represent the parameters to be
optimized. It has to be greater than 0 or an IllegalArgumentException
is thrown.populationSize
- The number of genotypes to produce per generation. If it is null, a default value of 100 will be used.mutationProbability
- The probability of mutation for each gene. If it is null, a default value of 0.02 will be used.mutationShift
- The effect of mutation on the probability vector. If it is null, a default value of 0.05 will be used.learningRate
- The effect the fittest specimen's genotype has on the probability vector. If it is null a default value of 0.1 will
be used.negLearningRate
- The additional effect the fittest specimen's genes have on the probability vector at the points where
they differ from those of the least fit specimen in the population. If it is null a default value of 0.025 will be used.generations
- The number of iterations. If it is null, the set will be considered optimized, and thus the process will terminate,
when all the elements of the probability vector have converged to 0 or 1 within a margin dependent on the population size
[1/populationSize]. If an initial probability vector is provided and it already converged, no further optimization will be performed.epsilon
- A constant used to ensure numerical stability. If it is null, the default
value of 1e-8 will be used. It is not recommended to change this value.initialProbabilityVector
- The starting probability vector for the optimization. It allows the algorithm to pick up where a
previous, terminated optimization process left off. If the array's length is smaller than genomeLength, it will be extended with
elements of the value 0.5d; if the length of the array is greater than genomeLength, only the first x elements will be considered,
where x = genomeLength. If it is null, an array with a length equal to genomeLength, only containing elements that have the value 0.5d
will be used.logger
- The logger used to log the current status of the optimization process. If it is null, no logging is performed.IllegalArgumentException
- If the length of the genotype length is not greater than 0.protected int getCurrentGeneration()
protected double getCurrentHighestFitness()
public double[] getProbabilityVector()
public final double getEntropy()
public final double[] optimize()
protected abstract double computeFitness(String genotype)
genotype
- The genotype represented by a string of binary digits of the specified length.Copyright © 2020. All rights reserved.