Package jsl.observers.variable
Class MultipleComparisonDataCollector
- java.lang.Object
-
- jsl.observers.ModelElementObserver
-
- jsl.observers.variable.MultipleComparisonDataCollector
-
- All Implemented Interfaces:
ObserverIfc
,GetNameIfc
,IdentityIfc
public class MultipleComparisonDataCollector extends ModelElementObserver
Collects multiple comparison data for a particular ResponseVariable (each across replication average for each system configuration) This class assumes that each Experiment is given a unique name in order to uniquely determine the configuration for which the across replication data is collected for the observed response variable. This observer must be attached prior to running the simulation.
-
-
Field Summary
-
Fields inherited from class jsl.observers.ModelElementObserver
myName
-
-
Constructor Summary
Constructors Constructor Description MultipleComparisonDataCollector(ResponseVariable response)
MultipleComparisonDataCollector(ResponseVariable response, java.lang.String name)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
afterReplication(ModelElement m, java.lang.Object arg)
protected void
beforeExperiment(ModelElement m, java.lang.Object arg)
void
clearData()
Sets all the data to zerodouble[]
getAcrossReplicationData(java.lang.String name)
Across replication averages for the experiment with the given namedouble[][]
getDataAsArray()
A 2-Dim array of the data each row represents the across replication average for each configuration (column).java.util.LinkedHashMap<java.lang.String,double[]>
getDataAsMap()
The key is the name of the experiment The double[] is a array of the across replication averages for the response variablejava.lang.String[]
getExperimentNames()
Returns the names of the experiments as an array of stringsint
getMinimumNumberReplicationsAcrossExperiments()
Returns the number of replications in the experiment that had the smallest number of replicationsMultipleComparisonAnalyzer
getMultipleComparisonAnalyzer()
Returns a MultipleComparisonAnalyzer based on the data of the collectorjava.io.PrintWriter
writeDataAsCSVFile()
Write the data to a default file with name Response.getName() + "_MCBData".csv within the simulation's output directoryvoid
writeDataAsCSVFile(java.io.PrintWriter out, boolean header)
Writes the data out to the PrintWriter Each row represents a different replication the columns start with ResponseName, Rep_Num and then each configuration in a new column The header has "ResponseName", "Rep_Num", Experiment Name, ...-
Methods inherited from class jsl.observers.ModelElementObserver
afterExperiment, beforeReplication, getId, getModelElement, getName, initialize, montecarlo, removedFromModel, replicationEnded, setModelElement, setName, timedUpdate, toString, update, update, warmUp
-
-
-
-
Constructor Detail
-
MultipleComparisonDataCollector
public MultipleComparisonDataCollector(ResponseVariable response)
-
MultipleComparisonDataCollector
public MultipleComparisonDataCollector(ResponseVariable response, java.lang.String name)
-
-
Method Detail
-
clearData
public final void clearData()
Sets all the data to zero
-
getExperimentNames
public java.lang.String[] getExperimentNames()
Returns the names of the experiments as an array of strings- Returns:
- the names of the experiments as an array of strings
-
getMultipleComparisonAnalyzer
public final MultipleComparisonAnalyzer getMultipleComparisonAnalyzer()
Returns a MultipleComparisonAnalyzer based on the data of the collector- Returns:
- a MultipleComparisonAnalyzer based on the data of the collector
-
getDataAsMap
public final java.util.LinkedHashMap<java.lang.String,double[]> getDataAsMap()
The key is the name of the experiment The double[] is a array of the across replication averages for the response variable- Returns:
- a copy of the data
-
getMinimumNumberReplicationsAcrossExperiments
public final int getMinimumNumberReplicationsAcrossExperiments()
Returns the number of replications in the experiment that had the smallest number of replications- Returns:
- the number of replications in the experiment that had the smallest number of replications
-
getDataAsArray
public final double[][] getDataAsArray()
A 2-Dim array of the data each row represents the across replication average for each configuration (column). The number of rows is based on the configuration that has the smallest number of replications. Thus, this produces a rectangular array and may not include all replication data for every configuration.- Returns:
- the data as an array
-
writeDataAsCSVFile
public void writeDataAsCSVFile(java.io.PrintWriter out, boolean header)
Writes the data out to the PrintWriter Each row represents a different replication the columns start with ResponseName, Rep_Num and then each configuration in a new column The header has "ResponseName", "Rep_Num", Experiment Name, ...- Parameters:
out
- the PrintWriterheader
- if true write the header, false don't write the header
-
writeDataAsCSVFile
public java.io.PrintWriter writeDataAsCSVFile()
Write the data to a default file with name Response.getName() + "_MCBData".csv within the simulation's output directory- Returns:
- the PrintWriter
-
getAcrossReplicationData
public final double[] getAcrossReplicationData(java.lang.String name)
Across replication averages for the experiment with the given name- Parameters:
name
- the name- Returns:
- the replication averages
-
beforeExperiment
protected void beforeExperiment(ModelElement m, java.lang.Object arg)
- Overrides:
beforeExperiment
in classModelElementObserver
-
afterReplication
protected void afterReplication(ModelElement m, java.lang.Object arg)
- Overrides:
afterReplication
in classModelElementObserver
-
-