FuzzyModule()

Class for representing a fuzzy module. Instances of this class are used by game entities for fuzzy inference. A fuzzy module is a collection of fuzzy variables and the rules that operate on them.

new FuzzyModule()

Constructs a new fuzzy module.

Author:

Members

readonly flvs :Map.<String, FuzzyVariable>

A map of FLVs.

readonly rules :Array.<FuzzyRule>

An array of the fuzzy rules.

Methods

addFLV(name, flv) → {FuzzyModule}

Adds the given FLV under the given name to this fuzzy module.

Parameters:
Name Type Description
name String

The name of the FLV.

flv FuzzyVariable

The FLV to add.

Returns:
FuzzyModule -

A reference to this fuzzy module.

addRule(rule) → {FuzzyModule}

Adds the given fuzzy rule to this fuzzy module.

Parameters:
Name Type Description
rule FuzzyRule

The fuzzy rule to add.

Returns:
FuzzyModule -

A reference to this fuzzy module.

defuzzify(name, type) → {Number}

Given a fuzzy variable and a defuzzification method this returns a crisp value.

Parameters:
Name Type Description
name String

The name of the FLV

type String

The type of defuzzification.

Returns:
Number -

The defuzzified, crips value.

fromJSON(json) → {FuzzyModule}

Restores this instance from the given JSON object.

Parameters:
Name Type Description
json Object

The JSON object.

Returns:
FuzzyModule -

A reference to this fuzzy module.

fuzzify(name, value) → {FuzzyModule}

Calls the fuzzify method of the defined FLV with the given value.

Parameters:
Name Type Description
name String

The name of the FLV

value Number

The crips value to fuzzify.

Returns:
FuzzyModule -

A reference to this fuzzy module.

removeFLV(name) → {FuzzyModule}

Remove the FLV under the given name from this fuzzy module.

Parameters:
Name Type Description
name String

The name of the FLV to remove.

Returns:
FuzzyModule -

A reference to this fuzzy module.

removeRule(rule) → {FuzzyModule}

Removes the given fuzzy rule from this fuzzy module.

Parameters:
Name Type Description
rule FuzzyRule

The fuzzy rule to remove.

Returns:
FuzzyModule -

A reference to this fuzzy module.

toJSON() → {Object}

Transforms this instance into a JSON object.

Returns:
Object -

The JSON object.