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

The PiShape class is an extended Term that represents the Pi-shaped curve membership function. More...

#include <PiShape.h>

Inheritance diagram for fl::PiShape:
Collaboration diagram for fl::PiShape:

Public Member Functions

 PiShape (const std::string &name="", scalar bottomLeft=fl::nan, scalar topLeft=fl::nan, scalar topRight=fl::nan, scalar bottomRight=fl::nan, scalar height=1.0)
 
virtual ~PiShape () 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 setBottomLeft (scalar bottomLeft)
 Sets the bottom-left value of the curve. More...
 
virtual scalar getBottomLeft () const
 Gets the bottom-left value of the curve. More...
 
virtual void setTopLeft (scalar topLeft)
 Sets the top-left value of the curve. More...
 
virtual scalar getTopLeft () const
 Gets the top-left value of the curve. More...
 
virtual void setTopRight (scalar topRight)
 Sets the top-right value of the curve. More...
 
virtual scalar getTopRight () const
 Gets the top-right value of the curve. More...
 
virtual void setBottomRight (scalar bottomRight)
 Sets the bottom-right value of the curve. More...
 
virtual scalar getBottomRight () const
 Gets the bottom-right value of the curve. More...
 
virtual PiShapeclone () 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 PiShape class is an extended Term that represents the Pi-shaped curve membership function.

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

Definition at line 35 of file PiShape.h.

Constructor & Destructor Documentation

◆ PiShape()

fl::PiShape::PiShape ( const std::string &  name = "",
scalar  bottomLeft = fl::nan,
scalar  topLeft = fl::nan,
scalar  topRight = fl::nan,
scalar  bottomRight = fl::nan,
scalar  height = 1.0 
)
explicit

◆ ~PiShape()

virtual fl::PiShape::~PiShape ( )
virtual

Member Function Documentation

◆ className()

virtual std::string fl::PiShape::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 PiShape* fl::PiShape::clone ( ) const
virtual

Creates a clone of the term.

Returns
a clone of the term

Implements fl::Term.

◆ complexity()

virtual Complexity fl::PiShape::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::PiShape::configure ( const std::string &  parameters)
virtual

Configures the term with the parameters.

Parameters
parametersas "bottomLeft topLeft topRight bottomRight [height]"

Implements fl::Term.

◆ constructor()

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

◆ getBottomLeft()

virtual scalar fl::PiShape::getBottomLeft ( ) const
virtual

Gets the bottom-left value of the curve.

Returns
the bottom-left value of the curve

◆ getBottomRight()

virtual scalar fl::PiShape::getBottomRight ( ) const
virtual

Gets the bottom-right value of the curve.

Returns
the bottom-right value of the curve

◆ getTopLeft()

virtual scalar fl::PiShape::getTopLeft ( ) const
virtual

Gets the top-left value of the curve.

Returns
the top-left value of the curve

◆ getTopRight()

virtual scalar fl::PiShape::getTopRight ( ) const
virtual

Gets the top-right value of the curve.

Returns
the top-right value of the curve

◆ membership()

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

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

Parameters
x
Returns
\(\begin{cases} 0h & \mbox{if $x \leq b_l$}\cr 2h \left((x - b_l) / (t_l-b_l)\right)^2 & \mbox{if $x \leq 0.5(a+b)$}\cr h (1 - 2 \left((x - t_l) / (t_l-b_l)\right)^2) & \mbox{if $ x < t_l$}\cr h & \mbox{if $x \leq t_r$}\cr h (1 - 2\left((x - t_r) / (b_r - t_r)\right)^2) & \mbox{if $x \leq 0.5(t_r + b_r)$}\cr 2h \left((x - b_r) / (b_r-t_r)\right)^2 & \mbox{if $x < b_r$} \cr 0h & \mbox{otherwise} \end{cases}\)

where \(h\) is the height of the Term, \(b_l\) is the bottom left of the PiShape, \(t_l\) is the top left of the PiShape, \(t_r\) is the top right of the PiShape \(b_r\) is the bottom right of the PiShape,

Implements fl::Term.

◆ parameters()

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

Returns the parameters of the term.

Returns
"bottomLeft topLeft topRight bottomRight [height]"

Implements fl::Term.

◆ setBottomLeft()

virtual void fl::PiShape::setBottomLeft ( scalar  bottomLeft)
virtual

Sets the bottom-left value of the curve.

Parameters
bottomLeftis the bottom-left value of the curve

◆ setBottomRight()

virtual void fl::PiShape::setBottomRight ( scalar  bottomRight)
virtual

Sets the bottom-right value of the curve.

Parameters
bottomRightis the bottom-right value of the curve

◆ setTopLeft()

virtual void fl::PiShape::setTopLeft ( scalar  topLeft)
virtual

Sets the top-left value of the curve.

Parameters
topLeftis the top-left value of the curve

◆ setTopRight()

virtual void fl::PiShape::setTopRight ( scalar  topRight)
virtual

Sets the top-right value of the curve.

Parameters
topRightis the top-right value of the curve

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