|
ContactCenters V. 0.9.9. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectumontreal.iro.lecuyer.stat.mperiods.IntegralMeasureMatrix<M>
public class IntegralMeasureMatrix<M extends MeasureMatrix>
Computes per-period values for a matrix of measures with a single period.
Some matrices of measures only support a single period. For example, when
using an Accumulate
object to compute
an integral over simulation time, per-period measures cannot be computed
directly. This class can be used to transform a matrix of measures with a
single period computing integrals into a multiple-periods matrix.
Let fi(t) be an integral (or a sum) for measure i, computed by the
underlying single-period matrix over the simulation time, from 0 to t.
Often, fi(t) is a discrete function such as a sum or the integral of a
piecewise-constant function, but the function can also be continuous. If
newRecord()
is called at simulation time tp, the value of
(tp) = (f0(tp), f1(tp),…) is computed and recorded. At
time t0 where
init()
is called, a record is automatically added
with the values in the matrices of measures. At the end of the simulation, if
newRecord()
was called P times, we have P + 1 recorded values of
(tp), for
p = 0,…, P. This permits the computation of P
vectors of integrals, each corresponding to a period. The integrals for
period p, i.e., during the interval
[tp, tp+1), are computed
by
(tp+1) -
(tp).
Constructor Summary | |
---|---|
IntegralMeasureMatrix(M mat,
int numPeriods)
Constructs a new matrix of measures for computing integrals on multiple periods. |
Method Summary | |
---|---|
IntegralMeasureMatrix<M> |
clone()
|
protected SumMatrix |
createSumMatrix(int nm,
int np)
This methods creates and returns the internal sum matrix, and is overridden in IntegralMeasureMatrixSW to create an instance of
SumMatrixSW instead. |
double |
getMeasure(int i,
int p)
Returns the measure i for period p. |
M |
getMeasureMatrix()
Returns the associated single-period matrix of measures. |
int |
getNumMeasures()
Returns the number of measures calculated by the implementation of this interface. |
int |
getNumPeriods()
Returns the number of periods stored into this matrix of measures. |
int |
getNumStoredRecords()
Returns the current number of records of ![]() |
protected int |
getPeriod()
Returns the period, in mpc , the new record needs to be added in. |
double |
getSum(int i,
int r)
Returns fi(tr), the measure i of the associated measure matrix at the simulation time tr. |
SumMatrix |
getSumMatrix()
Returns the internal sum matrix for which each period p contains the value of ![]() |
void |
init()
Initializes this matrix of measures for a new simulation replication. |
void |
newRecord()
Records the current values of ![]() |
void |
regroupPeriods(int x)
Increases the length of stored periods by regrouping them. |
void |
setMeasureMatrix(M mat)
Sets the associated matrix of measures to mat. |
void |
setNumMeasures(int nm)
Sets the number of measures to nm. |
void |
setNumPeriods(int numPeriods)
Sets the number of periods of this matrix to np. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public IntegralMeasureMatrix(M mat, int numPeriods)
mat
- the single-period matrix of measures.numPeriods
- the required number of periods.
NullPointerException
- if mat is null.
IllegalArgumentException
- if a multiple-periods matrix of measures is given, or if
numPeriods is smaller than 1.Method Detail |
---|
protected SumMatrix createSumMatrix(int nm, int np)
IntegralMeasureMatrixSW
to create an instance of
SumMatrixSW
instead.
nm
- the number of measures.np
- the number of periods.public M getMeasureMatrix()
public void setMeasureMatrix(M mat)
init()
.
mat
- the new matrix of measures.
NullPointerException
- if mat is null.
IllegalArgumentException
- if the given matrix has multiple periods.public SumMatrix getSumMatrix()
getNumMeasures()
while the number of periods is one more than
getNumPeriods()
.
public int getNumStoredRecords()
public void newRecord()
IllegalStateException
is thrown if no
additional record can be stored.
protected int getPeriod()
mpc
, the new record needs to be added in.
This returns mpc.getNumStoredPeriods()
.
newRecord()
.public void init()
MeasureMatrix
init
in interface MeasureMatrix
public int getNumMeasures()
MeasureMatrix
getNumMeasures
in interface MeasureMatrix
public void setNumMeasures(int nm)
MeasureMatrix
setNumMeasures
in interface MeasureMatrix
nm
- the new number of measures.public int getNumPeriods()
MeasureMatrix
getNumPeriods
in interface MeasureMatrix
public void setNumPeriods(int numPeriods)
MeasureMatrix
setNumPeriods
in interface MeasureMatrix
numPeriods
- the new number of periods.public double getSum(int i, int r)
i
- the measure index.r
- the record index.
IndexOutOfBoundsException
- if i or r are out of bounds.public double getMeasure(int i, int p)
getMeasure
in interface MeasureMatrix
i
- the index of the measure.p
- the period of the measure.
IndexOutOfBoundsException
- if i or p are negative or greater than or
equal to the number of measures or the number of periods,
respectively.public void regroupPeriods(int x)
MeasureMatrix
MeasureMatrix.getNumPeriods()
/x -
1, it sums the values for periods xp, ...,xp+x-1,
and stores the results in period p whose length will be
x times the length of original periods. If the number of periods
is not a multiple of x, an additional period is used to contain
the remaining sums of values. The unused periods are zeroed for future
use. This method can be useful for memory management when using batch
means to estimate steady-state performance measures.
regroupPeriods
in interface MeasureMatrix
x
- the number of periods per group.public String toString()
toString
in class Object
public IntegralMeasureMatrix<M> clone()
clone
in class Object
|
ContactCenters V. 0.9.9. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |