Package jsl.observers

Class 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 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 control
        meanValue - 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 control
        meanValue - 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 class java.lang.Object