ModalType

ModalType

new ModalType(parameters)

Description:
  • Specifies a level of truth, tau, between -1 (false), 0 (unknown) and 1 (true).

    Extends: Type. This class extends Type, with all public methods available.

    Type parameters

    General parameter

    • name: ... The type name. By default the type name is "modal".

    Parameters for the semantic projection

    • trinary: ... If true only the false (-1), unknown (0), and true (1) values are considered, without intermediate value.
    • binary: ... If true only the false (-1) and true (1) values are considered, without intermediate value.

    Parameters for the distance evaluation

    • step: ... The normalization of the distance |lhs-rhs|/step where step is the neighborhood size.
      • By default 2.

    Parameters for the geodesic calculation

    • atomic: ...
      • If true returns only an atomic path with the two left-hand and right-hand elements. Default is true.
      • If false returns a path with all intermediate values, step by step, or precision value by precision value if step is undefined.

    ModalType specification

    Syntactic projection - Returns NAN if not a parsable number.
    - Returns the zero if an empty value.
    - The value "true" (numerically 1), "false" (numerically -1) and "unknown" or '?' (numerically 0) are understood.
    Semantic projection - If the value is higher than 1 it is set to true.
    - If the value is lower than -1 it is set to false.
    - If precision is defined the value is projected to the closest min + k precision value, k being an integer.
    - If in trinary mode, values are projected onto the closest {-1, 0, 1} value.
         v <- v < -0.5 ? -1 : v > 0.5 ? 1 : 0
    - If in binary mode, values are projected onto the closest {-1, 1} value.
         v <- v <= 0 ? -1 : 1
    Distance value The distance is calculated as a weighted value |lhs-rhs|/step.
    - It is INFINITY if not both object are numeric.
    Geodesic path The geodesic is assumed to be atomic, i.e. of length 1 if value are equal and 2 if different.
    Comparison - Returns either lhs-rhs or
    0 if the precision is defined and |lhs-rhs| < precision.
    Bounds - `[-1, 1]` are the bounds.

    Note:

Parameters:
Name Type Description
parameters JSON | String

The type parameters.

Methods

getPi(tau)

Description:
  • Returns the possibility value of a modal value.

Parameters:
Name Type Description
tau double

The modal value.

Returns:

The corresponding possibility value, i.e., min(1, value + 1)

getNu(tau)

Description:
  • Returns the necessity value of a modal value.

Parameters:
Name Type Description
tau double

The modal value.

Returns:

The corresponding necessity value, i.e., max(0, value).

getTau(pi, nu)

Description:
  • Returns the value tau corresponding to a given possibility and necessity.

Parameters:
Name Type Description
pi double

The possibility value.

nu double

The necessity value.

Returns:

The corresponding closest modal value, i.e., tau = nu + pi - 1 bounded in [-1, 1].

getRho(pi, nu)

Description:
  • Returns the randomness corresponding to a given possibility and necessity.

Parameters:
Name Type Description
pi double

The possibility value.

nu double

The necessity value.

Returns:

The corresponding closest randomness value, i.e., rho = nu - pi + 1 bounded in [0, 1].

getOp(op, tau_1, tau_2)

Description:
  • Returns the value tau corresponding to a generalized Boolean operation.

Parameters:
Name Type Description
op char

The binary operation:

  • a : logical and, i.e., conjunction.
  • o : logical or, i.e., disjunction.
  • x : logical xor, i.e., exclusive disjunction.
  • m : logical minus, i.e., element set difference.
tau_1 double

The possibility value.

tau_2 double

The possibility value.

Returns:

The corresponding tau value.