ContactCenters
V. 0.9.9.

umontreal.iro.lecuyer.contactcenters.app
Class PerformanceMeasureFormat

java.lang.Object
  extended by umontreal.iro.lecuyer.contactcenters.app.PerformanceMeasureFormat
Direct Known Subclasses:
PerformanceMeasureFormatExcel, PerformanceMeasureFormatText

public abstract class PerformanceMeasureFormat
extends Object

Provides basic methods for formatting matrices of performance measures.


Field Summary
protected  String[] agentGroupProperties
           
protected  String[] contactTypeProperties
           
protected  List<HistogramChart> histogramList
           
 
Constructor Summary
PerformanceMeasureFormat()
           
PerformanceMeasureFormat(ReportParams reportParams)
           
 
Method Summary
static void addExperimentInfo(Map<String,Object> evalInfo, String ccParamsFn, String simParamsFn)
          Returns the header for simulation results.
 String capitalizeFirstLetter(String s)
          Returns the string s with the first letter in uppercase.
 String columnNameWithProperties(ContactCenterInfo eval, PerformanceMeasureType pm, int col)
           
 int countRowsSummary(ContactCenterEval eval, PerformanceMeasureType... pms)
          Returns the number of rows in the summary report.
protected  void createHistogram(double[] obs, double sigma, PerformanceMeasureParams pmp, String name)
          Create a new histogram and add it to the list of histograms.
static void formatResults(ContactCenterEval eval, File outputFile)
          Formats the results of the last evaluation performed by eval into the file with name outputFile.
static void formatResults(ContactCenterEval eval, OutputStream stream, CCResultsFormat fmt)
          Formats the results of the evaluation system eval.
static void formatResults(ContactCenterEval eval, String outputFileName)
          Equivalent to formatResults(ContactCenterEval,File), with a string given the file name instead of a file object.
 PrintedStatParams[] getDefaultPrintedStatParams(ContactCenterEval eval, ReportParams reportParams)
          Returns a default array of parameters for printed statistics, for the evaluation system eval.
 List<HistogramChart> getHistogramList()
          Returns the list of histograms created by the call to formatObservations in derived classes.
 String getName(ContactCenterInfo eval, PerformanceMeasureType pm, int row, int col)
          Returns the name associated with the performance measure of type pm, at row row, and column col.
 String getNameWithProperties(ContactCenterInfo eval, PerformanceMeasureType pm, int row, int col)
           
 int getNumPropColumns(PerformanceMeasureType pm)
           
 int getNumPropRows(PerformanceMeasureType pm, boolean singleRow)
           
 PerformanceMeasureType[] getPerformanceMeasures(PrintedStatParams[] pstats)
          Constructs an array of performance measure types from the given array of printed statistics.
 PerformanceMeasureType[] getPerformanceMeasures(PrintedStatParams[] pstats, boolean onlyAverages, RowType... rowTypes)
          Constructs an array of performance measure types from the given array of printed statistics, and a row type.
 PerformanceMeasureType[] getPerformanceMeasures(PrintedStatParams[] pstats, RowType... rowTypes)
          Constructs an array of performance measure types from the given array of printed statistics, and a row type.
 String[] getPropColumns(ContactCenterInfo eval, PerformanceMeasureType pm, int column)
           
 String[] getPropNameColumns(PerformanceMeasureType pm)
           
 String[] getPropNameRows(PerformanceMeasureType pm, boolean singleRow)
           
 String[] getPropRows(ContactCenterInfo eval, PerformanceMeasureType pm, int row)
           
 String[] getPropRows(ContactCenterInfo eval, PerformanceMeasureType pm, int row, int column)
           
static String[] getShownProperties(Collection<PropertyNameParam> properties)
          Converts a list of property names to an array of strings.
protected  double getStandardDeviation(ContactCenterSimWithObservations sim, PerformanceMeasureType pm, int row, int column)
          Return the standard deviation of this performance measure.
 String[] getStatColumnNames()
          Name of the columns for tables containing statistics concerning performance measures.
 String[] getValColumnNames()
          Name of the columns for tables containing values of performance measures.
 boolean isIncludedInDefaultReport(PerformanceMeasureType pm)
          Determines if the performance measure type pm is included in reports when printed statistics are not specified by the user.
 boolean isIncludedInReport(ContactCenterEval eval, PerformanceMeasureType pm)
          Determines if the performance measure type pm is included in reports.
 boolean isIncludedInSummary(ContactCenterEval eval, PerformanceMeasureType pm)
          Determines if the performance measure type pm is included in the summary of reports.
 String rowNameWithProperties(ContactCenterInfo eval, PerformanceMeasureType pm, int row)
           
 void writeHistograms()
          Show all histograms for the chosen measures on standard output.
 void writeHistogramsLaTeX()
          Writes all histograms for the chosen measures in a LaTex file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

contactTypeProperties

protected String[] contactTypeProperties

agentGroupProperties

protected String[] agentGroupProperties

histogramList

protected List<HistogramChart> histogramList
Constructor Detail

