human-logic
Version:
48 lines (47 loc) • 1.43 kB
TypeScript
/**
* Fuzzy Logic (based on Zadeh operators)
*
* Fuzzy logical value is a number between `0.0` (0% probability) and `1.0` (100% probability).
* @module
*/
/**
* Base Fuzzy Logic type.
*
* Value must be between `0.0` (0% probability) and `1.0` (100% probability) inclusive.
*/
export type Fuzzy = number;
/**
* Fuzzy logical value of `false` (zero probability)
*/
export declare const FUZZY_FALSE: Fuzzy;
/**
* Fuzzy logical value of `true` (100% probability)
*/
export declare const FUZZY_TRUE: Fuzzy;
/**
* Ensures the fuzzy value is between `0.0` and `1.0`.
*
* @return If `value` is less than `0.0`, returns `0.0`.
* If `value` is greater then `1.0`, returns `1.0`. Otherwise returns `value`.
*
*/
export declare function normalize(value: Fuzzy): Fuzzy;
/**
* Fuzzy Logical NOT
* @return Result of subtraction of provided value from `1.0`.
*/
export declare function not(value: Fuzzy): Fuzzy;
/**
* Fuzzy Logical AND
*
* @param values Accepts an unlimited number of arguments
* @return Result of Fuzzy Logical AND (the minimum of all provided values, defaults to `FUZZY_TRUE`)
*/
export declare function and(...values: Fuzzy[]): Fuzzy;
/**
* Fuzzy Logical OR
*
* @param values Accepts an unlimited number of arguments
* @return Result of Fuzzy Logical OR (the maximum of all provided values, defaults to `FUZZY_FALSE`)
*/
export declare function or(...values: Fuzzy[]): Fuzzy;