Class UtilizationModelStochastic
java.lang.Object
org.cloudsimplus.utilizationmodels.UtilizationModelAbstract
org.cloudsimplus.utilizationmodels.UtilizationModelStochastic
- All Implemented Interfaces:
UtilizationModel
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
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.cloudsimplus.utilizationmodels.UtilizationModel
UtilizationModel.Unit -
Field Summary
Fields inherited from class org.cloudsimplus.utilizationmodels.UtilizationModelAbstract
ALMOST_ZEROFields inherited from interface org.cloudsimplus.utilizationmodels.UtilizationModel
NULL -
Constructor Summary
ConstructorsConstructorDescriptionInstantiates a stochastic utilization model that defines the resource utilization in percentage.UtilizationModelStochastic(long seed) Instantiates a stochastic utilization model that defines the resource utilization in percentage.Instantiates a stochastic utilization model based on a given Pseudo Random Number Generator (PRNG).Instantiates a stochastic utilization model where the resource utilization is defined in the given unit.UtilizationModelStochastic(UtilizationModel.Unit unit, long seed) Instantiates a stochastic utilization model where the resource utilization is defined in the given unit.UtilizationModelStochastic(UtilizationModel.Unit unit, @NonNull ContinuousDistribution prng) Instantiates a stochastic new utilization model based on a given Pseudo Random Number Generator (PRNG). -
Method Summary
Modifier and TypeMethodDescriptionprotected DoublegetUtilizationHistory(double time) Gets the utilization percentage for a given time from the internalhistoryMap.protected doublegetUtilizationInternal(double time) voidloadHistory(String filename) Load a utilization history from a file.voidsaveHistory(String filename) Save the utilization history to a file.Methods inherited from class org.cloudsimplus.utilizationmodels.UtilizationModelAbstract
getUtilization, getUtilization, setUnit, validateUtilizationField, validateUtilizationFieldMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.cloudsimplus.utilizationmodels.UtilizationModel
getSimulation, getUnit, isOverCapacityRequestAllowed, setOverCapacityRequestAllowed, setSimulation
-
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
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- theUtilizationModel.Unitthat 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:
-
UtilizationModelStochastic
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- theUtilizationModel.Unitthat 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:
-
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:
-
UtilizationModelStochastic
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- theUtilizationModel.Unitthat 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:
-
-
Method Details
-
getUtilizationInternal
protected double getUtilizationInternal(double time) - Specified by:
getUtilizationInternalin classUtilizationModelAbstract- Parameters:
time-- Returns:
- See Also:
-
getUtilizationHistory
Gets the utilization percentage for a given time from the internalhistoryMap.- Parameters:
time- the time to get the utilization history for- Returns:
- the stored utilization percentage or
nullif it has never been generated a utilization value for the given time
-
saveHistory
Save the utilization history to a file.- Parameters:
filename- the filename- Throws:
IOException- when the file cannot be accessed
-
loadHistory
Load a utilization history from a file.- Parameters:
filename- the filename- Throws:
IOException- when the file cannot be accessed
-