PerformanceMeasureFormat

public PerformanceMeasureFormat()

PerformanceMeasureFormat

public PerformanceMeasureFormat(ReportParams reportParams)
Method Detail

getStandardDeviation

protected double getStandardDeviation(ContactCenterSimWithObservations sim,
                                      PerformanceMeasureType pm,
                                      int row,
                                      int column)
Return the standard deviation of this performance measure. Returns -1 on error.

Parameters:
sim - contact center
pm - performance measure
row -
column -
Returns:
the standard deviation

createHistogram

protected void createHistogram(double[] obs,
                               double sigma,
                               PerformanceMeasureParams pmp,
                               String name)
Create a new histogram and add it to the list of histograms. The histogram is built from the observations obs for the performance measure pmp, whose description is given in name. The standard deviation sigma is used to fix the width of the bins, if positive; otherwise it is unused.

Parameters:
obs - the observations
sigma - empirical standard deviation of the observations
pmp - performance measure parameters
name - performance measure name

getHistogramList

public List<HistogramChart> getHistogramList()
Returns the list of histograms created by the call to formatObservations in derived classes.

Returns:
the list of all histograms

writeHistograms

public void writeHistograms()
Show all histograms for the chosen measures on standard output.


writeHistogramsLaTeX

public void writeHistogramsLaTeX()
Writes all histograms for the chosen measures in a LaTex file. Each histogram is written in a separate file.


getShownProperties

public static String[] getShownProperties(Collection<PropertyNameParam> properties)
Converts a list of property names to an array of strings.

Parameters:
properties - the list of property names.
Returns:
the array of strings.

getNumPropRows

public int getNumPropRows(PerformanceMeasureType pm,
                          boolean singleRow)

getNumPropColumns

public int getNumPropColumns(PerformanceMeasureType pm)

getPropNameRows

public String[] getPropNameRows(PerformanceMeasureType pm,
                                boolean singleRow)

getPropNameColumns

public String[] getPropNameColumns(PerformanceMeasureType pm)

getPropRows

public String[] getPropRows(ContactCenterInfo eval,
                            PerformanceMeasureType pm,
                            int row,
                            int column)

getPropRows

public String[] getPropRows(ContactCenterInfo eval,
                            PerformanceMeasureType pm,
                            int row)

getPropColumns

public String[] getPropColumns(ContactCenterInfo eval,
                               PerformanceMeasureType pm,
                               int column)

countRowsSummary

public int countRowsSummary(ContactCenterEval eval,
                            PerformanceMeasureType... pms)
Returns the number of rows in the summary report. This corresponds to the number of elements in pms for which isIncludedInSummary(ContactCenterEval,PerformanceMeasureType) returns true.

Parameters:
pms - the array of performance measure types.
Returns:
the number of rows.

isIncludedInReport

public boolean isIncludedInReport(ContactCenterEval eval,
                                  PerformanceMeasureType pm)
Determines if the performance measure type pm is included in reports. By default, this returns false only if pm is null, if it is equal to PerformanceMeasureType.SUMWAITINGTIMES, or if pm.getEstimationType() returns EstimationType.EXPECTATIONOFFUNCTION.

Parameters:
pm - the tested type of performance measure.
Returns:
true if and only if the performance measure type must be included in reports.

isIncludedInDefaultReport

public boolean isIncludedInDefaultReport(PerformanceMeasureType pm)
Determines if the performance measure type pm is included in reports when printed statistics are not specified by the user. By default, this returns false only if pm is null, if it is equal to PerformanceMeasureType.SUMWAITINGTIMES, or if pm.getEstimationType() returns EstimationType.EXPECTATIONOFFUNCTION.

Parameters:
pm - the tested type of performance measure.
Returns:
true if and only if the performance measure type must be included in reports.

isIncludedInSummary

public boolean isIncludedInSummary(ContactCenterEval eval,
                                   PerformanceMeasureType pm)
Determines if the performance measure type pm is included in the summary of reports.

By default, this method returns true if isIncludedInReport (eval, pm) returns true, and if pm does not correspond to PerformanceMeasureType.SERVEDRATES.

Parameters:
pm - the tested type of performance measure.
Returns:
true if and only if pm is included in summary for reports.

rowNameWithProperties

public String rowNameWithProperties(ContactCenterInfo eval,
                                    PerformanceMeasureType pm,
                                    int row)

columnNameWithProperties

public String columnNameWithProperties(ContactCenterInfo eval,
                                       PerformanceMeasureType pm,
                                       int col)

getName

public String getName(ContactCenterInfo eval,
                      PerformanceMeasureType pm,
                      int row,
                      int col)
Returns the name associated with the performance measure of type pm, at row row, and column col. This name is constructed by using PerformanceMeasureType.rowName(umontreal.iro.lecuyer.contactcenters.app.ContactCenterInfo, int), and PerformanceMeasureType.columnName(umontreal.iro.lecuyer.contactcenters.app.ContactCenterInfo, int).

