SSJ
3.3.1
Stochastic Simulation in Java
|
Represents a function computing a ratio of two values. More...
Public Member Functions | |
RatioFunction () | |
Constructs a new ratio function. | |
RatioFunction (double zeroOverZero) | |
Constructs a new ratio function that returns zeroOverZero for the special case of \(0/0\). More... | |
double | getZeroOverZeroValue () |
Returns the value returned by evaluate in the case where the \(0/0\) function is calculated. More... | |
void | setZeroOverZeroValue (double zeroOverZero) |
Sets the value returned by evaluate for the undefined function \(0/0\) to zeroOverZero . More... | |
int | getDimension () |
Returns \(d\), the dimension of the function computed by this implementation. More... | |
double | evaluate (double... x) |
Computes the function \(g(\mathbf{x})\) for the vector x . More... | |
double | evaluateGradient (int i, double... x) |
Computes \(\partial g(\mathbf{x})/\partial x_i\), the derivative of \(g(\mathbf{x})\) with respect to \(x_i\). More... | |
Represents a function computing a ratio of two values.
RatioFunction | ( | double | zeroOverZero | ) |
Constructs a new ratio function that returns zeroOverZero
for the special case of \(0/0\).
See the getZeroOverZeroValue method for more information. The default value of zeroOverZero
is Double.NaN
.
zeroOverZero | the value for \(0/0\). |
double evaluate | ( | double... | x | ) |
Computes the function \(g(\mathbf{x})\) for the vector x
.
The length of the given array must correspond to the dimension of this function. The method must compute and return the result of the function without modifying the elements in x
since the array can be reused for further computation.
x | a vector \(\mathbf{x}\). |
NullPointerException | if x is null . |
IllegalArgumentException | if x.length does not correspond to the dimension of this function. |
Implements MultivariateFunction.
double evaluateGradient | ( | int | i, |
double... | x | ||
) |
Computes \(\partial g(\mathbf{x})/\partial x_i\), the derivative of \(g(\mathbf{x})\) with respect to \(x_i\).
The length of the given array must correspond to the dimension of this function. The method must compute and return the result of the derivative without modifying the elements in x
since the array can be reused for further computations, e.g., the gradient \(\nabla g(\mathbf{x})\).
i | the variable to derive with respect to. |
x | a vector \(\mathbf{x}\). |
NullPointerException | if x is null . |
IllegalArgumentException | if x.length does not correspond to the dimension of this function. |
IndexOutOfBoundsException | if i is negative or greater than or equal to the dimension of this function. |
Implements MultivariateFunction.
int getDimension | ( | ) |
Returns \(d\), the dimension of the function computed by this implementation.
If the dimension is not fixed, this method must return a negative value.
Implements MultivariateFunction.
double getZeroOverZeroValue | ( | ) |
Returns the value returned by evaluate in the case where the \(0/0\) function is calculated.
The default value for \(0/0\) is Double.NaN
.
Generally, \(0/0\) is undefined, and therefore associated with the Double.NaN
constant, meaning not-a-number. However, in certain applications, it can be defined differently to accomodate some special cases. For exemple, in a queueing system, if there are no arrivals, no customers are served, lost, queued, etc. As a result, many performance measures of interest turn out to be \(0/0\). Specifically, the loss probability, i.e., the ratio of lost customers over the number of arrivals, should be 0 if there is no arrival; in this case, \(0/0\) means 0. On the other hand, the service level, i.e., the fraction of customers waiting less than a fixed threshold, could be fixed to 1 if there is no arrival.
void setZeroOverZeroValue | ( | double | zeroOverZero | ) |
Sets the value returned by evaluate for the undefined function \(0/0\) to zeroOverZero
.
See getZeroOverZeroValue for more information.
zeroOverZero | the new value for \(0/0\). |