fuzzylite  6.0
A Fuzzy Logic Control Library in C++
fl::Trapezoid Class Reference

The Trapezoid class is a basic Term that represents the trapezoidal membership function. More...

#include <Trapezoid.h>

Inheritance diagram for fl::Trapezoid:
Collaboration diagram for fl::Trapezoid:

Public Member Functions

 Trapezoid (const std::string &name="", scalar vertexA=fl::nan, scalar vertexB=fl::nan, scalar vertexC=fl::nan, scalar vertexD=fl::nan, scalar height=1.0)
 
virtual ~Trapezoid () FL_IOVERRIDE
 
virtual std::string className () const FL_IOVERRIDE
 Returns the name of the class of the term. More...
 
virtual std::string parameters () const FL_IOVERRIDE
 Returns the parameters of the term. More...
 
virtual void configure (const std::string &parameters) FL_IOVERRIDE
 Configures the term with the parameters. More...
 
virtual Complexity complexity () const FL_IOVERRIDE
 Computes the estimated complexity of evaluating the membership function. More...
 
virtual scalar membership (scalar x) const FL_IOVERRIDE
 Computes the membership function evaluated at \(x\). More...
 
virtual void setVertexA (scalar a)
 Sets the first vertex of the trapezoid. More...
 
virtual scalar getVertexA () const
 Gets the first vertex of the trapezoid. More...
 
virtual void setVertexB (scalar b)
 Sets the second vertex of the trapezoid. More...
 
virtual scalar getVertexB () const
 Gets the second vertex of the trapezoid. More...
 
virtual void setVertexC (scalar c)
 Sets the third vertex of the trapezoid. More...
 
virtual scalar getVertexC () const
 Gets the third vertex of the trapezoid. More...
 
virtual void setVertexD (scalar d)
 Sets the fourth vertex of the trapezoid. More...
 
virtual scalar getVertexD () const
 Gets the fourth vertex of the trapezoid. More...
 
virtual Trapezoidclone () const FL_IOVERRIDE
 Creates a clone of the term. More...
 
- Public Member Functions inherited from fl::Term
 Term (const std::string &name="", scalar height=1.0)
 
virtual ~Term ()
 
virtual void setName (const std::string &name)
 Sets the name of the term. More...
 
virtual std::string getName () const
 Gets the name of the term. More...
 
virtual void setHeight (scalar height)
 Sets the height of the term. More...
 
virtual scalar getHeight () const
 Gets the height of the term. More...
 
virtual std::string toString () const
 Returns the representation of the term in the FuzzyLite Language. More...
 
virtual void updateReference (const Engine *engine)
 Updates the references (if any) to point to the current engine (useful when cloning engines or creating terms within Importer objects. More...
 

Static Public Member Functions

static Termconstructor ()
 

Additional Inherited Members

- Protected Attributes inherited from fl::Term
scalar _height
 

Detailed Description

The Trapezoid class is a basic Term that represents the trapezoidal membership function.

trapezoid.svg
Author
Juan Rada-Vilela, Ph.D.
See also
Term
Variable
Since
4.0

Definition at line 35 of file Trapezoid.h.

Constructor & Destructor Documentation

◆ Trapezoid()

fl::Trapezoid::Trapezoid ( const std::string &  name = "",
scalar  vertexA = fl::nan,
scalar  vertexB = fl::nan,
scalar  vertexC = fl::nan,
scalar  vertexD = fl::nan,
scalar  height = 1.0 
)
explicit

◆ ~Trapezoid()

virtual fl::Trapezoid::~Trapezoid ( )
virtual

Member Function Documentation

◆ className()

virtual std::string fl::Trapezoid::className ( ) const
virtual

Returns the name of the class of the term.

Returns
the name of the class of the term

Implements fl::Term.

◆ clone()

virtual Trapezoid* fl::Trapezoid::clone ( ) const
virtual

Creates a clone of the term.

Returns
a clone of the term

Implements fl::Term.

◆ complexity()

virtual Complexity fl::Trapezoid::complexity ( ) const
virtual

Computes the estimated complexity of evaluating the membership function.

Returns
the estimated complexity of evaluating the membership function

Implements fl::Term.

◆ configure()

virtual void fl::Trapezoid::configure ( const std::string &  parameters)
virtual

Configures the term with the parameters.

Parameters
parametersas "vertexA vertexB vertexC vertexD [height]"

Implements fl::Term.

◆ constructor()

static Term* fl::Trapezoid::constructor ( )
static

◆ getVertexA()

virtual scalar fl::Trapezoid::getVertexA ( ) const
virtual

Gets the first vertex of the trapezoid.

Returns
the first vertex of the trapezoid

◆ getVertexB()

virtual scalar fl::Trapezoid::getVertexB ( ) const
virtual

Gets the second vertex of the trapezoid.

Returns
the second vertex of the trapezoid

◆ getVertexC()

virtual scalar fl::Trapezoid::getVertexC ( ) const
virtual

Gets the third vertex of the trapezoid.

Returns
the third vertex of the trapezoid

◆ getVertexD()

virtual scalar fl::Trapezoid::getVertexD ( ) const
virtual

Gets the fourth vertex of the trapezoid.

Returns
the fourth vertex of the trapezoid

◆ membership()

virtual scalar fl::Trapezoid::membership ( scalar  x) const
virtual

Computes the membership function evaluated at \(x\).

Parameters
x
Returns
\(\begin{cases} 0h & \mbox{if $x \not\in[a,d]$}\cr h \times \min(1, (x - a) / (b - a)) & \mbox{if $x < b$}\cr 1h & \mbox{if $x \leq c$}\cr h (d - x) / (d - c) & \mbox{if $x < d$}\cr 0h & \mbox{otherwise} \end{cases}\)

where \(h\) is the height of the Term, \(a\) is the first vertex of the Trapezoid, \(b\) is the second vertex of the Trapezoid, \(c\) is the third vertex of the Trapezoid, \(d\) is the fourth vertex of the Trapezoid

Implements fl::Term.

◆ parameters()

virtual std::string fl::Trapezoid::parameters ( ) const
virtual

Returns the parameters of the term.

Returns
"vertexA vertexB vertexC vertexD [height]"

Implements fl::Term.

◆ setVertexA()

virtual void fl::Trapezoid::setVertexA ( scalar  a)
virtual

Sets the first vertex of the trapezoid.

Parameters
ais the first vertex of the trapezoid

◆ setVertexB()

virtual void fl::Trapezoid::setVertexB ( scalar  b)
virtual

Sets the second vertex of the trapezoid.

Parameters
bis the second vertex of the trapezoid

◆ setVertexC()

virtual void fl::Trapezoid::setVertexC ( scalar  c)
virtual

Sets the third vertex of the trapezoid.

Parameters
cis the third vertex of the trapezoid

◆ setVertexD()

virtual void fl::Trapezoid::setVertexD ( scalar  d)
virtual

Sets the fourth vertex of the trapezoid.

Parameters
dis the fourth vertex of the trapezoid

The documentation for this class was generated from the following file: