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\). | |
| 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. | |
| int | getDimension () |
| Returns \(d\), the dimension of the function computed by this implementation. | |
| double | evaluate (double... x) |
| Computes the function \(g(\mathbf{x})\) for the vector x. | |
| 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\). | |
Represents a function computing a ratio of two values.
Definition at line 32 of file RatioFunction.java.
| umontreal.ssj.util.RatioFunction.RatioFunction | ( | ) |
Constructs a new ratio function.
Definition at line 38 of file RatioFunction.java.
| umontreal.ssj.util.RatioFunction.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\). |
Definition at line 48 of file RatioFunction.java.
| double umontreal.ssj.util.RatioFunction.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 umontreal.ssj.util.MultivariateFunction.
Definition at line 89 of file RatioFunction.java.
| double umontreal.ssj.util.RatioFunction.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 umontreal.ssj.util.MultivariateFunction.
Definition at line 97 of file RatioFunction.java.
| int umontreal.ssj.util.RatioFunction.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 umontreal.ssj.util.MultivariateFunction.
Definition at line 85 of file RatioFunction.java.
| double umontreal.ssj.util.RatioFunction.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, @f$0/0@f$ 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 @f$0/0@f$. 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, @f$0/0@f$ 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.
Definition at line 71 of file RatioFunction.java.
| void umontreal.ssj.util.RatioFunction.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\). |
Definition at line 81 of file RatioFunction.java.