Class LDStrategy

java.lang.Object
common.serviceStrategies.LDStrategy
All Implemented Interfaces:
ServiceStrategy, Cloneable

public class LDStrategy extends Object implements ServiceStrategy

Title: Load Dependent Station Service Strategy

Description: This object holds informations for a load dependent service strategy. The strategy is organized in subsequent ranges (starting from 1 to infinity), and each of them can specify a distribution, its c (if any, fixed) and its mean value as a function of load into the station.

Author:
Bertoli Marco Date: 11-ott-2005 Time: 12.25.52
  • Field Details

  • Constructor Details

    • LDStrategy

      public LDStrategy()
      Builds a new Load Dependent Service Time Strategy with default values
  • Method Details

    • getEngineClassPath

      public static String getEngineClassPath()
      Returns engine classpath for Load Dependent strategy
      Returns:
      engine classpath for Load Dependent strategy
    • addRange

      public Object addRange()
      Adds a new range to this strategy. 'From' field is initialized with greatest created range by now plus one (so if last range has from = 7, this will have from = 8)
      Returns:
      search's key for newly created range
    • setRangeFrom

      public Object setRangeFrom(Object key, int startingInterval)
      Changes starting number of jobs for a given range, only if it does not overlap with another range.
      Parameters:
      key - search's key for given range
      startingInterval - starting number of jobs for this range to be set
      Returns:
      new search's key for this range
    • setRangeDistribution

      public void setRangeDistribution(Object key, Distribution distribution)
      Sets distribution for this range, preserving old value of c, if applicable.
      Parameters:
      key - search's key for this range
      distribution - distribution to set in this range
    • setRangeDistributionNoCheck

      public void setRangeDistributionNoCheck(Object key, Distribution distribution)
      Sets distribution for this range, do not preserver old values or C, nor of mean
      Parameters:
      key - search's key for this range
      distribution - distribution to set in this range
    • setRangeDistributionMean

      public void setRangeDistributionMean(Object key, String meanExpression)
      Sets expression to calculate mean value of provided range only if it can be parsed without errors and its value in 'from' point is assignable to current distribution
      Parameters:
      key - search key for provided range
      meanExpression - expression to be evaluated to find mean value
    • setRangeDistributionMeanNoCheck

      public void setRangeDistributionMeanNoCheck(Object key, String meanExpression)
      Sets expression to calculate mean value, performing no checks
      Parameters:
      key - search key for provided range
      meanExpression - expression to be evaluated to find mean value
    • setRangeDistributionC

      public void setRangeDistributionC(Object key, double c)
      Sets variation coefficient 'c' for the distribution of a given range
      Parameters:
      key - search key for provided range
      c - variation coefficient
    • getRangeFrom

      public int getRangeFrom(Object key)
      Gets starting number of jobs for this range
      Parameters:
      key - search key for provided range
      Returns:
      starting number of jobs for this range
    • getRangeTo

      public int getRangeTo(Object key)
      Gets maximum number of jobs for this range
      Parameters:
      key - search key for provided range
      Returns:
      maximum number of jobs for this range. -1 means Infinity.
    • getRangeDistribution

      public Distribution getRangeDistribution(Object key)
      Returns the distribution of a given range
      Parameters:
      key - search key for given range
      Returns:
      its distribution
    • getRangeDistributionMean

      public String getRangeDistributionMean(Object key)
      Returns the expression to be evaluated to find the mean of the distribution of a given range
      Parameters:
      key - search key for given range
      Returns:
      expression to find mean value
    • getRangeNumber

      public int getRangeNumber()
      Returns number of defined ranges
      Returns:
      number of defined ranges
    • getAllRanges

      public Object[] getAllRanges()
      Returns an array with all available ranges keys
      Returns:
      all available ranges keys, in ordered form
    • deleteRange

      public void deleteRange(Object key)
      Removes a Range from this data structure
      Parameters:
      key - search's key for range to be removed
    • toString

      public String toString()
      Returns a String description of this object
      Overrides:
      toString in class Object
      Returns:
      a String description of this object
    • clone

      public LDStrategy clone()
      Clones this strategy in a new Object
      Specified by:
      clone in interface ServiceStrategy
      Overrides:
      clone in class Object
      Returns:
      a clone of current service strategy
    • getMeanValue

      public double getMeanValue(int jobs)
      Returns mean value of service time distribution for given number of jobs.
      Parameters:
      jobs - queue length of the station
      Returns:
      mean value of service time distribution. On failure returns -1
    • isEquivalent

      public boolean isEquivalent(LDStrategy ld)
      Checks if the given Load Dependent Strategy equals this, where the equivalence is iff:
      1) have the same number of ranges
      2) have the same distribution in each range
      3) have the same mean value in each range
      4) have the same 'from' and 'to' values in each range
      Parameters:
      ld - the given LD strategy
      Returns:
      true if ld equals this Author: Francesco D'Aquino