Class UtilizationModelStochastic

java.lang.Object
org.cloudsimplus.utilizationmodels.UtilizationModelAbstract
org.cloudsimplus.utilizationmodels.UtilizationModelStochastic
All Implemented Interfaces:
UtilizationModel

public class UtilizationModelStochastic extends UtilizationModelAbstract

Implements a model, according to which a Cloudlet generates random resource utilization every time frame, using a ContinuousDistribution.

The class may return different utilization values for the same requested time. For performance reasons, this behavior is dependent of the

invalid reference
#isHistoryEnabled()

and

invalid reference
#isAlwaysGenNewRandUtilization()
.
Since:
CloudSim Toolkit 2.0
Author:
Anton Beloglazov, Manoel Campos da Silva Filho
  • Constructor Details

    • UtilizationModelStochastic

      public UtilizationModelStochastic()
      Instantiates a stochastic utilization model that defines the resource utilization in percentage. The resource utilization history is enabled by default.
      See Also:
    • UtilizationModelStochastic

      public UtilizationModelStochastic(UtilizationModel.Unit unit)
      Instantiates a stochastic utilization model where the resource utilization is defined in the given unit. The resource utilization history is enabled by default.
      Parameters:
      unit - the UtilizationModel.Unit that determines how the resource is used (for instance, if the resource usage is defined in percentage of the Vm resource or in absolute values)
      See Also:
      • invalid reference
        #setHistoryEnabled(boolean)
      • invalid reference
        #isAlwaysGenNewRandUtilization()
    • UtilizationModelStochastic

      public UtilizationModelStochastic(UtilizationModel.Unit unit, long seed)
      Instantiates a stochastic utilization model where the resource utilization is defined in the given unit. The resource utilization history is enabled by default.
      Parameters:
      unit - the UtilizationModel.Unit that determines how the resource is used (for instance, if the resource usage is defined in percentage of the Vm resource or in absolute values)
      seed - the seed to initialize the random number generator.
      See Also:
      • invalid reference
        #setHistoryEnabled(boolean)
      • invalid reference
        #isAlwaysGenNewRandUtilization()
    • UtilizationModelStochastic

      public UtilizationModelStochastic(long seed)
      Instantiates a stochastic utilization model that defines the resource utilization in percentage. The resource utilization history is enabled by default.
      Parameters:
      seed - the seed to initialize the random number generator.
      See Also:
      • invalid reference
        #setHistoryEnabled(boolean)
      • invalid reference
        #isAlwaysGenNewRandUtilization()
    • UtilizationModelStochastic

      public UtilizationModelStochastic(ContinuousDistribution prng)
      Instantiates a stochastic utilization model based on a given Pseudo Random Number Generator (PRNG). It defines the resource utilization in percentage. The resource utilization history is enabled by default.
      Parameters:
      prng - the Pseudo Random Number Generator (PRNG) to generate utilization values
      See Also:
    • UtilizationModelStochastic

      public UtilizationModelStochastic(UtilizationModel.Unit unit, @NonNull @NonNull ContinuousDistribution prng)
      Instantiates a stochastic new utilization model based on a given Pseudo Random Number Generator (PRNG). The resource utilization history is enabled by default.
      Parameters:
      unit - the UtilizationModel.Unit that determines how the resource is used (for instance, if the resource usage is defined in percentage of the Vm resource or in absolute values)
      prng - the Pseudo Random Number Generator (PRNG) to generate utilization values
      See Also:
      • invalid reference
        #setHistoryEnabled(boolean)
      • invalid reference
        #isAlwaysGenNewRandUtilization()
  • Method Details

    • getUtilizationInternal

      protected double getUtilizationInternal(double time)
      Specified by:
      getUtilizationInternal in class UtilizationModelAbstract
      Parameters:
      time -
      Returns:
      See Also:
    • getUtilizationHistory

      protected Double getUtilizationHistory(double time)
      Gets the utilization percentage for a given time from the internal historyMap.
      Parameters:
      time - the time to get the utilization history for
      Returns:
      the stored utilization percentage or null if it has never been generated a utilization value for the given time
    • saveHistory

      public void saveHistory(String filename)
      Save the utilization history to a file.
      Parameters:
      filename - the filename
      Throws:
      IOException - when the file cannot be accessed
    • loadHistory

      public void loadHistory(String filename)
      Load a utilization history from a file.
      Parameters:
      filename - the filename
      Throws:
      IOException - when the file cannot be accessed