Parameters:
eval - the evaluation system.
pm - the performance measure type.
row - the row index.
col - the column index.
Returns:
the name of the measure.

getNameWithProperties

public String getNameWithProperties(ContactCenterInfo eval,
                                    PerformanceMeasureType pm,
                                    int row,
                                    int col)

capitalizeFirstLetter

public String capitalizeFirstLetter(String s)
Returns the string s with the first letter in uppercase. If s is empty or null, this returns s unchanged.

Parameters:
s - the string to capitalized.
Returns:
the new string with the first letter in upper case.

getValColumnNames

public String[] getValColumnNames()
Name of the columns for tables containing values of performance measures. This array contains a single string representing the ``Values'' column of tables of results.


getStatColumnNames

public String[] getStatColumnNames()
Name of the columns for tables containing statistics concerning performance measures. This array contains five elements representing columns for the minimum, the maximum, the average, the standard deviation, and the confidence interval.


getDefaultPrintedStatParams

public PrintedStatParams[] getDefaultPrintedStatParams(ContactCenterEval eval,
                                                       ReportParams reportParams)
Returns a default array of parameters for printed statistics, for the evaluation system eval. This method uses ContactCenterEval.getPerformanceMeasures() to obtain an array of performance measures. For each element of this array, it creates a PrintedStatParams instance, and adds it into the returned list. Parameters for printed statistics are set to default, i.e., detailed statistics for all periods are printed.

Parameters:
eval - the evaluation system.
Returns:
the array of parameters for printed statistics.

getPerformanceMeasures

public PerformanceMeasureType[] getPerformanceMeasures(PrintedStatParams[] pstats)
Constructs an array of performance measure types from the given array of printed statistics.

Parameters:
pstats - the array of printed statistics.
Returns:
the array of performance measure types.

getPerformanceMeasures

public PerformanceMeasureType[] getPerformanceMeasures(PrintedStatParams[] pstats,
                                                       RowType... rowTypes)
Constructs an array of performance measure types from the given array of printed statistics, and a row type. This method is similar to getPerformanceMeasures(PrintedStatParams[]) except it returns measure types with a row type corresponding to rowType.

Parameters:
pstats - the array of printed statistics.
rowTypes - the row types.
Returns:
the array of performance measure types.

getPerformanceMeasures

public PerformanceMeasureType[] getPerformanceMeasures(PrintedStatParams[] pstats,
                                                       boolean onlyAverages,
                                                       RowType... rowTypes)
Constructs an array of performance measure types from the given array of printed statistics, and a row type. This method is similar to getPerformanceMeasures(PrintedStatParams[]) except it returns measure types with a row type corresponding to rowType, and for which p.getOnlyAverages corresponds to onlyAverages.

Parameters:
pstats - the array of printed statistics.
onlyAverages - determines the required status of the onlyAverages flag.
rowTypes - the row types.
Returns:
the array of performance measure types.

addExperimentInfo

public static void addExperimentInfo(Map<String,Object> evalInfo,
                                     String ccParamsFn,
                                     String simParamsFn)
Returns the header for simulation results. This string contains the name of the parameter file for the model, i.e., ccParamsFn, the name of the parameter file for the experiment, i.e., simParamsFn, and the current date.

Parameters:
ccParamsFn - the name of the parameter file for the model.
simParamsFn - the name of the parameter file for the experiment.

formatResults

public static void formatResults(ContactCenterEval eval,
                                 String outputFileName)
                          throws IOException,
                                 JAXBException
Equivalent to formatResults(ContactCenterEval,File), with a string given the file name instead of a file object.

Throws:
IOException
JAXBException

formatResults

public static void formatResults(ContactCenterEval eval,
                                 File outputFile)
                          throws IOException,
                                 JAXBException
Formats the results of the last evaluation performed by eval into the file with name outputFile. The format of the file is determined automatically based on its extension.

Parameters:
eval - the evaluation system.
outputFile - the output file
Throws:
IOException - if an I/O error occurs.
ParserConfigurationException - if the output format is XML, and an error occurred while constructing the intermediate DOM document.
TransformerException - if the output format is XML, and an error occurs during the transformation of the DOM document into text.
JAXBException

formatResults

public static void formatResults(ContactCenterEval eval,
                                 OutputStream stream,
                                 CCResultsFormat fmt)
                          throws IOException,
                                 JAXBException
Formats the results of the evaluation system eval. If fmt is null or empty, this method simply prints the contents returned by eval.formatStatistics. Otherwise, it saves the results in stream. Depending on the value of fmt, i.e., TEXT, BINARY, XML, or EXCEL, the format of the output file is plain text, binary, XML, or MS Excel, respectively.

Parameters:
eval - the evaluation system being processed.
stream - the output stream.
fmt - the format of the output.
Throws:
IOException - if an I/O error occurs.
ParserConfigurationException - if the output format is XML, and an error occurred while constructing the intermediate DOM document.
TransformerException - if the output format is XML, and an error occurs during the transformation of the DOM document into text.
JAXBException

ContactCenters
V. 0.9.9.

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