Class LDStrategy
java.lang.Object
common.serviceStrategies.LDStrategy
- All Implemented Interfaces:
ServiceStrategy, Cloneable
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
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classInner class used to store definition of a Range -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static DecimalFormatprotected TreeMap<Object, LDStrategy.Range> protected static final String -
Constructor Summary
ConstructorsConstructorDescriptionBuilds a new Load Dependent Service Time Strategy with default values -
Method Summary
Modifier and TypeMethodDescriptionaddRange()Adds a new range to this strategy.clone()Clones this strategy in a new ObjectvoiddeleteRange(Object key) Removes a Range from this data structureObject[]Returns an array with all available ranges keysstatic StringReturns engine classpath for Load Dependent strategydoublegetMeanValue(int jobs) Returns mean value of service time distribution for given number of jobs.Returns the distribution of a given rangeReturns the expression to be evaluated to find the mean of the distribution of a given rangeintgetRangeFrom(Object key) Gets starting number of jobs for this rangeintReturns number of defined rangesintgetRangeTo(Object key) Gets maximum number of jobs for this rangebooleanChecks if the given Load Dependent Strategy equalsthis, 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 rangevoidsetRangeDistribution(Object key, Distribution distribution) Sets distribution for this range, preserving old value of c, if applicable.voidsetRangeDistributionC(Object key, double c) Sets variation coefficient 'c' for the distribution of a given rangevoidsetRangeDistributionMean(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 distributionvoidsetRangeDistributionMeanNoCheck(Object key, String meanExpression) Sets expression to calculate mean value, performing no checksvoidsetRangeDistributionNoCheck(Object key, Distribution distribution) Sets distribution for this range, do not preserver old values or C, nor of meansetRangeFrom(Object key, int startingInterval) Changes starting number of jobs for a given range, only if it does not overlap with another range.toString()Returns a String description of this object
-
Field Details
-
VAR
- See Also:
-
formatter
-
ranges
-
-
Constructor Details
-
LDStrategy
public LDStrategy()Builds a new Load Dependent Service Time Strategy with default values
-
-
Method Details
-
getEngineClassPath
Returns engine classpath for Load Dependent strategy- Returns:
- engine classpath for Load Dependent strategy
-
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
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 rangestartingInterval- starting number of jobs for this range to be set- Returns:
- new search's key for this range
-
setRangeDistribution
Sets distribution for this range, preserving old value of c, if applicable.- Parameters:
key- search's key for this rangedistribution- distribution to set in this range
-
setRangeDistributionNoCheck
Sets distribution for this range, do not preserver old values or C, nor of mean- Parameters:
key- search's key for this rangedistribution- distribution to set in this range
-
setRangeDistributionMean
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 rangemeanExpression- expression to be evaluated to find mean value
-
setRangeDistributionMeanNoCheck
-
setRangeDistributionC
Sets variation coefficient 'c' for the distribution of a given range- Parameters:
key- search key for provided rangec- variation coefficient
-
getRangeFrom
Gets starting number of jobs for this range- Parameters:
key- search key for provided range- Returns:
- starting number of jobs for this range
-
getRangeTo
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
Returns the distribution of a given range- Parameters:
key- search key for given range- Returns:
- its distribution
-
getRangeDistributionMean
-
getRangeNumber
public int getRangeNumber()Returns number of defined ranges- Returns:
- number of defined ranges
-
getAllRanges
Returns an array with all available ranges keys- Returns:
- all available ranges keys, in ordered form
-
deleteRange
Removes a Range from this data structure- Parameters:
key- search's key for range to be removed
-
toString
-
clone
Clones this strategy in a new Object- Specified by:
clonein interfaceServiceStrategy- Overrides:
clonein classObject- 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
Checks if the given Load Dependent Strategy equalsthis, 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
thisAuthor: Francesco D'Aquino
-