FuzzyValue()

FuzzyValue is a value to be used with Fuzzy Logic. It's inclusion in a set can be tested with FuzzyValue.IS or FuzzyValue.IS_NOT,
Use FuzzyValue.SET or FuzzyLogic.THEN to change this value using a FuzzySet

new FuzzyValue()

Do not use the constructor of this class, use FuzzyLogic.newSet to create a new set.
Properties:
Name Type Description
unit string The unit to display when returning this value as a string.
reportEnabled bool Enables or disable report generation when crispifying. Disabled by default to improve performance.
report Array.<Array.<string>> The report (explanation) of the latest crispification FuzzyValue.crispify.
It is an Array containing Arrays of strings. Each sub-array is the report of one rule, which you can print with .join(newLine) for example.
Example
var logic = new FuzzyLogic();
var comfortable = logic.newSet("Warm", 17, 20);
var temperature = logic.newValue( 18 );
// Test if this temperature is comfortable
logic.IF(
   temperature.IS_NOT(comfortable);
)
// Set it very comfortable
logic.THEN ( temperature.SET(comfortable, "Very"); )

Methods

crispify(clearSetsopt, algorithmopt) → {Number}

Computes a crisp value depending on the inclusions which have been set before using FuzzyValue.SET.
Parameters:
Name Type Attributes Default Description
clearSets bool <optional>
true When crispifying, the sets added with FuzzyValue.SET are cleared, this means changes made before the call to crispify() will be lost in subsequent calls. Set this parameter to false to keep these previous changes.
algorithm FuzzyCrispAlgorithm <optional>
Change the algorithm to use for crispification.
Returns:
Number - The crisp (i.e. standard) value.

defuzzify()

This is an alias for FuzzyValue.prototype.crispify;

IS(set, quantifier) → {FuzzyVeracity}

Tests the inclusion of the value in the set
Parameters:
Name Type Description
set FuzzySet The set which may include the value.
quantifier FuzzyQuantifier | string A quantifier.
Returns:
FuzzyVeracity - The veracity of the inclusion of the value in the set.

IS_NOT(set, quantifier) → {FuzzyVeracity}

Tests the exclusion of the value in the set
Parameters:
Name Type Description
set FuzzySet The set which may (not) include the value.
quantifier FuzzyQuantifier | string A quantifier.
Returns:
FuzzyVeracity - The veracity of the exclusion of the value in the set.

quantify(set) → {FuzzyQuantifier}

Returns the closest quantifier for this value in this set
Parameters:
Name Type Description
set FuzzySet The set
Returns:
FuzzyQuantifier - The quantifier

SET(set, quantifieropt, vopt)

Changes the value according to a new veracity.
Parameters:
Name Type Attributes Default Description
set FuzzySet The set.
quantifier FuzzyModifier <optional>
FuzzyModifier.NONE The quantifier
v FuzzyVeracity <optional>
The veracity.

toFloat()

This is an alias for FuzzyValue.prototype.crispify;

toNumber()

This is an alias for FuzzyValue.prototype.crispify;

toString(crispAlgorithmopt, setopt) → {string}

Returns a string representation of the value with its unit (if any)
Parameters:
Name Type Attributes Description
crispAlgorithm FuzzyCrispAlgorithm <optional>
The algorithm to use for crispification before returning the string. Uses the algorithm set when creating the FuzzyLogic instance by default.
set FuzzySet <optional>
A set to quantify the value
Returns:
string - The description of the value