Skip to main content

FuzzyInferenceSystem

Struct FuzzyInferenceSystem 

Source
pub struct FuzzyInferenceSystem {
    pub fis_type: FISType,
    pub n_inputs: usize,
    pub output_size: usize,
    pub output_domain: Vec<f64>,
    pub defuzz_method: DefuzzMethod,
    pub mamdani_rules: Vec<MamdaniRule>,
    pub sugeno_rules: Vec<SugenoRule>,
}
Expand description

A unified fuzzy inference system supporting both Mamdani and Sugeno styles.

Fields§

§fis_type: FISType

System type.

§n_inputs: usize

Number of input variables.

§output_size: usize

Universe size for output (used in Mamdani).

§output_domain: Vec<f64>

Domain for Mamdani defuzzification.

§defuzz_method: DefuzzMethod

Defuzzification method (for Mamdani).

§mamdani_rules: Vec<MamdaniRule>

Mamdani rules (populated if Mamdani).

§sugeno_rules: Vec<SugenoRule>

Sugeno rules (populated if Sugeno).

Implementations§

Source§

impl FuzzyInferenceSystem

Source

pub fn mamdani(output_size: usize, output_domain: Vec<f64>) -> Self

Create a Mamdani FIS.

Source

pub fn sugeno(n_inputs: usize) -> Self

Create a Sugeno FIS.

Source

pub fn with_defuzz(self, method: DefuzzMethod) -> Self

Set the defuzzification method (Mamdani only).

Source

pub fn add_mamdani_rule( &mut self, antecedent_mf: Vec<f64>, consequent: FuzzySet, )

Add a Mamdani rule.

Source

pub fn add_sugeno_rule( &mut self, antecedent_mf: Vec<f64>, output_coeffs: Vec<f64>, output_const: f64, )

Add a Sugeno rule.

Source

pub fn infer_mamdani(&self, input_degrees: &[Vec<f64>]) -> f64

Run Mamdani inference and defuzzify.

input_degrees[i] contains the firing degrees for input variable i.

Source

pub fn infer_sugeno(&self, inputs: &[f64], input_degrees: &[Vec<f64>]) -> f64

Run Sugeno inference and return crisp output.

Source

pub fn is_configured(&self) -> bool

Returns true if the FIS has at least one rule.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.