Class ModelEvaluator

java.lang.Object
tools.descartes.dlim.generator.ModelEvaluator

public class ModelEvaluator extends Object
Takes a Descartes Load Intensity Model and provides the ability to sample its arrival rates at set points in time.
  • Constructor Details

    • ModelEvaluator

      public ModelEvaluator(Sequence rootSequence, int seed, String noiseMode)
      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

      public ModelEvaluator(Sequence rootSequence)
      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 sequence
      index - combinator's index
      wasMult - 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

      public String 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.