Package jsl.observers
Class ControlVariateDataCollector
- java.lang.Object
-
- jsl.observers.ControlVariateDataCollector
-
public class ControlVariateDataCollector extends java.lang.Object
Defines responses and controls for a control variate experiment. Collects the replication responses for the responses and for the controls. Must be created prior to running the simulation to actually collect any data. Uses a ReplicationDataCollector
-
-
Constructor Summary
Constructors Constructor Description ControlVariateDataCollector(Model model)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
addControlVariate(java.lang.String randomVariableName, double meanValue)
If the RanddomVariable doesn't exist in the model then no control is set upjava.lang.String
addControlVariate(RandomVariable rv, double meanValue)
If the RandomVariable doesn't exist in the model then no control is set upvoid
addResponse(java.lang.String responseName)
void
addResponse(ResponseVariable response)
java.util.List<java.lang.String>
getControlNames()
The control namesdouble[]
getControlReplicationData(java.lang.String controlName)
double[][]
getData()
The replications are the rows.java.util.Map<java.lang.String,double[]>
getDataAsMap()
int
getNumberOfControlVariates()
int
getNumberOfResponses()
java.util.List<java.lang.String>
getResponseNames()
double[]
getResponseReplicationData(java.lang.String responseName)
java.lang.String
toString()
-
-
-
Constructor Detail
-
ControlVariateDataCollector
public ControlVariateDataCollector(Model model)
- Parameters:
model
- the model to collect on, must not be null
-
-
Method Detail
-
addResponse
public final void addResponse(java.lang.String responseName)
- Parameters:
responseName
- the name of the response to add for collection
-
addResponse
public final void addResponse(ResponseVariable response)
- Parameters:
response
- the response to add for collection
-
addControlVariate
public final java.lang.String addControlVariate(java.lang.String randomVariableName, double meanValue)
If the RanddomVariable doesn't exist in the model then no control is set up- Parameters:
randomVariableName
- the name of the RandomVariable to add as a controlmeanValue
- the mean of the RandomVariable- Returns:
- the name of the control response or null
-
addControlVariate
public final java.lang.String addControlVariate(RandomVariable rv, double meanValue)
If the RandomVariable doesn't exist in the model then no control is set up- Parameters:
rv
- the RandomVariable to add as a controlmeanValue
- the mean of the RandomVariable- Returns:
- the name of the control response or null
-
getNumberOfResponses
public final int getNumberOfResponses()
- Returns:
- the number of responses
-
getNumberOfControlVariates
public final int getNumberOfControlVariates()
- Returns:
- the number of controls
-
getResponseNames
public final java.util.List<java.lang.String> getResponseNames()
- Returns:
- a list holding the names of the responses
-
getControlNames
public final java.util.List<java.lang.String> getControlNames()
The control names- Returns:
- a copy of the names of the controls
-
getResponseReplicationData
public final double[] getResponseReplicationData(java.lang.String responseName)
- Parameters:
responseName
- the name of the response- Returns:
- the collected replication averages, each row is a replication
-
getControlReplicationData
public final double[] getControlReplicationData(java.lang.String controlName)
- Parameters:
controlName
- the name of the control- Returns:
- the collected replication averages minus the control mean, each row is a replication
-
getData
public final double[][] getData()
The replications are the rows. The columns are ordered first with response names and then with control names based on the order from getResponseNames() and getControlNames()- Returns:
- the response and control data from each replication
-
getDataAsMap
public final java.util.Map<java.lang.String,double[]> getDataAsMap()
- Returns:
- a map holding the response and control names as keys and replication averages as an array
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-