ContactCenters
V. 0.9.9.

umontreal.iro.lecuyer.contactcenters.app
Class PerformanceMeasureFormatText

java.lang.Object
  extended by umontreal.iro.lecuyer.contactcenters.app.PerformanceMeasureFormat
      extended by umontreal.iro.lecuyer.contactcenters.app.PerformanceMeasureFormatText

public class PerformanceMeasureFormatText
extends PerformanceMeasureFormat

Defines some facilities to format performance measures as strings. For each estimated performance measure, an evaluation system can produce matrices of results which may need to be formatted to be displayed on-screen or included in printable documents. This class defines methods to create summary reports for several performance measures or a detailed report for a particular measure.

Each formatting method constructs an ObjectMatrix2D instance containing String elements, each numerical value being processed using a double formatter implementing interfaces DoubleFormatter or DoubleFormatterWithError. After the intermediate matrix is constructed, the method uses an instance of Formatter to turn it into a String. By default, this class is adapted for on-screen reports, but methods may be overridden for other types of formatting.


Field Summary
 
Fields inherited from class umontreal.iro.lecuyer.contactcenters.app.PerformanceMeasureFormat
agentGroupProperties, contactTypeProperties, histogramList
 
Constructor Summary
PerformanceMeasureFormatText()
          Creates a performance measure formatter using the default Formatter implementation adapted for on-screen printing.
PerformanceMeasureFormatText(Formatter fmt)
          Constructs a performance measure formatter with the formatter fmt.
PerformanceMeasureFormatText(Formatter fmt, DoubleFormatter dfmtVal, DoubleFormatter dfmtStat)
          Constructs a performance measure formatter with the matrix formatter fmt, the double-precision formatter fmtVal for values (with unknown error), and fmtStat for statistics (with an estimated error).
PerformanceMeasureFormatText(Formatter fmt, ReportParams reportParams)
           
PerformanceMeasureFormatText(ReportParams reportParams)
           
 
Method Summary
 String formatInfo(Map<String,Object> info)
          Constructs and returns a string containing the evaluation information info.
 String formatObservations(ContactCenterSimWithObservations sim, ReportParams reportParams)
          For each element PerformanceMeasureParams in the list returned by ReportParams.getPrintedObs(), formats a report containing the complete list of observations generated by the simulator sim for the referred performance measure.
 String formatStatistics(ContactCenterSim sim, ReportParams reportParams)
          Similar to formatValues(ContactCenterEval,ReportParams), except this formats a full statistical report using formatStatisticsSummary(ContactCenterSim,double,PerformanceMeasureType[]), and formatStatisticsDetailed(ContactCenterSim,double,PerformanceMeasureType).
 String formatStatisticsDetailed(ContactCenterSim sim, double level, PerformanceMeasureType pm)
          Returns a statistical report for all the values of the performance measure pm estimated by the simulator sim, with confidence intervals with level level.
 String formatStatisticsDetailedHidePeriods(ContactCenterSim sim, double level, PerformanceMeasureType pm)
          Similar to formatStatisticsDetailed(ContactCenterSim,double,PerformanceMeasureType) but does not format per-period statistics.
 String formatStatisticsSummary(ContactCenterSim sim, double level, PerformanceMeasureType... pms)
          Formats a statistical report for all the performance measures in pms supported by the contact center simulator sim.
 String formatValues(ContactCenterEval eval, ReportParams reportParams)
          Formats and returns a string containing the report of the last evaluation performed by the system eval.
 String formatValuesDetailed(ContactCenterEval eval, PerformanceMeasureType pm)
          Returns a string containing the current values of the performance measures of type pm estimated by the evaluation system eval.
 String formatValuesDetailedHidePeriods(ContactCenterEval eval, PerformanceMeasureType pm)
          Similar to formatValuesDetailed(ContactCenterEval,PerformanceMeasureType) except per-period values are not displayed.
 String formatValuesDetailedMatrix(ContactCenterEval eval, PerformanceMeasureType pm)
          Returns a string containing the current values of the performance measures of type pm estimated by the evaluation system eval.
 String formatValuesMatrix(ContactCenterInfo eval, PerformanceMeasureType pm, DoubleMatrix2D valm, int row, int column, int height, int width, boolean transposedValm, String description)
          This is similar to formatValuesSingleRow(ContactCenterInfo,PerformanceMeasureType,DoubleMatrix2D,int,int,int,int,String), except that the intermediate matrix of strings has dimensions a×b.
 String formatValuesSingleRow(ContactCenterInfo eval, PerformanceMeasureType pm, DoubleMatrix2D valm, int row, int column, int height, int width, String description)
          Formats the values in a matrix valm.viewPart (row, column, height, width) concerning performance measures of type pm obtained with the evaluation system eval.
 String formatValuesSummary(ContactCenterEval eval, PerformanceMeasureType... pms)
          Formats a report for all the performance measures pms supported by the evaluation system eval.
 DoubleFormatter getDoubleFormatterStatistics()
          Returns the double-precision formatter used for statistics.
 DoubleFormatter getDoubleFormatterValues()
          Returns the double-precision formatter used for values.
 Formatter getMatrixFormatter()
          Returns the matrix formatter used by this object.
 String getPercentString()
          Returns the string representing the percentage sign in reports, the default being %.
 void setDoubleFormatterStatistics(DoubleFormatter dfmtStat)
          Sets the double-precision formatter used for statistics to dfmtStat.
 void setDoubleFormatterValues(DoubleFormatter dfmtVal)
          Sets the double-precision formatter used for values to dfmtVal.
 void setMatrixFormatter(Formatter fmt)
          Sets the matrix formatter used by this object to fmt.
 void setPercentString(String percentString)
          Sets the percentage string to percentString.
 
