Computes the membership function evaluated at \(x\) by using binary search to find the lower and upper bounds of \(x\) and then linearly interpolating the membership function between the bounds. More...
The Discrete class is a basic Term that represents a discrete membership function.
The pairs of values in any Discrete term must be sorted ascendently because the membership function is computed using binary search to find the lower and upper bounds of \(x\).
Creates a Discrete term from a variadic set of values.
Beware: this method is unsafe and must be used with care by ensuring:
the value argc correctly and exactly determines the number of values passed,
the data type of each variadic arguments is the same, e.g., \((1.0, 2.0, 3.0)\) are all fl::scalar, whereas in \((1.0, 2, 3.0)\) the second term is an integer, which will cause memory access issues due to the difference in size between int and fl::scalar.
Parameters
name
is the name of the resulting term
argc
is the number of values passed
x1
is the \(x\) value of the first Pair
y1
is the \(y\) value of the first Pair
...
are the remaining pairs of values \(x_i\) and \(y_i\)
Computes the membership function evaluated at \(x\) by using binary search to find the lower and upper bounds of \(x\) and then linearly interpolating the membership function between the bounds.
where \(h\) is the height of the Term, \(x_{\min}\) and \(x_{\max}\)is are the lower and upper limits of \(x\) in xy (respectively), \(y_{\min}\) and \(y_{\max}\)is are the membership functions of \(\mu(x_{\min})\) and \(\mu(x_{\max})\) (respectively)