Package org.jppf.load.balancer.impl
Class AnnealingTuneProfile
java.lang.Object
org.jppf.load.balancer.AbstractLoadBalancingProfile
org.jppf.load.balancer.impl.AnnealingTuneProfile
- All Implemented Interfaces:
Serializable,LoadBalancingProfile
This class implements the basis of a profile based on simulated annealing
jppf.load.balancing.profile. The possible move from the best known solution get smaller each
time it make a move.
This strategy let the algorithm explore the universe of bundle size with
an almost known end. Check method getDecreaseRatio about the maximum number
of changes.
- Author:
- Domingos Creado
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected floatThis parameter defines how fast does it will stop generating random numbers.protected doubleThe percentage of deviation of the current mean to the mean when the system was considered stable.protected intThe maximum number of guesses of number generated that were already tested for the algorithm to consider the current best solution stable.protected longThe minimum number of samples that must be collected before an analysis is triggered.protected longThe minimum number of samples to be collected before checking if the performance profile has changed.protected intThe initial bundle size to start from.protected floatThis parameter defines the multiplicity used to define the range available to random generator, as the maximum. -
Constructor Summary
ConstructorsConstructorDescriptionInitialize this profile with default values.AnnealingTuneProfile(TypedProperties config) Initialize this profile with values read from the configuration file. -
Method Summary
Modifier and TypeMethodDescriptionintcreateDiff(int bestSize, int collectedSamples, Random rnd) Generate a difference to be applied to the best known bundle size.protected doubleexpDist(long max, long x) This method implements the always decreasing policy of the algorithm.floatGet the decrease rate for this profile.static AnnealingTuneProfileGet the default profile with default parameter values.doubleGet the percentage of deviation of the current mean to the mean when the system was considered stable.intGet the maximum number of guesses of number generated that were already tested for the algorithm to consider the current best solution stable.longGet the minimum number of samples that must be collected before an analysis is triggered.longGet the the minimum number of samples to be collected before checking if the performance profile has changed.floatGet the multiplicity used to define the range available to random generator, as the maximum.voidsetDecreaseRatio(float decreaseRatio) Set the decrease rate for this profile.voidsetMaxDeviation(double maxDeviation) Set the percentage of deviation of the current mean to the mean when the system was considered stable.voidsetMaxGuessToStable(int maxGuessToStable) Set the maximum number of guesses of number generated that were already tested for the algorithm to consider the current best solution stable.voidsetMinSamplesToAnalyse(long minSamplesToAnalyse) Set the minimum number of samples that must be collected before an analysis is triggered.voidsetMinSamplesToCheckConvergence(long minSamplesToCheckConvergence) Set the the minimum number of samples to be collected before checking if the performance profile has changed.voidsetSizeRatioDeviation(float sizeRatioDeviation) Set the multiplicity used to define the range available to random generator, as the maximum.
-
Field Details
-
size
protected int sizeThe initial bundle size to start from. -
minSamplesToAnalyse
protected long minSamplesToAnalyseThe minimum number of samples that must be collected before an analysis is triggered. -
minSamplesToCheckConvergence
protected long minSamplesToCheckConvergenceThe minimum number of samples to be collected before checking if the performance profile has changed. -
maxDeviation
protected double maxDeviationThe percentage of deviation of the current mean to the mean when the system was considered stable. -
maxGuessToStable
protected int maxGuessToStableThe maximum number of guesses of number generated that were already tested for the algorithm to consider the current best solution stable. -
sizeRatioDeviation
protected float sizeRatioDeviationThis parameter defines the multiplicity used to define the range available to random generator, as the maximum. -
decreaseRatio
protected float decreaseRatioThis parameter defines how fast does it will stop generating random numbers. This is essential to define what is the size of the universe will be explored. Greater numbers make the algorithm stop sooner. Just as example, if the best solution is between 0-100, the following might occur:- 1 => 5 max guesses
- 2 => 2 max guesses
- 0.5 => 9 max guesses
- 0.1 => 46 max guesses
- 0.05 => 96 max guesses
-
-
Constructor Details
-
AnnealingTuneProfile
public AnnealingTuneProfile()Initialize this profile with default values. -
AnnealingTuneProfile
Initialize this profile with values read from the configuration file.- Parameters:
config- contains a mapping of the profile parameters to their value.
-
-
Method Details
-
getSizeRatioDeviation
public float getSizeRatioDeviation()Get the multiplicity used to define the range available to random generator, as the maximum.- Returns:
- the multiplicity as a float value.
-
setSizeRatioDeviation
public void setSizeRatioDeviation(float sizeRatioDeviation) Set the multiplicity used to define the range available to random generator, as the maximum.- Parameters:
sizeRatioDeviation- the multiplicity as a float value.
-
getDecreaseRatio
public float getDecreaseRatio()Get the decrease rate for this profile.- Returns:
- the decrease rate as a float value.
-
setDecreaseRatio
public void setDecreaseRatio(float decreaseRatio) Set the decrease rate for this profile.- Parameters:
decreaseRatio- the decrease rate as a float value.
-
createDiff
Generate a difference to be applied to the best known bundle size.- Parameters:
bestSize- the known best size of bundle.collectedSamples- the number of samples that were already collected.rnd- a pseudo-random number generator.- Returns:
- an always positive diff to be applied to bundle size
-
expDist
protected double expDist(long max, long x) This method implements the always decreasing policy of the algorithm. The ratio define how fast this instance will stop generating random numbers. The calculation is performed as max * exp(-x * getDecreaseRatio()).- Parameters:
max- the maximum value this algorithm will generate.x- a randomly generated bundle size increment.- Returns:
- an int value.
-
getMinSamplesToAnalyse
public long getMinSamplesToAnalyse()Get the minimum number of samples that must be collected before an analysis is triggered.- Returns:
- the number of samples as a long value.
-
setMinSamplesToAnalyse
public void setMinSamplesToAnalyse(long minSamplesToAnalyse) Set the minimum number of samples that must be collected before an analysis is triggered.- Parameters:
minSamplesToAnalyse- the number of samples as a long value.
-
getMinSamplesToCheckConvergence
public long getMinSamplesToCheckConvergence()Get the the minimum number of samples to be collected before checking if the performance profile has changed.- Returns:
- the number of samples as a long value.
-
setMinSamplesToCheckConvergence
public void setMinSamplesToCheckConvergence(long minSamplesToCheckConvergence) Set the the minimum number of samples to be collected before checking if the performance profile has changed.- Parameters:
minSamplesToCheckConvergence- the number of samples as a long value.
-
getMaxDeviation
public double getMaxDeviation()Get the percentage of deviation of the current mean to the mean when the system was considered stable.- Returns:
- the percentage of deviation as a double value.
-
setMaxDeviation
public void setMaxDeviation(double maxDeviation) Set the percentage of deviation of the current mean to the mean when the system was considered stable.- Parameters:
maxDeviation- the percentage of deviation as a double value.
-
getMaxGuessToStable
public int getMaxGuessToStable()Get the maximum number of guesses of number generated that were already tested for the algorithm to consider the current best solution stable.- Returns:
- the number of guesses as an int value.
-
setMaxGuessToStable
public void setMaxGuessToStable(int maxGuessToStable) Set the maximum number of guesses of number generated that were already tested for the algorithm to consider the current best solution stable.- Parameters:
maxGuessToStable- the number of guesses as an int value.
-
getDefaultProfile
Get the default profile with default parameter values.- Returns:
- a
AnnealingTuneProfilesingleton instance.
-