Methods inherited from class umontreal.iro.lecuyer.contactcenters.app.PerformanceMeasureFormat
addExperimentInfo, capitalizeFirstLetter, columnNameWithProperties, countRowsSummary, createHistogram, formatResults, formatResults, formatResults, getDefaultPrintedStatParams, getHistogramList, getName, getNameWithProperties, getNumPropColumns, getNumPropRows, getPerformanceMeasures, getPerformanceMeasures, getPerformanceMeasures, getPropColumns, getPropNameColumns, getPropNameRows, getPropRows, getPropRows, getShownProperties, getStandardDeviation, getStatColumnNames, getValColumnNames, isIncludedInDefaultReport, isIncludedInReport, isIncludedInSummary, rowNameWithProperties, writeHistograms, writeHistogramsLaTeX
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PerformanceMeasureFormatText

public PerformanceMeasureFormatText()
Creates a performance measure formatter using the default Formatter implementation adapted for on-screen printing.


PerformanceMeasureFormatText

public PerformanceMeasureFormatText(Formatter fmt)
Constructs a performance measure formatter with the formatter fmt.

Parameters:
fmt - the user-defined formatter object.
Throws:
NullPointerException - if fmt is null.

PerformanceMeasureFormatText

public PerformanceMeasureFormatText(Formatter fmt,
                                    DoubleFormatter dfmtVal,
                                    DoubleFormatter dfmtStat)
Constructs a performance measure formatter with the matrix formatter fmt, the double-precision formatter fmtVal for values (with unknown error), and fmtStat for statistics (with an estimated error).

Parameters:
fmt - the user-defined formatter object.
dfmtVal - the double-precision formatter for values.
dfmtStat - the doubl-precision formatter for statistics.
Throws:
NullPointerException - if any argument is null.

PerformanceMeasureFormatText

public PerformanceMeasureFormatText(ReportParams reportParams)

PerformanceMeasureFormatText

public PerformanceMeasureFormatText(Formatter fmt,
                                    ReportParams reportParams)
Method Detail

getMatrixFormatter

public Formatter getMatrixFormatter()
Returns the matrix formatter used by this object.

Returns:
the matrix formatter.

setMatrixFormatter

public void setMatrixFormatter(Formatter fmt)
Sets the matrix formatter used by this object to fmt.

Parameters:
fmt - the matrix formatter used.

getDoubleFormatterValues

public DoubleFormatter getDoubleFormatterValues()
Returns the double-precision formatter used for values.

Returns:
the double-precision formatter used for values.

setDoubleFormatterValues

public void setDoubleFormatterValues(DoubleFormatter dfmtVal)
Sets the double-precision formatter used for values to dfmtVal.

Parameters:
dfmtVal - the new double-precision formatter used for values.

getDoubleFormatterStatistics

public DoubleFormatter getDoubleFormatterStatistics()
Returns the double-precision formatter used for statistics.

Returns:
the double-precision formatter used for statistics.

setDoubleFormatterStatistics

public void setDoubleFormatterStatistics(DoubleFormatter dfmtStat)
Sets the double-precision formatter used for statistics to dfmtStat.

Parameters:
dfmtStat - the double-precision formatter used for statistics.

getPercentString

public String getPercentString()
Returns the string representing the percentage sign in reports, the default being %.

Returns:
the percentage string.

setPercentString

public void setPercentString(String percentString)
Sets the percentage string to percentString.

Parameters:
percentString - the new percentage string.

formatValuesSummary

public String formatValuesSummary(ContactCenterEval eval,
                                  PerformanceMeasureType... pms)
