Module Tofn

module Tofn: sig .. end

Typed ordered fuzzy numbers (OFNs) and associated operations, following "Rings of Typed Ordered Fuzzy Numbers."


exception OFN_type_mismatch

Incompatible OFN type families.

exception Improper_OFN

An OFN is improper when it has no membership function.

type family = 
| Trapezoidal
| Gaussian
| Exponential

Supported families are trapezoidal, Gaussian, and exponential.

type tofn = {
   ofn_type : family;
   au : float;
   bu : float;
   ad : float;
   bd : float;
}

OFN with type family and essential tuple (au, bu, ad, bd). Components of the tuple are represented as individual fields (as opposed to an element of float * float * float * float) for ease-of-access.

val sametype : tofn -> tofn -> bool

Determine if two given OFNs are of the same type.

val tuplemap : (float -> float -> float) -> tofn -> tofn -> tofn

Apply a binary operator to the essential tuples of two OFNs.

val tuplemap_safe : (float -> float -> float) -> tofn -> tofn -> tofn

Apply a binary operator to the essential tuples of two OFNs only when the types match. Raises OFN_type_mistmatch if arguments are not of the same type.

val inv : family -> float -> float

Inverses of base functions

val (|+|) : tofn -> tofn -> tofn

OFN addition.

val (|-|) : tofn -> tofn -> tofn

OFN subtraction.

val (|*|) : tofn -> tofn -> tofn

OFN multiplication.

val (|/|) : tofn -> tofn -> tofn

OFN division

val is_increasing : tofn -> bool

Determine if an OFN is increasing.

val is_decreasing : tofn -> bool

Determine if an OFN is decreasing.

val is_proper : tofn -> bool

Check if an OFN is proper.

val membership : tofn -> float -> float

The membership function associated to an OFN. Raises Improper_OFN if the OFN is improper.

val conv_ofn : tofn -> family -> tofn

Convert an OFN of one type to another type.