Inference Systems

Mamdani inference system

FuzzyLogic.MamdaniFuzzySystemType
struct MamdaniFuzzySystem{And<:FuzzyLogic.AbstractAnd, Or<:FuzzyLogic.AbstractOr, Impl<:FuzzyLogic.AbstractImplication, Aggr<:FuzzyLogic.AbstractAggregator, Defuzz<:FuzzyLogic.AbstractDefuzzifier, R<:FuzzyLogic.AbstractRule} <: FuzzyLogic.AbstractFuzzySystem

Data structure representing a type-1 Mamdani fuzzy inference system. It can be created using the @mamfis macro. It can be called as a function to evaluate the system at a given input. The inputs should be given as keyword arguments.

  • name::Symbol: name of the system.

  • inputs::Dictionaries.Dictionary{Symbol, FuzzyLogic.Variable}: input variables and corresponding domain.

  • outputs::Dictionaries.Dictionary{Symbol, FuzzyLogic.Variable}: output variables and corresponding domain.

  • rules::Vector{R} where R<:FuzzyLogic.AbstractRule: inference rules.

  • and::FuzzyLogic.AbstractAnd: method used to compute conjuction in rules, default MinAnd.

  • or::FuzzyLogic.AbstractOr: method used to compute disjunction in rules, default MaxOr.

  • implication::FuzzyLogic.AbstractImplication: method used to compute implication in rules, default MinImplication

  • aggregator::FuzzyLogic.AbstractAggregator: method used to aggregate fuzzy outputs, default MaxAggregator.

  • defuzzifier::FuzzyLogic.AbstractDefuzzifier: method used to defuzzify the result, default CentroidDefuzzifier.

Extended help

Example

fis = @mamfis function tipper(service, food)::tip
    service := begin
      domain = 0:10
      poor = GaussianMF(0.0, 1.5)
      good = GaussianMF(5.0, 1.5)
      excellent = GaussianMF(10.0, 1.5)
    end

    food := begin
      domain = 0:10
      rancid = TrapezoidalMF(-2, 0, 1, 3)
      delicious = TrapezoidalMF(7, 9, 10, 12)
    end

    tip := begin
      domain = 0:30
      cheap = TriangularMF(0, 5, 10)
      average = TriangularMF(10, 15, 20)
      generous = TriangularMF(20, 25, 30)
    end

    service == poor || food == rancid --> tip == cheap
    service == good --> tip == average
    service == excellent || food == delicious --> tip == generous
end

fis(service=1, food=2)

# output

1-element Dictionaries.Dictionary{Symbol, Float64}
 :tip │ 5.558585929783786
source

Sugeno inference system

FuzzyLogic.SugenoFuzzySystemType
struct SugenoFuzzySystem{And<:FuzzyLogic.AbstractAnd, Or<:FuzzyLogic.AbstractOr, R<:FuzzyLogic.AbstractRule} <: FuzzyLogic.AbstractFuzzySystem

Data structure representing a type-1 Sugeno fuzzy inference system. It can be created using the @sugfis macro. It can be called as a function to evaluate the system at a given input. The inputs should be given as keyword arguments.

  • name::Symbol: name of the system.

  • inputs::Dictionaries.Dictionary{Symbol, FuzzyLogic.Variable}: input variables and corresponding domain.

  • outputs::Dictionaries.Dictionary{Symbol, FuzzyLogic.Variable}: output variables and corresponding domain.

  • rules::Vector{R} where R<:FuzzyLogic.AbstractRule: inference rules.

  • and::FuzzyLogic.AbstractAnd: method used to compute conjuction in rules, default MinAnd.

  • or::FuzzyLogic.AbstractOr: method used to compute disjunction in rules, default MaxOr.

source
FuzzyLogic.ConstantSugenoOutputType
struct ConstantSugenoOutput{T<:Real} <: FuzzyLogic.AbstractSugenoOutputFunction

Represents constant output in Sugeno inference systems.

  • c::Real: value of the constant output.
source
FuzzyLogic.LinearSugenoOutputType
struct LinearSugenoOutput{T} <: FuzzyLogic.AbstractSugenoOutputFunction

Represents an output variable that has a first-order polynomial relation on the inputs. Used for Sugeno inference systems.

  • coeffs::Dictionaries.Dictionary{Symbol}: coefficients associated with each input variable.

  • offset::Any: offset of the output.

source

General functions

FuzzyLogic.setFunction
set(fis::FuzzyLogic.AbstractFuzzySystem; kwargs...) -> Any

Create a copy of the given fuzzy systems, but with the new settings as specified in the keyword arguments.

Inputs

  • fis::AbstractFuzzySystem – input fuzzy system

Keyword arguments

  • kwargs... – new settings of the inference system to be tuned
source