Formats a report for all the performance measures pms supported by the evaluation system eval. It uses the ContactCenterEval.getPerformanceMeasure(umontreal.iro.lecuyer.contactcenters.app.PerformanceMeasureType) method to obtain a matrix of values for each performance measure in pms supported by eval. Considering the element at the bottom right of this matrix as the aggregate value, the method then formats this value for each performance measure, using getDoubleFormatterValues() to convert double-precision values to strings.

The intermediate formatting matrix contains one row for each performance measure, and a single column containing its aggregate value.

Parameters:
eval - the contact center evaluation system.
pms - the array of performance measures.
Returns:
the string containing the values of performance measures.

formatValuesDetailed

public String formatValuesDetailed(ContactCenterEval eval,
                                   PerformanceMeasureType pm)
Returns a string containing the current values of the performance measures of type pm estimated by the evaluation system eval. This method uses formatValuesSingleRow(ContactCenterInfo,PerformanceMeasureType,DoubleMatrix2D,int,int,int,int,String) with a matrix of values obtained via eval.getPerformanceMeasure, and a description obtained via pm.getDescription().

Parameters:
eval - the contact center evaluation system.
pm - the performance measure of interest.
Returns:
the string containing the values of performance measure.

formatValuesDetailedMatrix

public String formatValuesDetailedMatrix(ContactCenterEval eval,
                                         PerformanceMeasureType pm)
Returns a string containing the current values of the performance measures of type pm estimated by the evaluation system eval. This method uses formatValuesMatrix(ContactCenterInfo,PerformanceMeasureType,DoubleMatrix2D,int,int,int,int,boolean,String) with a matrix of values obtained via eval.getPerformanceMeasure, and a description obtained via pm.getDescription().

Parameters:
eval - the contact center evaluation system.
pm - the performance measure of interest.
Returns:
the string containing the values of performance measure.

formatValuesDetailedHidePeriods

public String formatValuesDetailedHidePeriods(ContactCenterEval eval,
                                              PerformanceMeasureType pm)
Similar to formatValuesDetailed(ContactCenterEval,PerformanceMeasureType) except per-period values are not displayed.

Parameters:
eval - the evaluation system.
pm - the type of performance measure.
Returns:
the formatted string.

formatValuesSingleRow

public String formatValuesSingleRow(ContactCenterInfo eval,
                                    PerformanceMeasureType pm,
                                    DoubleMatrix2D valm,
                                    int row,
                                    int column,
                                    int height,
                                    int width,
                                    String description)
Formats the values in a matrix valm.viewPart (row, column, height, width) concerning performance measures of type pm obtained with the evaluation system eval. Numbers are formatted using getDoubleFormatterValues(), and description provides a description for the matrix.

Suppose that the given matrix has dimensions a×b. For example, the matrix can contain averages or sample variances for different contact types and periods. This method creates a ab×1 intermediate matrix of strings with one row for each element of valm. The names of rows are constructed using getName (eval, pm, i, j).

Parameters:
eval - the evaluation system.
pm - the type of performance measures concerned.
valm - the matrix of values.
row - the starting row of the matrix to be formatted.
column - the starting column of the matrix to be formatted.
height - the height of the formatted matrix.
width - the width of the formatted matrix.
description - the description for the formatted matrix.
Returns:
the formatted matrix.

formatValuesMatrix

public String formatValuesMatrix(ContactCenterInfo eval,
                                 PerformanceMeasureType pm,
                                 DoubleMatrix2D valm,
                                 int row,
                                 int column,
                                 int height,
                                 int width,
                                 boolean transposedValm,
                                 String description)
This is similar to formatValuesSingleRow(ContactCenterInfo,PerformanceMeasureType,DoubleMatrix2D,int,int,int,int,String), except that the intermediate matrix of strings has dimensions a×b. The formatted strings obtained via this method are often more readable than with the preceding method, but they can contain excessively long lines if the width is large.

If transposedValm is true, the given matrix is considered to be transposed, i.e., the meaning of its rows and columns is inverted with respect to a typical matrix of performance measures of type pm. For example, let pm correspond to PerformanceMeasureType.SERVEDRATES. Usually, each row of valm corresponds to a contact type. With transposedValm enabled, each row of valm corresponds to an agent group. This flag only affects how rows and columns are named; it does not change the values being formatted.

Parameters:
eval - the evaluation system.
pm - the type of performance measures concerned.
valm - the matrix of values.
row - the starting row of the matrix to be formatted.
column - the starting column of the matrix to be formatted.
height - the height of the formatted matrix.
width - the width of the formatted matrix.
transposedValm - determines if valm is transposed with respect to a typical matrix of performance measures of type pm.
description - the description for the formatted matrix.
Returns:
the formatted matrix.

formatStatisticsSummary

public String formatStatisticsSummary(ContactCenterSim sim,
                                      double level,
                                      PerformanceMeasureType... pms)
