ContactCenters
V. 0.9.9.

umontreal.iro.lecuyer.contactcenters
Class CCParamReadHelper

java.lang.Object
  extended by umontreal.iro.lecuyer.contactcenters.CCParamReadHelper

public class CCParamReadHelper
extends Object

Provides helper methods to convert parameter objects into usable objects.


Constructor Summary
CCParamReadHelper()
           
 
Method Summary
static void compactPeriods(MultiPeriodGenParams mpg, double tol)
          Replaces, in mpg, any group of successive period-specific generators having equivalent parameters with a single per-period generator with a repeat attribute.
static MultiPeriodGen createGenerator(MultiPeriodGenParams mpgp, RandomStream stream, PeriodChangeEvent pce)
          Constructs and returns a random variate generator for multiple periods using the parameters in mpgp, the random stream stream, and the period-change event pce.
static boolean estimateParameters(MultiPeriodGenParams mpgp)
          Estimates parameters for every period-specific generator specified by mpgp.
static double getMeanForPeriod(MultiPeriodGenParams mpgp, int p)
          Returns the mean value of the distribution for the main period p.
static double getMeanPre(MultiPeriodGenParams mpgp)
          Returns the mean for the preliminary period, if parameters are set for this period.
static double getMeanWrap(MultiPeriodGenParams mpgp)
          Returns the mean for the wrap-up period, if parameters are set for this period.
static double getVarianceForPeriod(MultiPeriodGenParams mpgp, int p)
          Returns the variance value of the distribution for the main period p.
static double getVariancePre(MultiPeriodGenParams mpgp)
          Returns the variance for the preliminary period, if parameters are set for this period.
static double getVarianceWrap(MultiPeriodGenParams mpgp)
          Returns the variance for the wrap-up period, if parameters are set for this period.
static boolean sameGenerators(MultiPeriodGenParams mpg1, MultiPeriodGenParams mpg2, double tol)
          Determines if the two generators mpg1, and mpg2 are equivalent, i.e., if they use the same distribution and parameters for each period.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CCParamReadHelper

public CCParamReadHelper()
Method Detail

getMeanForPeriod

public static double getMeanForPeriod(MultiPeriodGenParams mpgp,
                                      int p)
                               throws DistributionCreationException
Returns the mean value of the distribution for the main period p.

Parameters:
mpgp - the parameters of the random variate generator for multiple periods.
p - the index of the main period.
Returns:
the mean.
Throws:
DistributionCreationException - if an error occurs during the creation of the distribution.

getVarianceForPeriod

public static double getVarianceForPeriod(MultiPeriodGenParams mpgp,
                                          int p)
                                   throws DistributionCreationException
Returns the variance value of the distribution for the main period p.

Parameters:
mpgp - the parameters of the random variate generator for multiple periods.
p - the index of the main period.
Returns:
the variance.
Throws:
DistributionCreationException - if an error occurs during the creation of the distribution.

getMeanPre

public static double getMeanPre(MultiPeriodGenParams mpgp)
                         throws DistributionCreationException
Returns the mean for the preliminary period, if parameters are set for this period.

Parameters:
mpgp - the parameters of the random variate generator for multiple periods.
Returns:
the mean.
Throws:
DistributionCreationException - if an error occurs during the creation of the distribution.

getVariancePre

public static double getVariancePre(MultiPeriodGenParams mpgp)
                             throws DistributionCreationException
Returns the variance for the preliminary period, if parameters are set for this period.

Parameters:
mpgp - the parameters of the random variate generator for multiple periods.
Returns:
the variance.
Throws:
DistributionCreationException - if an error occurs during the creation of the distribution.

getMeanWrap

public static double getMeanWrap(MultiPeriodGenParams mpgp)
                          throws DistributionCreationException
Returns the mean for the wrap-up period, if parameters are set for this period.

Parameters:
mpgp - the parameters of the random variate generator for multiple periods.
Returns:
the mean.
Throws:
DistributionCreationException - if an error occurs during the creation of the distribution.

getVarianceWrap

public static double getVarianceWrap(MultiPeriodGenParams mpgp)
                              throws DistributionCreationException
Returns the variance for the wrap-up period, if parameters are set for this period.

Parameters:
mpgp - the parameters of the random variate generator for multiple periods.
Returns:
the variance.
Throws:
DistributionCreationException - if an error occurs during the creation of the distribution.

createGenerator

public static MultiPeriodGen createGenerator(MultiPeriodGenParams mpgp,
                                             RandomStream stream,
                                             PeriodChangeEvent pce)
                                      throws DistributionCreationException,
                                             GeneratorCreationException
Constructs and returns a random variate generator for multiple periods using the parameters in mpgp, the random stream stream, and the period-change event pce. This method constructs one random variate generator for each period, and uses these generators to create a multiple-periods random variate generator.

The parameters for the preliminary and wrap-up periods are obtained using MultiPeriodGenParams.getPreGen(), and MultiPeriodGenParams.getWrapGen(), respectively. If no parameters are given for the preliminary [wrap-up] period, the generator of the first [last] main period is used. For main periods, the method obtains parameters from MultiPeriodGenParams.getPeriodGen(). If the number of main periods defined by pce exceeds the number of period-specific sets of parameters, the method constructs the default generator based on parameters in MultiPeriodGenParams.getDefaultGen(), and uses it for the remaining main periods.

When constructing a period-specific generator, this method replaces the missing distribution class, generator class, and shift by the default value given by mpgp.

Parameters:
mpgp - the parameters for the multiple-periods generator.
stream - the random stream.
pce - the period-change event.
Returns:
the multiple-periods random variate generator.
Throws:
DistributionCreationException - if an exception occurred during the construction of a period-specific distribution.
GeneratorCreationException - if an exception occurred during the construction of a period-specific generator.

compactPeriods

public static void compactPeriods(MultiPeriodGenParams mpg,
                                  double tol)
Replaces, in mpg, any group of successive period-specific generators having equivalent parameters with a single per-period generator with a repeat attribute. This can be used to reduce the amount of information in the XML output generated by marshalling mpg, or the amount of memory taken by the random variate generator created from mpg. This method considers that two numerical parameters a and b are equal if if | a - b| < tol.

Parameters:
mpg - the parameters of the multiple-periods generator..
tol - the tolerance used for comparing numbers.

estimateParameters

public static boolean estimateParameters(MultiPeriodGenParams mpgp)
                                  throws DistributionCreationException
Estimates parameters for every period-specific generator specified by mpgp. This method calls ParamReadHelper.estimateParameters(RandomVariateGenParams) for each period-specific generator to estimate parameters.

Parameters:
mpgp - the parameters for the multiple-period generator.
Returns:
true if and only if at least one call to ParamReadHelper.estimateParameters(RandomVariateGenParams) returned true.
Throws:
DistributionCreationException

sameGenerators

public static boolean sameGenerators(MultiPeriodGenParams mpg1,
                                     MultiPeriodGenParams mpg2,
                                     double tol)
Determines if the two generators mpg1, and mpg2 are equivalent, i.e., if they use the same distribution and parameters for each period. This method uses ParamReadHelper.sameGenerators(RandomVariateGenParams,RandomVariateGenParams,double) to compare period-specific generators.

Parameters:
mpg1 - the first multiple-periods generators.
mpg2 - the second multiple-periods generators.
tol - the tolerance used to compare numbers.
Returns:
true if and only if the two generators are equivalent.

ContactCenters
V. 0.9.9.

To submit a bug or ask questions, send an e-mail to Richard Simard.