WelchDataFileAnalyzer

This class knows how to process data collected by the WelchDataFileCollector class and produce "Welch Data". That is for every observation, this file will average across the replications and compute the average across the replications and compute the cumulative sum over the averages.

It can make "wpdf" files which are binary DataOutputStream files holding the Welch average and the cumulative average for each of the observations.

wpdf = Welch Plot Data File

It can make a csv file that holds the Welch average and cumulative average

An Observer can be attached. It will be notified when a call to get() occurs. getLastDataPoint(), getLastObservationIndex(), and getLastReplicationIndex() can be used by the observer to determine the value, observation number, and replication of the observation after notification.

Unless specifically redirected, files produced by the operation of this class are stored in the same directory (getBaseDirectory()) that the wdf is stored as specified by the supplied WelchFileMetaDataBean information.

Author

rossetti

Constructors

Link copied to clipboard
constructor(bean: WelchFileMetaDataBean)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

The average time between observations in the simulation across all the replications. This can be used to determine a warmup period in terms of time.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Returns the last data point read or Double.NaN if none read. Can be used by Observers when data is read.

Link copied to clipboard

The number of observations across the replications

Link copied to clipboard

The number of observations in each replication

Link copied to clipboard

Returns the average within each replication. That is, the average of the observations within each replication. zero is the first replication

Link copied to clipboard
Link copied to clipboard

Returns the average amount of time taken per observation in each of the replications

Functions

Link copied to clipboard

Computes and returns the across replication average for ith row of observations

Link copied to clipboard

Fills the supplied array with a row of observations across the replications

Link copied to clipboard
open override fun attachObserver(observer: ObserverIfc<WelchDataFileAnalyzer>)

Allows the adding (attaching) of an observer to the observable

Link copied to clipboard

Creates a BatchStatistic that batches the Welch averages according to the batching parameters. Uses the number of observations via getMinNumObservationsInReplications() to determine the number of batches based on MIN_BATCH_SIZE. No data is deleted.

Creates a BatchStatistic that batches the Welch averages according to the batching parameters. Uses the number of observations via getMinNumObservationsInReplications() to determine the number of batches based on MIN_BATCH_SIZE.

fun batchWelchAverages(deletePt: Int, minBatchSize: Int): BatchStatistic

Creates a BatchStatistic that batches the Welch averages according to the batching parameters. Uses the number of observations via getMinNumObservationsInReplications() to determine the number of batches based on the supplied batch size.

fun batchWelchAverages(deletePt: Int, minNumBatches: Int, minBatchSize: Int): BatchStatistic

Creates a BatchStatistic that batches the Welch averages according to the batching parameters. If the minNumBatches x minBatchSize = number of observations then the maxNBMultiple does not matter. Uses a batch multiple of 2.

fun batchWelchAverages(deletePt: Int, minNumBatches: Int, minBatchSize: Int, maxNBMultiple: Int): BatchStatistic

Creates a BatchStatistic that batches the Welch averages according to the batching parameters. If the minNumBatches x minBatchSize = number of observations then the maxNBMultiple does not matter.

Link copied to clipboard
open override fun countObservers(): Int

Returns how many observers are currently attached to the observable

Link copied to clipboard
fun createCSVWelchDataFile(numObs: Long = minNumObservationsInReplications): File

This results in a comma separated value file that has each rows containing each observation for each replication and each replication as columns. The last two columns are avg is the average across the replications and cumAvg. The file is flushed and closed. The file is stored in the base directory holding the Welch data files and has the name of the data with _WelchData.csv appended.

Link copied to clipboard
fun createCSVWelchPlotDataFile(numObs: Long = minNumObservationsInReplications): File

Creates and writes out the Welch plot data. Squelches inconvenient IOExceptions The file is stored in the base directory holding the Welch data files and has the name of the data with _WelchPlotData.csv appended.

Link copied to clipboard
fun createWelchPlotDataFile(numObs: Long = minNumObservationsInReplications): File

Creates a file and writes out the Welch data to the DataOutputStream. This produces a file with the "wpdf" extension. wpdf = Welch Plot Data File Squelches inconvenient IOExceptions

Link copied to clipboard

Returns an array of the cumulative Welch averages. Since the number of observations in the file may be very large, this may have memory implications.

Link copied to clipboard
open override fun detachAllObservers()

Detaches all the observers from the observable

Link copied to clipboard
open override fun detachObserver(observer: ObserverIfc<WelchDataFileAnalyzer>)

Allows the deletion (removing) of an observer from the observable

Link copied to clipboard
fun get(): Double

Returns the value at the current position

operator fun get(i: Long, j: Int): Double

Returns the ith observation in the jth replication

Link copied to clipboard
open override fun isAttached(observer: ObserverIfc<WelchDataFileAnalyzer>): Boolean

Returns true if the observer is already attached

Link copied to clipboard

Returns the last observation index asked for. Can be used by observers Returns Integer.MIN_VALUE if no observations have been read

Link copied to clipboard

Returns the last replication index asked for. Can be used by observers Returns Integer.MIN_VALUE if no observations have been read

Link copied to clipboard

The number of replications

Link copied to clipboard
fun position(i: Long, j: Int): Long

Gets the position within the file relative to the beginning of the file of the ith observation in the jth replication. This assumes that the data is a double 8 bytes stored in column major form

Link copied to clipboard
operator fun set(i: Long, j: Int)

Moves the file pointer to the position associated with the ith observation in the jth replication

Link copied to clipboard
open override fun toString(): String
Link copied to clipboard

Returns an array of the Welch averages. Since the number of observations in the file may be very large, this may have memory implications.

Link copied to clipboard

Returns an array of the Welch averages. Since the number of observations in the file may be very large, this may have memory implications.

Link copied to clipboard
fun writeCSVWelchData(out: PrintWriter, numObs: Long = minNumObservationsInReplications)

Writes out the number of observations to the supplied PrintWriter This results in a comma separated value file that has each rows containing each observation for each replication and each replication as columns. The last two columns are avg is the average across the replications and cumAvg. The file is flushed and closed.

Link copied to clipboard
fun writeCSVWelchPlotData(out: PrintWriter, numObs: Long = minNumObservationsInReplications)

Writes out the number of observations to the supplied PrintWriter This results in a comma separated value file that has x_bar and cum_x_bar where x_bar is the average across the replications. The file is flushed and closed.

Link copied to clipboard

This produces a file with the "wpdf" extension. wpdf = Welch Plot Data File