es6-fuzz - v7.0.1
    Preparing search index...

    Class Logic

    Class helping with FuzzyLogic.

    Index

    Constructors

    Properties

    c

    Methods

    Constructors

    Properties

    c: {
        Shape: typeof Shape;
        Grade: typeof Grade;
        ReverseGrade: typeof ReverseGrade;
        Trapezoid: typeof Trapezoid;
        Triangle: typeof Triangle;
        Constant: typeof Constant;
        FuzzyFunction: typeof FuzzyFunction;
        Sigmoid: typeof Sigmoid;
    }

    Redundant with the package's named exports. Import the shape classes directly instead, e.g. import { Triangle } from 'es6-fuzz'. Kept for backwards compatibility and slated for removal in the next major.

    Methods

    • Registers the first rule. Must be called before and, or, not or defuzzify.

      Rule composition is sequential and order-dependent: at defuzzify time each rule's membership is folded into a single value that is carried to the next rule (see and). init and or start a fresh value from the rule's own shape; and narrows it; not inverts it.

      Parameters

      • output: string

        Output label, letters only (/^[a-z]+$/i), must be unique.

      • shape: Fuzzifier

        Fuzzifier mapping a crisp input to a membership degree 0..1.

      Returns this

    • Narrows the carried membership with min(previous, shape(value)) (the standard fuzzy-AND / T-norm). Because previous is whatever the immediately preceding rule produced, and is order-dependent — it composes against the prior rule in the chain, not a grouped rule set.

      Parameters

      • output: string

        Output label, letters only, must be unique.

      • shape: Fuzzifier

        Fuzzifier mapping a crisp input to a membership degree 0..1.

      Returns this

    • Starts a fresh membership from this rule's own shape value, ignoring the value carried from previous rules (fuzzy-OR / max is applied implicitly by defuzzify picking the single highest membership across all rules).

      Parameters

      • output: string

        Output label, letters only, must be unique.

      • shape: Fuzzifier

        Fuzzifier mapping a crisp input to a membership degree 0..1.

      Returns this

    • Inverts this rule's shape value: 1 - shape(value) (fuzzy-NOT / complement). Like or, it does not depend on the carried value.

      Parameters

      • output: string

        Output label, letters only, must be unique.

      • shape: Fuzzifier

        Fuzzifier mapping a crisp input to a membership degree 0..1.

      Returns this

    • Evaluates every rule for value and returns the result.

      Note on terminology: this performs max-membership classification, not centroid / center-of-gravity defuzzification. It returns the label of the rule with the highest membership (defuzzified) together with that membership degree (fuzzified) — it does not compute a crisp output number. On ties the earliest rule wins (strict greater-than).

      Parameters

      • value: number

        Crisp input fed to every rule's shape.

      • Optionalas: string

        Optional namespace prefix for DefuzzifyResult.boonJsInputs keys, e.g. 'heat' yields heat.cold. Useful when merging the inputs of several Logic instances for boon-js evaluation.

      Returns DefuzzifyResult

      logic.defuzzify(10)