Package tools.descartes.dlim.generator
Class ModelEvaluator
java.lang.Object
tools.descartes.dlim.generator.ModelEvaluator
Takes a Descartes Load Intensity Model and provides the ability to sample its
arrival rates at set points in time.
-
Constructor Summary
ConstructorsConstructorDescriptionModelEvaluator
(Sequence rootSequence) Creates a default ModelEvaluator for the given Descartes Load Intensity Model.ModelEvaluator
(Sequence rootSequence, int seed, String noiseMode) Creates a new ModelEvaluator for a Descartes Load Intensity Model. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Checks and returns true, if the model contains and uses a ReferenceClockObject.double
getArrivalRateAtTime
(double rootTime) Evaluates the model and returns the arrival rate at the given time.getArrivalRateAtTimes
(double startTime, double endTime, double step) Evaluates the model for the specified time interval and stores the result in a list.double
getArrivalRateDelta
(double rootTime, int index, boolean[] wasMult) Gets the Delta between the root function and the final output including the index-th combinators.double
The time-span for which the model is defined.getName()
The name of the root Sequence.double
Gets the random number.org.apache.commons.math3.random.JDKRandomGenerator
The random number generator.double
Returns a model duration that guarantees model execution.void
setRandomSeed
(int seed) Sets the random seed.
-
Constructor Details
-
ModelEvaluator
Creates a new ModelEvaluator for a Descartes Load Intensity Model.- Parameters:
rootSequence
- The root model element. This is always a Sequence.seed
- The seed, with which to set up the random number generator.noiseMode
- set this to IGeneratorConstants.EVALUATION for normal model evaluation, set it to IGeneratorConstants.CALIBRATION, if Noises are to always return 0.
-
ModelEvaluator
Creates a default ModelEvaluator for the given Descartes Load Intensity Model. The default ModelEvaluator evaluates Noises with IGeneratorContstants.DEFAULTRANDOMSEED.- Parameters:
rootSequence
- The root model element. This is always a Sequence.
-
-
Method Details
-
getArrivalRateAtTime
public double getArrivalRateAtTime(double rootTime) Evaluates the model and returns the arrival rate at the given time.- Parameters:
rootTime
- The time for which to get the arrival rate.- Returns:
- The model's arrival rate at the time.
-
getArrivalRateAtTimes
public ArrayList<ArrivalRateTuple> getArrivalRateAtTimes(double startTime, double endTime, double step) Evaluates the model for the specified time interval and stores the result in a list. Uses multithreading for performance.- Parameters:
startTime
- The time to start evaluation (inclusive).endTime
- The time to end evaluation (exclusive).step
- The sampling steps.- Returns:
- A list with the arrival rate tuples.
-
getArrivalRateDelta
public double getArrivalRateDelta(double rootTime, int index, boolean[] wasMult) Gets the Delta between the root function and the final output including the index-th combinators.- Parameters:
rootTime
- time stamp as defined at this moment within the root sequenceindex
- combinator's indexwasMult
- writes back if the combinator in this function was multiplicative or not- Returns:
- the difference
-
getDuration
public double getDuration()The time-span for which the model is defined.- Returns:
- time span
-
getTerminatingDuration
public double getTerminatingDuration()Returns a model duration that guarantees model execution. Returns the model duration if it is not infinite. Returns the duration of a single iteration of the loop sequence, otherwise.- Returns:
- A terminating model duration
-
getName
The name of the root Sequence.- Returns:
- name attribute of root sequence
-
getRndGenerator
public org.apache.commons.math3.random.JDKRandomGenerator getRndGenerator()The random number generator. This generator has already been initialized using the correct seed.- Returns:
- the random generator
-
getRandomNumber
public double getRandomNumber()Gets the random number.- Returns:
- the random number
-
setRandomSeed
public void setRandomSeed(int seed) Sets the random seed.- Parameters:
seed
- the new random seed
-
containsReferenceClockObject
public boolean containsReferenceClockObject()Checks and returns true, if the model contains and uses a ReferenceClockObject.- Returns:
- True, if at least one Sequence in the model contains a ReferenceClockObject.
-