Formats a statistical report for all the performance measures in pms supported by the contact center simulator sim. This is similar to formatValuesSummary(umontreal.iro.lecuyer.contactcenters.app.ContactCenterEval, umontreal.iro.lecuyer.contactcenters.app.PerformanceMeasureType...), with additional statistical information such as miminum, maximum, standard deviation, and confidence intervals with confidence level level, if available. Values are formatted using the formatter getDoubleFormatterStatistics().

The format of the intermediate matrix is the same as formatValuesSummary(umontreal.iro.lecuyer.contactcenters.app.ContactCenterEval, umontreal.iro.lecuyer.contactcenters.app.PerformanceMeasureType...), except that columns are defined for the minimum, maximum, average, standard deviation, and confidence interval.

Parameters:
sim - the contact center simulator.
level - the level of confidence of the intervals
pms - the array of performance measures.
Returns:
the statistics formatted as a string.

formatStatisticsDetailed

public String formatStatisticsDetailed(ContactCenterSim sim,
                                       double level,
                                       PerformanceMeasureType pm)
Returns a statistical report for all the values of the performance measure pm estimated by the simulator sim, with confidence intervals with level level. Values are formatted using getDoubleFormatterStatistics().

The intermediate matrix has a format similar to the one constructed by formatValuesDetailed(ContactCenterEval,PerformanceMeasureType), except that a column is defined for the minimum, maximum, average, standard deviation, and confidence interval.

Parameters:
sim - the contact center simulator.
level - the level of confidence intervals.
pm - the performance measure of interest.
Returns:
the statistical report formatted as a string.

formatStatisticsDetailedHidePeriods

public String formatStatisticsDetailedHidePeriods(ContactCenterSim sim,
                                                  double level,
                                                  PerformanceMeasureType pm)
Similar to formatStatisticsDetailed(ContactCenterSim,double,PerformanceMeasureType) but does not format per-period statistics.

Parameters:
sim - the contact center simulator.
level - the confidence level of the intervals.
pm - the type of performance measures.
Returns:
the formatted string.

formatInfo

public String formatInfo(Map<String,Object> info)
Constructs and returns a string containing the evaluation information info. For each entry in the given map, this method formats a line of the form key: value. Values are formatted as follows. Any null reference becomes the string null, instances of Number are formatted using NumberFormat, and instances of Date are formatted using DateFormat. Any other non-null value is formatted using the Object.toString() method.

Parameters:
info - the evaluation information.
Returns:
the string with the formatted information.

formatObservations

public String formatObservations(ContactCenterSimWithObservations sim,
                                 ReportParams reportParams)
For each element PerformanceMeasureParams in the list returned by ReportParams.getPrintedObs(), formats a report containing the complete list of observations generated by the simulator sim for the referred performance measure. Each measure-specific report is concatenated, and the resulting string is returned.

Parameters:
sim - the queried simulator.
reportParams - the report parameters.
Returns:
the string containing observations.

formatValues

public String formatValues(ContactCenterEval eval,
                           ReportParams reportParams)
Formats and returns a string containing the report of the last evaluation performed by the system eval. This method can be called by the implementation of ContactCenterEval.formatStatistics().

This method first calls formatInfo(Map) with the evaluation information of eval. It then formats a summary report using formatValuesSummary(ContactCenterEval,PerformanceMeasureType...). Then, for each performance measure a detailed report is requested for, the method appends the contents of formatStatisticsDetailed(ContactCenterSim,double,PerformanceMeasureType) or formatValuesDetailedHidePeriods(ContactCenterEval,PerformanceMeasureType) to the report. The types of performance measures to include in the report are selected using reportParams.getPrintedStats() which can be null or empty; in these two latter cases, the report includes all performance measures supported by eval. Each element of printedStats specifies a type of performance measure to include in the report (if supported by eval), whether a detailed report must be included, and if this detailed report includes information about each individual period.

Parameters:
eval - the evaluation system.
reportParams - the report parameters.
Returns:
the string containing the formatted report.

formatStatistics

public String formatStatistics(ContactCenterSim sim,
                               ReportParams reportParams)
Similar to formatValues(ContactCenterEval,ReportParams), except this formats a full statistical report using formatStatisticsSummary(ContactCenterSim,double,PerformanceMeasureType[]), and formatStatisticsDetailed(ContactCenterSim,double,PerformanceMeasureType). If the given report parameters contains information about observations to print, the method also calls formatObservations(ContactCenterSimWithObservations,ReportParams), and appends the result to the returned string.

Parameters:
sim - the contact center simulator.
reportParams - the report parameters.
Returns:
the formatted report.

ContactCenters
V. 0.9.9.

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