Class AnnealingTuneProfile

java.lang.Object
org.jppf.load.balancer.AbstractLoadBalancingProfile
org.jppf.load.balancer.impl.AnnealingTuneProfile
All Implemented Interfaces:
Serializable, LoadBalancingProfile

public class AnnealingTuneProfile extends AbstractLoadBalancingProfile
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

    Fields
    Modifier and Type
    Field
    Description
    protected float
    This parameter defines how fast does it will stop generating random numbers.
    protected double
    The percentage of deviation of the current mean to the mean when the system was considered stable.
    protected int
    The maximum number of guesses of number generated that were already tested for the algorithm to consider the current best solution stable.
    protected long
    The minimum number of samples that must be collected before an analysis is triggered.
    protected long
    The minimum number of samples to be collected before checking if the performance profile has changed.
    protected int
    The initial bundle size to start from.
    protected float
    This parameter defines the multiplicity used to define the range available to random generator, as the maximum.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Initialize this profile with default values.
    Initialize this profile with values read from the configuration file.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    createDiff(int bestSize, int collectedSamples, Random rnd)
    Generate a difference to be applied to the best known bundle size.
    protected double
    expDist(long max, long x)
    This method implements the always decreasing policy of the algorithm.
    float
    Get the decrease rate for this profile.
    Get the default profile with default parameter values.
    double
    Get the percentage of deviation of the current mean to the mean when the system was considered stable.
    int
    Get the maximum number of guesses of number generated that were already tested for the algorithm to consider the current best solution stable.
    long
    Get the minimum number of samples that must be collected before an analysis is triggered.
    long
    Get the the minimum number of samples to be collected before checking if the performance profile has changed.
    float
    Get the multiplicity used to define the range available to random generator, as the maximum.
    void
    setDecreaseRatio(float decreaseRatio)
    Set the decrease rate for this profile.
    void
    setMaxDeviation(double maxDeviation)
    Set the percentage of deviation of the current mean to the mean when the system was considered stable.
    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.
    void
    setMinSamplesToAnalyse(long minSamplesToAnalyse)
    Set the minimum number of samples that must be collected before an analysis is triggered.
    void
    setMinSamplesToCheckConvergence(long minSamplesToCheckConvergence)
    Set the the minimum number of samples to be collected before checking if the performance profile has changed.
    void
    setSizeRatioDeviation(float sizeRatioDeviation)
    Set the multiplicity used to define the range available to random generator, as the maximum.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • size

      protected int size
      The initial bundle size to start from.
    • minSamplesToAnalyse

      protected long minSamplesToAnalyse
      The minimum number of samples that must be collected before an analysis is triggered.
    • minSamplesToCheckConvergence

      protected long minSamplesToCheckConvergence
      The minimum number of samples to be collected before checking if the performance profile has changed.
    • maxDeviation

      protected double maxDeviation
      The percentage of deviation of the current mean to the mean when the system was considered stable.
    • maxGuessToStable

      protected int maxGuessToStable
      The maximum number of guesses of number generated that were already tested for the algorithm to consider the current best solution stable.
    • sizeRatioDeviation

      protected float sizeRatioDeviation
      This parameter defines the multiplicity used to define the range available to random generator, as the maximum.
    • decreaseRatio

      protected float decreaseRatio
      This 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
      This expected number of guesses might not occur if the number of getMaxGuessToStable() is short.
  • Constructor Details

    • AnnealingTuneProfile

      public AnnealingTuneProfile()
      Initialize this profile with default values.
    • AnnealingTuneProfile

      public AnnealingTuneProfile(TypedProperties config)
      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

      public int createDiff(int bestSize, int collectedSamples, Random rnd)
      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

      public static AnnealingTuneProfile getDefaultProfile()
      Get the default profile with default parameter values.
      Returns:
      a AnnealingTuneProfile singleton instance.