public class RatioFunction extends java.lang.Object implements MultivariateFunction
| Constructor and Description |
|---|
RatioFunction()
Constructs a new ratio function.
|
RatioFunction(double zeroOverZero)
Constructs a new ratio function that returns
zeroOverZero for the special case of 0/0.
|
| Modifier and Type | Method and Description |
|---|---|
double |
evaluate(double... x)
Computes the function
g(x)
for the vector x.
|
double |
evaluateGradient(int i,
double... x)
Computes
∂g(x)/∂xi,
the derivative of
g(x)
with respect to xi.
|
int |
getDimension()
Returns d, the dimension of the function computed
by this implementation.
|
double |
getZeroOverZeroValue()
Returns the value returned by
evaluate in the
case where the 0/0 function is calculated. |
void |
setZeroOverZeroValue(double zeroOverZero)
Sets the value returned by
evaluate for
the undefined function 0/0 to zeroOverZero. |
public RatioFunction()
public RatioFunction(double zeroOverZero)
getZeroOverZeroValue method for more information.
The default value of zeroOverZero is Double.NaN.zeroOverZero - the value for 0/0.public double getZeroOverZeroValue()
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.
public void setZeroOverZeroValue(double zeroOverZero)
evaluate for
the undefined function 0/0 to zeroOverZero.
See getZeroOverZeroValue for more information.zeroOverZero - the new value for 0/0.public int getDimension()
MultivariateFunctiongetDimension in interface MultivariateFunctionpublic double evaluate(double... x)
MultivariateFunctionevaluate in interface MultivariateFunctionx - a vector
x.public double evaluateGradient(int i,
double... x)
MultivariateFunctionevaluateGradient in interface MultivariateFunctioni - the variable to derive with respect to.x - a vector
x.To submit a bug or ask questions, send an e-mail to Pierre L'Ecuyer.