fuzzy_engine library

Explainable fuzzy inference for Dart and Flutter.

Classes

AlgebraicProduct
Algebraic product t-norm: a * b.
Bell
Generalized bell: 1 / (1 + abs((x-center)/width)^(2*slope)).
Bisector
Splits the area under the piecewise linear sampled curve into equal halves. If the half-area is reached before a zero plateau, selects its left edge.
BoundedDifference
Lukasiewicz t-norm: max(0, a + b - 1).
BoundedSum
Bounded sum s-norm: min(1, a + b).
Centroid
Centroid using composite trapezoidal quadrature on normalized coordinates. Resolution is selected with FuzzyEngine.intervals, not this strategy.
Condition
A composable antecedent evaluated with configurable fuzzy operators.
ConditionVisitor<T>
Typed inspection of condition trees without exposing private node classes.
ConstantConsequent
Zero-order Sugeno consequent: a constant crisp value.
Defuzzifier
Converts a sampled fuzzy set to a crisp value. Return null only for zero sampled area; otherwise return a finite value inside the sampled universe. Implementations should be deterministic.
DiagnosticIssue
Immutable explanatory finding; messages contain no raw callback exceptions.
DiscreteSet
Piecewise linear membership through ordered points; zero outside support.
FclExporter
Exports the restricted point-term MIN/MAX/COG FCL profile, without sampling arbitrary functions or discarding unsupported rule semantics.
FclImporter
Experimental bounded FCL import: REAL declarations, point terms, one output and one MIN/MAX/COG rule block. This is not full IEC 61131-7 conformance.
FclModel
Restricted FCL controller. DEFAULT is adapter behavior, never a core mutation.
FclRange
Explicit finite input universe; FCL FUZZIFY does not supply one in this profile.
FclResult
Adapted FCL decision retaining the original inference explanation.
FisEvaluation
FIS adapter result; the original explanation never hides a fallback.
FisExporter
Restricted text FIS exporter. Unsupported components fail without approximation. FIS does not store core rule names, integration resolution or fallback policy. Returned text transfers the inference configuration, not those runtime settings.
FisImporter
Experimental bounded importer for restricted Mamdani and Sugeno text FIS. No code is executed. Unsupported fields and methods cause FormatException. This is not a vendor-conformance or numerical-equivalence guarantee.
FisModel
Imported single-output Mamdani model and its explicit adapter policy.
FisSugenoEvaluation
Adapted Sugeno value with its unchanged core explanation.
FisSugenoModel
Sugeno adapter retaining the finite FIS output range and consequent catalog. The range supplies a midpoint fallback; it never clamps crisp consequents.
FuzzyDiagnosticReport
Immutable observations on a finite Cartesian grid, not a coverage proof.
FuzzyDiagnostics
Bounded grid inspection and conservative structural checks for supported engines.
FuzzyEngine
Configurable type-1 fuzzy inference with Mamdani defaults.
FuzzyHedge
Linguistic modifier applied to an antecedent degree. Custom modifiers must map valid degrees to finite degrees between zero and one.
FuzzyModelCodec
Strict JSON interchange: imports v1/v2, exports v2 by default. Unknown versions, keys and component types are rejected. No code is evaluated.
FuzzyModelDocument
Model plus optional descriptive labels. Units are metadata, not conversions.
FuzzyNegation
Decreasing complement with endpoints complement(0)=1, complement(1)=0.
FuzzyOperators
Operators shared by all antecedent expressions in one engine evaluation.
FuzzyResult
Immutable inference result. Null output means zero aggregated area.
FuzzyRule
A Mamdani rule with one consequent and optional weight.
FuzzyVariable
Finite universe of discourse.
Gaussian
Gaussian membership exp(-0.5 * ((x - mean) / sigma)^2).
LargestOfMaximum
Last grid coordinate whose degree is within tolerance of the global maximum.
LinearConsequent
First-order consequent: intercept + sum(coefficient[name] * input[name]).
Maximum
Maximum s-norm: max(a, b).
MeanOfMaximum
Arithmetic mean of all grid coordinates within tolerance of the maximum. For disconnected maxima this need not equal the midpoint of first and last.
MembershipFunction
Maps a finite crisp value to a degree between 0 and 1.
MembershipPoint
Immutable point for a piecewise linear membership function.
Minimum
Minimum t-norm: min(a, b).
MonotonicMembershipFunction
Monotonic transition with finite inverse values for every degree from 0 to 1. Domain endpoints delimit the transition; saturating tails may lie outside it.
PiShape
Smooth compact membership with S-shaped rise, plateau and Z-shaped fall.
ProbabilisticSum
Probabilistic sum s-norm: a + b - a * b. The name describes its algebra; fuzzy degrees are not probabilities.
Ramp
Saturating linear membership from zero at start to one at end. Descending ramps use start > end; tails keep their endpoint degrees.
Rectangle
Rectangular membership, one on the closed interval and zero outside it.
RuleActivation
Rule activation before and after applying its weight.
SampledFuzzySet
Uniformly sampled fuzzy output, including both universe endpoints. The degrees are copied and immutable; zero area is represented by all zeros.
Sigmoid
Stable logistic membership, 1 / (1 + exp(-slope * (x-midpoint))).
SmallestOfMaximum
First grid coordinate whose degree is within tolerance of the global maximum.
SNorm
Disjunction/aggregation operator on degrees between zero and one. Implementations must obey s-norm laws, including neutral element zero.
Somewhat
Linguistic dilation: somewhat A = sqrt(membership(A)).
SShape
Smooth quadratic transition from zero at a to one at b.
StandardNegation
Standard complement: 1 - value.
SugenoActivation
Explanation for one Sugeno rule, including inactive rules.
SugenoConsequent
Crisp consequent evaluated against the original crisp input values. Custom implementations must declare all input references, be deterministic, and return a finite result. Inputs supplied by the engine are immutable.
SugenoEngine
Takagi-Sugeno inference with crisp consequents and explainable reductions. Shares input membership functions, conditions, operators and hedges with Mamdani.
SugenoOutput
Named crisp output. Sugeno outputs do not have membership functions or bounds.
SugenoResult
Immutable Sugeno outputs, fuzzified inputs and rule explanations.
SugenoRule
One weighted antecedent and one crisp Sugeno consequent.
Term
References a linguistic term on an input variable.
TNorm
Conjunction/implication operator on degrees between zero and one. Implementations must obey t-norm laws, including neutral element one.
Trapezoid
Trapezoidal membership with an inclusive plateau.
Triangle
Triangular membership; repeated endpoints form left/right shoulders.
TsukamotoActivation
Immutable rule explanation, retaining weighted activation and inverse value.
TsukamotoEngine
Tsukamoto inference: invert each active consequent at its weighted strength, then combine inverse values with a normalized weighted average.
TsukamotoOutput
Bounded output with monotonic, finitely invertible linguistic terms.
TsukamotoResult
Immutable Tsukamoto decisions, input degrees and rule explanations.
TsukamotoRule
One fuzzy antecedent and one named invertible output term.
Very
Linguistic concentration: very A = membership(A)^2.
ZShape
Smooth quadratic transition from one at a to zero at b.

Enums

DiagnosticCode
Stable machine-readable diagnostic categories.
DiagnosticSeverity
Diagnostic severity; a finding is not an automatic model modification.
FisNoDecisionPolicy
Explicit adapter policy when the sampled output has no positive area.
SugenoAggregation
Distinct Sugeno reduction methods; neither samples a fuzzy output set.