|
GridSim 5.0 beta | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Object GridSimRandom
public class GridSimRandom
GridSim Random provides static methods for incorporating randomness in data used for any simulation.
NOTE From version 5.0 this class will NOT be created by GridSim upon initialization of the simulation. Hence, you should instantiate this class according to your needs.
Any predicted or estimated data, e.g. number of Gridlets used by an experiment, execution time and output size of a Gridlet, etc. need to present in the prediction or estimation process and the randomness that exists in the nature itself.
Example: to produce a random number between 18.00 and 22.00, need to invoke GridSimRandom.real(20.0, 0.1, 0.1, randDouble) where randDouble comes from java.util.Random.
Gridlet
,
Random
,
GridSim.init(int, Calendar, boolean)
,
GridSim.init(int, Calendar, boolean, String[], String[], String)
Constructor Summary | |
---|---|
GridSimRandom()
Allocates a new GridSimRandom object |
|
GridSimRandom(long seed)
Allocates a new GridSimRandom object using a single long seed |
|
GridSimRandom(long seed,
double lessFactorIO,
double moreFactorIO,
double lessFactorExec,
double moreFactorExec)
Allocates a new GridSimRandom object with specified parameters |
Method Summary | |
---|---|
static double |
doubleSample()
Gets the random double value from java.util.Random |
static double |
expectedExec(double value)
Gets the expected factor of Execution |
static double |
expectedIO(double value)
Gets the expected factor of Network I/O |
static double |
getFactorExec()
Gets the average factor of Execution |
static double |
getFactorIO()
Gets the average factor of Network I/O |
static int |
intSample(int range)
Gets the random int value from java.util.Random |
static double |
real(double value,
double lessFactor,
double moreFactor,
double randDouble)
Maps the predicted or estimated value to a random real-world number between (1 - lessFactor) * value and (1 + moreFactor) * value. |
static double |
realExec(double value)
Gets the real number from the factors of Execution |
static double |
realIO(double value)
Gets the real number from the factors of Network I/O |
static void |
setAllFactors(double lessFactorIOValue,
double moreFactorIOValue,
double lessFactorExecValue,
double moreFactorExecValue)
Sets the Network I/O and execution values |
static void |
setLessFactorExec(double factor)
Sets the less factor of Execution |
static void |
setLessFactorIO(double factor)
Sets the less factor of Network I/O |
static void |
setMoreFactorExec(double factor)
Sets the more factor of Execution |
static void |
setMoreFactorIO(double factor)
Sets the more factor of Network I/O |
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public GridSimRandom()
public GridSimRandom(long seed)
seed
- the initial seedpublic GridSimRandom(long seed, double lessFactorIO, double moreFactorIO, double lessFactorExec, double moreFactorExec)
seed
- the initial seedlessFactorIO
- less factor for Network I/OmoreFactorIO
- more factor for Network I/OlessFactorExec
- less factor for executionmoreFactorExec
- more factor for executionMethod Detail |
---|
public static void setAllFactors(double lessFactorIOValue, double moreFactorIOValue, double lessFactorExecValue, double moreFactorExecValue)
lessFactorIOValue
- less factor for Network I/OmoreFactorIOValue
- more factor for Network I/OlessFactorExecValue
- less factor for executionmoreFactorExecValue
- more factor for executionpublic static int intSample(int range) throws IllegalArgumentException
range
- the bound on the random number to be returned.
The range must be positive (excluding 0).
IllegalArgumentException
- range is not positivepublic static double doubleSample()
public static void setLessFactorIO(double factor) throws IllegalArgumentException
factor
- the initial factor
IllegalArgumentException
- factor is not zero or positivepublic static void setMoreFactorIO(double factor) throws IllegalArgumentException
factor
- the initial factor
IllegalArgumentException
- factor is not zero or positivepublic static void setLessFactorExec(double factor) throws IllegalArgumentException
factor
- the initial factor
IllegalArgumentException
- factor is not zero or positivepublic static void setMoreFactorExec(double factor) throws IllegalArgumentException
factor
- the initial factor
IllegalArgumentException
- factor is not zero or positivepublic static double getFactorIO()
public static double getFactorExec()
public static double real(double value, double lessFactor, double moreFactor, double randDouble) throws IllegalArgumentException
The formula used is:
value * (1 - lessFactor + (lessFactor + moreFactor) *
randDouble)
where 0.0 <= lessFactor and moreFactor <= 1.0
value
- the estimated valuelessFactor
- less factor for a valuemoreFactor
- more factor for a value (the range is between 0.0
and 1.0)randDouble
- an uniformly distributed double value
between 0.0 and 1.0
IllegalArgumentException
- value, lessFactor,
moreFactor and randDouble are not zero
or positive. In addition, the max. number for
moreFactor and randDouble is 1.0public static double realIO(double value) throws IllegalArgumentException
value
- the estimated value
IllegalArgumentException
- value is not zero or positivepublic static double realExec(double value) throws IllegalArgumentException
value
- the estimated value
IllegalArgumentException
- factor is not zero or positivepublic static double expectedIO(double value) throws IllegalArgumentException
value
- the estimated value
IllegalArgumentException
- factor is not zero or positivepublic static double expectedExec(double value) throws IllegalArgumentException
value
- the estimated value
IllegalArgumentException
- factor is not zero or positive
|
GridSim 5.0 beta | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |