Documentation
Tools for embedded systems
Loading...
Searching...
No Matches
qlibs::fis::system< fType, numberOfInputs, numberOfOutputs, numberOfInputSets, numberOfOutputSets, numberOfRules > Class Template Reference

A wrapper for the FIS object. More...

#include <fis.hpp>

Public Member Functions

constexpr system (const rules *r)
 
bool setup (void)
 Setup and initialize the FIS instance.
 
bool setupInput (const tag t, const real_t Min, const real_t Max) noexcept
 Setup the input with the specified tag and set limits for it.
 
bool setupOutput (const tag t, const real_t Min, const real_t Max) noexcept
 Setup the output with the specified tag and set limits for it.
 
bool setupInputMF (const tag io, const tag mf, const shapeMF s, const real_t *cp, const real_t h=1.0_re) noexcept
 Setup the input tag and points for the specified membership function.
 
bool setupInputMF (const tag io, const tag mf, mfFunction customMfs, const real_t *cp, const real_t h=1.0_re) noexcept
 Setup the input tag and points for the specified membership function.
 
bool setupOutputMF (const tag io, const tag mf, const shapeMF s, const real_t *cp, const real_t h=1.0_re) noexcept
 Set the output tag and points for the specified membership function.
 
bool setupOutputMF (const tag io, const tag mf, mfFunction customMfs, const real_t *cp, const real_t h=1.0_re) noexcept
 Set the output tag and points for the specified membership function.
 
bool fuzzify (void) noexcept
 Perform the fuzzification operation over the crisp inputs on the requested FIS object.
 
bool deFuzzify (void) noexcept
 Perform the de-Fuzzification operation to compute the crisp outputs.
 
bool inference (void) noexcept
 Perform the inference process on the FIS object.
 
bool setInput (const tag t, const real_t value) noexcept
 Set a crisp value of the input with the specified tag.
 
bool getOutput (const tag t, real_t &value) const noexcept
 Get the de-fuzzified crisp value from the output with the specified tag.
 
bool setParameter (const parameter p, const paramValue x) noexcept
 Set parameters of the FIS instance.
 
bool setDeFuzzMethod (deFuzzMethod m) noexcept
 Change the default de-Fuzzification method of the FIS instance.
 
bool setRuleWeights (real_t *rWeights) noexcept
 Set weights to the rules of the inference system.
 
size_t getNumberOfPoints (void) const noexcept
 Get the number of points used on Mamdani to perform the de-fuzzification proccess.
 
real_t operator[] (tag outTag) const
 Get the de-fuzzified crisp value from the output with the specified tag.
 
systemoperator<< (const tag &t)
 Select the input to set using with the specified tag.
 
systemoperator<< (const int &value)
 The value to set the previously selected input.
 
systemoperator<< (const real_t &value)
 The value to set the previously selected input.
 

Detailed Description

template<type fType, size_t numberOfInputs, size_t numberOfOutputs, size_t numberOfInputSets, size_t numberOfOutputSets, size_t numberOfRules>
class qlibs::fis::system< fType, numberOfInputs, numberOfOutputs, numberOfInputSets, numberOfOutputSets, numberOfRules >

A wrapper for the FIS object.

The instance should be initialized using the fisSystem::setup() method.

Template Parameters
fTypeType of inference Mamdani, Sugeno or Tsukamoto.
numberOfInputsThe number of inputs of the FIS system.
numberOfOutputsThe number of outputs of the FIS system.
numberOfInputSetsThe number of sets/membership functions for the inputs.
numberOfOutputSetsThe number of sets/membership functions for the outputs.
numberOfRulesNumber of rules

Constructor & Destructor Documentation

◆ system()

template<type fType, size_t numberOfInputs, size_t numberOfOutputs, size_t numberOfInputSets, size_t numberOfOutputSets, size_t numberOfRules>
qlibs::fis::system< fType, numberOfInputs, numberOfOutputs, numberOfInputSets, numberOfOutputSets, numberOfRules >::system ( const rules * r)
inlineconstexpr

Member Function Documentation

◆ deFuzzify()

template<type fType, size_t numberOfInputs, size_t numberOfOutputs, size_t numberOfInputSets, size_t numberOfOutputSets, size_t numberOfRules>
bool qlibs::fis::system< fType, numberOfInputs, numberOfOutputs, numberOfInputSets, numberOfOutputSets, numberOfRules >::deFuzzify ( void )
inlinenoexcept

Perform the de-Fuzzification operation to compute the crisp outputs.

Precondition
The instance should have already invoked the inference process successfully with system::inference()
Note
By default, this method, uses the Centroid method on Mamdani type FIS and weight-average on Sugeno type FIS. To change the default settings use the system::setDeFuzzMethod() function.
Returns
true on success, otherwise return false.

◆ fuzzify()

template<type fType, size_t numberOfInputs, size_t numberOfOutputs, size_t numberOfInputSets, size_t numberOfOutputSets, size_t numberOfRules>
bool qlibs::fis::system< fType, numberOfInputs, numberOfOutputs, numberOfInputSets, numberOfOutputSets, numberOfRules >::fuzzify ( void )
inlinenoexcept

Perform the fuzzification operation over the crisp inputs on the requested FIS object.

Precondition
I/Os and fuzzy sets must be previously initialized by system::setupInput(), system::setupOutput(), system::setupInputMF(), system::setupOutputMF and system::setup() respectively.
Returns
true on success, otherwise return false.

◆ getNumberOfPoints()

template<type fType, size_t numberOfInputs, size_t numberOfOutputs, size_t numberOfInputSets, size_t numberOfOutputSets, size_t numberOfRules>
size_t qlibs::fis::system< fType, numberOfInputs, numberOfOutputs, numberOfInputSets, numberOfOutputSets, numberOfRules >::getNumberOfPoints ( void ) const
inlinenoexcept

Get the number of points used on Mamdani to perform the de-fuzzification proccess.

Returns
The number for points for de-fuzzification.

◆ getOutput()

template<type fType, size_t numberOfInputs, size_t numberOfOutputs, size_t numberOfInputSets, size_t numberOfOutputSets, size_t numberOfRules>
bool qlibs::fis::system< fType, numberOfInputs, numberOfOutputs, numberOfInputSets, numberOfOutputSets, numberOfRules >::getOutput ( const tag t,
real_t & value ) const
inlinenoexcept

Get the de-fuzzified crisp value from the output with the specified tag.

Parameters
[in]tThe output tag
[out]valueThe variable where the output will be stored.
Returns
The requested de-fuzzified crisp value.

◆ inference()

template<type fType, size_t numberOfInputs, size_t numberOfOutputs, size_t numberOfInputSets, size_t numberOfOutputSets, size_t numberOfRules>
bool qlibs::fis::system< fType, numberOfInputs, numberOfOutputs, numberOfInputSets, numberOfOutputSets, numberOfRules >::inference ( void )
inlinenoexcept

Perform the inference process on the FIS object.

Precondition
The instance should have already invoked the fuzzification operation successfully with system::fuzzify()
Returns
true on success, otherwise return false.

◆ operator<<() [1/3]

template<type fType, size_t numberOfInputs, size_t numberOfOutputs, size_t numberOfInputSets, size_t numberOfOutputSets, size_t numberOfRules>
system & qlibs::fis::system< fType, numberOfInputs, numberOfOutputs, numberOfInputSets, numberOfOutputSets, numberOfRules >::operator<< ( const int & value)
inline

The value to set the previously selected input.

Parameters
[in]valueThe crisp value to set
Returns
The fis::system object you invoked << upon.

◆ operator<<() [2/3]

template<type fType, size_t numberOfInputs, size_t numberOfOutputs, size_t numberOfInputSets, size_t numberOfOutputSets, size_t numberOfRules>
system & qlibs::fis::system< fType, numberOfInputs, numberOfOutputs, numberOfInputSets, numberOfOutputSets, numberOfRules >::operator<< ( const real_t & value)
inline

The value to set the previously selected input.

Parameters
[in]valueThe crisp value to set
Returns
The fis::system object you invoked << upon.

◆ operator<<() [3/3]

template<type fType, size_t numberOfInputs, size_t numberOfOutputs, size_t numberOfInputSets, size_t numberOfOutputSets, size_t numberOfRules>
system & qlibs::fis::system< fType, numberOfInputs, numberOfOutputs, numberOfInputSets, numberOfOutputSets, numberOfRules >::operator<< ( const tag & t)
inline

Select the input to set using with the specified tag.

Parameters
[in]tThe input tag
Returns
The fis::system object you invoked << upon.

◆ operator[]()

template<type fType, size_t numberOfInputs, size_t numberOfOutputs, size_t numberOfInputSets, size_t numberOfOutputSets, size_t numberOfRules>
real_t qlibs::fis::system< fType, numberOfInputs, numberOfOutputs, numberOfInputSets, numberOfOutputSets, numberOfRules >::operator[] ( tag outTag) const
inline

Get the de-fuzzified crisp value from the output with the specified tag.

Parameters
[in]outTagThe output tag
Returns
The requested de-fuzzified crisp value.

◆ setDeFuzzMethod()

template<type fType, size_t numberOfInputs, size_t numberOfOutputs, size_t numberOfInputSets, size_t numberOfOutputSets, size_t numberOfRules>
bool qlibs::fis::system< fType, numberOfInputs, numberOfOutputs, numberOfInputSets, numberOfOutputSets, numberOfRules >::setDeFuzzMethod ( deFuzzMethod m)
inlinenoexcept

Change the default de-Fuzzification method of the FIS instance.

Parameters
[in]mThe de-fuzzification method: use one of the following : centroid, bisector, mom, lom, som, wtaver, wtsum
Note
centroid, bisector, mom, lom and som only apply for a Mamdani FIS
wtaver and wtsum only apply for a Sugeno FIS.
wtaver only apply for a Tsukamoto FIS
Returns
true on success, otherwise return false

◆ setInput()

template<type fType, size_t numberOfInputs, size_t numberOfOutputs, size_t numberOfInputSets, size_t numberOfOutputSets, size_t numberOfRules>
bool qlibs::fis::system< fType, numberOfInputs, numberOfOutputs, numberOfInputSets, numberOfOutputSets, numberOfRules >::setInput ( const tag t,
const real_t value )
inlinenoexcept

Set a crisp value of the input with the specified tag.

Parameters
[in]tThe input tag
[in]valueThe crisp value to set
Returns
true on success, otherwise return false.

◆ setParameter()

template<type fType, size_t numberOfInputs, size_t numberOfOutputs, size_t numberOfInputSets, size_t numberOfOutputSets, size_t numberOfRules>
bool qlibs::fis::system< fType, numberOfInputs, numberOfOutputs, numberOfInputSets, numberOfOutputSets, numberOfRules >::setParameter ( const parameter p,
const paramValue x )
inlinenoexcept

Set parameters of the FIS instance.

Parameters
[in]pThe requested parameter to change/set.
[in]xThe value of the parameter to set.
Returns
true on success, otherwise return false.

◆ setRuleWeights()

template<type fType, size_t numberOfInputs, size_t numberOfOutputs, size_t numberOfInputSets, size_t numberOfOutputSets, size_t numberOfRules>
bool qlibs::fis::system< fType, numberOfInputs, numberOfOutputs, numberOfInputSets, numberOfOutputSets, numberOfRules >::setRuleWeights ( real_t * rWeights)
inlinenoexcept

Set weights to the rules of the inference system.

Precondition
I/Os and fuzzy sets must be previously initialized by system::setupInput(), system::setupOutput(), system::setInputMF(), system::setOutputMF and system::setup() respectively.
Parameters
[in]rWeightsAn array with the values of every rule weight;
Returns
true on success, otherwise return false.

◆ setup()

template<type fType, size_t numberOfInputs, size_t numberOfOutputs, size_t numberOfInputSets, size_t numberOfOutputSets, size_t numberOfRules>
bool qlibs::fis::system< fType, numberOfInputs, numberOfOutputs, numberOfInputSets, numberOfOutputSets, numberOfRules >::setup ( void )
inline

Setup and initialize the FIS instance.

Returns
true on success, otherwise return false.

◆ setupInput()

template<type fType, size_t numberOfInputs, size_t numberOfOutputs, size_t numberOfInputSets, size_t numberOfOutputSets, size_t numberOfRules>
bool qlibs::fis::system< fType, numberOfInputs, numberOfOutputs, numberOfInputSets, numberOfOutputSets, numberOfRules >::setupInput ( const tag t,
const real_t Min,
const real_t Max )
inlinenoexcept

Setup the input with the specified tag and set limits for it.

Parameters
[in]tThe input tag
[in]MinMinimum allowed value for this input
[in]MaxMax allowed value for this input
Returns
true on success, otherwise return false.

◆ setupInputMF() [1/2]

template<type fType, size_t numberOfInputs, size_t numberOfOutputs, size_t numberOfInputSets, size_t numberOfOutputSets, size_t numberOfRules>
bool qlibs::fis::system< fType, numberOfInputs, numberOfOutputs, numberOfInputSets, numberOfOutputSets, numberOfRules >::setupInputMF ( const tag io,
const tag mf,
const shapeMF s,
const real_t * cp,
const real_t h = 1.0_re )
inlinenoexcept

Setup the input tag and points for the specified membership function.

Parameters
[in]ioThe input tag related with this membership function
[in]mfThe user-defined tag for this membership function
[in]sThe wanted shape/form for this membership function, can be one of the following: trimf, trapmf, gbellmf, gaussmf, gauss2mf, sigmf, dsigmf, psigmf, pimf, smf, zmf, singletonmf, concavemf, spikemf, linsmf, linzmf, rectmf, cosmf.
Note
For Sugeno FIS, an output membership function should be one of the following: constantmf, linearmf.
For Tsukamoto FIS, an output membership function should be one the following monotonic functions : tlinsmf, tlinzmf, tsmf, tzmf, tconcavemf
Parameters
[in]cpPoints or coefficients of the membership function.
[in]hHeight of the membership function.
Note
Height parameter h does not apply for output membership functions on Sugeno and Tsukamoto inference systems. [ 0 <= h <= 1]
Returns
true on success, otherwise return false.

◆ setupInputMF() [2/2]

template<type fType, size_t numberOfInputs, size_t numberOfOutputs, size_t numberOfInputSets, size_t numberOfOutputSets, size_t numberOfRules>
bool qlibs::fis::system< fType, numberOfInputs, numberOfOutputs, numberOfInputSets, numberOfOutputSets, numberOfRules >::setupInputMF ( const tag io,
const tag mf,
mfFunction customMfs,
const real_t * cp,
const real_t h = 1.0_re )
inlinenoexcept

Setup the input tag and points for the specified membership function.

Parameters
[in]ioThe input tag related with this membership function
[in]mfThe user-defined tag for this membership function
[in]customMfsCustom user-defined membership function.
[in]cpPoints or coefficients of the membership function.
[in]hHeight of the membership function.
Note
Height parameter h does not apply for output membership functions on Sugeno and Tsukamoto inference systems. [ 0 <= h <= 1]
Returns
true on success, otherwise return false.

◆ setupOutput()

template<type fType, size_t numberOfInputs, size_t numberOfOutputs, size_t numberOfInputSets, size_t numberOfOutputSets, size_t numberOfRules>
bool qlibs::fis::system< fType, numberOfInputs, numberOfOutputs, numberOfInputSets, numberOfOutputSets, numberOfRules >::setupOutput ( const tag t,
const real_t Min,
const real_t Max )
inlinenoexcept

Setup the output with the specified tag and set limits for it.

Parameters
[in]tThe output tag
[in]MinMinimum allowed value for this output
[in]MaxMax allowed value for this output
Returns
true on success, otherwise return false.

◆ setupOutputMF() [1/2]

template<type fType, size_t numberOfInputs, size_t numberOfOutputs, size_t numberOfInputSets, size_t numberOfOutputSets, size_t numberOfRules>
bool qlibs::fis::system< fType, numberOfInputs, numberOfOutputs, numberOfInputSets, numberOfOutputSets, numberOfRules >::setupOutputMF ( const tag io,
const tag mf,
const shapeMF s,
const real_t * cp,
const real_t h = 1.0_re )
inlinenoexcept

Set the output tag and points for the specified membership function.

Parameters
[in]ioThe output tag related with this membership function
[in]mfThe user-defined tag for this membership function
[in]sThe wanted shape/form for this membership function, can be one of the following: trimf, trapmf, gbellmf, gaussmf, gauss2mf, sigmf, dsigmf, psigmf, pimf, smf, zmf, singletonmf, concavemf, spikemf, linsmf, linzmf, rectmf, cosmf.
Note
For Sugeno FIS, an output membership function should be one of the following: constantmf, linearmf.
For Tsukamoto FIS, an output membership function should be one the following monotonic functions : tlinsmf, tlinzmf, tsmf, tzmf, tconcavemf
Parameters
[in]cpPoints or coefficients of the membership function.
[in]hHeight of the membership function.
Note
Height parameter h does not apply for output membership functions on Sugeno and Tsukamoto inference systems. [ 0 <= h <= 1]
Returns
true on success, otherwise return false.

◆ setupOutputMF() [2/2]

template<type fType, size_t numberOfInputs, size_t numberOfOutputs, size_t numberOfInputSets, size_t numberOfOutputSets, size_t numberOfRules>
bool qlibs::fis::system< fType, numberOfInputs, numberOfOutputs, numberOfInputSets, numberOfOutputSets, numberOfRules >::setupOutputMF ( const tag io,
const tag mf,
mfFunction customMfs,
const real_t * cp,
const real_t h = 1.0_re )
inlinenoexcept

Set the output tag and points for the specified membership function.

Parameters
[in]ioThe output tag related with this membership function
[in]mfThe user-defined tag for this membership function
[in]customMfsCustom user-defined membership function.
[in]cpPoints or coefficients of the membership function.
[in]hHeight of the membership function.
Note
Height parameter h does not apply for output membership functions on Sugeno and Tsukamoto inference systems. [ 0 <= h <= 1]
Returns
true on success, otherwise return false.