Package fuzzy :: Package set :: Module Trapez :: Class Trapez
[hide private]
[frames] | no frames]

Class Trapez

source code


Realize a trapezoid-shaped fuzzy set:

          _____ _____  y_max
         /     \
        /|     |\
       / |     | \
      /  |     |  \
    _/   |     |   \_  y_min
     |   m1    m2  |
     |   |     |   |
    alpha|     |beta

See also http://pyfuzzy.sourceforge.net/demo/set/Trapez.png

Instance Methods [hide private]
 
__init__(self, m1=-0.5, m2=0.5, alpha=0.5, beta=0.5, y_max=1.0, y_min=0.0)
Initialize a trapezoid-shaped fuzzy set.
source code
 
_update(self)
update polygon
source code
 
add(self, x, y, where=1)
Don't let anyone destroy our trapezoid.
source code
 
remove(self, x, where=1)
Don't let anyone destroy our trapezoid.
source code
 
clear(self)
Don't let anyone destroy our trapezoid.
source code
string
__repr__(self)
Return representation of instance.
source code

Inherited from Polygon.Polygon: __call__, getCOG, getValuesX, getValuesXY

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]

Inherited from Polygon.Polygon: BEGIN, END, X, Y

Properties [hide private]
float y_max
y-value at top of the trapezoid
float y_min
y-value outside the trapezoid
float m1
x-value of left top of trapezoid
float m2
x-value of right top of trapezoid
float alpha
distance of left corner to m1
float beta
distance of right corner to m2

Inherited from Polygon.Polygon: points

Inherited from object: __class__

Method Details [hide private]

__init__(self, m1=-0.5, m2=0.5, alpha=0.5, beta=0.5, y_max=1.0, y_min=0.0)
(Constructor)

source code 

Initialize a trapezoid-shaped fuzzy set.

Parameters:
  • y_max - y-value at top of the trapezoid (1.0)
  • y_min - y-value outside the trapezoid (0.0)
  • m1 - x-value of left top of trapezoid (-0.5)
  • m2 - x-value of right top of trapezoid (0.5)
  • alpha - distance of left corner to m1 (0.5)
  • beta - distance of right corner to m2 (0.5)
Overrides: object.__init__

add(self, x, y, where=1)

source code 

Don't let anyone destroy our trapezoid.

Overrides: Polygon.Polygon.add

remove(self, x, where=1)

source code 

Don't let anyone destroy our trapezoid.

Overrides: Polygon.Polygon.remove

clear(self)

source code 

Don't let anyone destroy our trapezoid.

Overrides: Polygon.Polygon.clear

__repr__(self)
(Representation operator)

source code 

Return representation of instance.

Returns: string
representation of instance
Overrides: object.__repr__

Property Details [hide private]

y_max

y-value at top of the trapezoid

Get Method:
unreachable.fget(self)
Set Method:
unreachable.fset(self, value)
Type:
float

y_min

y-value outside the trapezoid

Get Method:
unreachable.fget(self)
Set Method:
unreachable.fset(self, value)
Type:
float

m1

x-value of left top of trapezoid

Get Method:
unreachable.fget(self)
Set Method:
unreachable.fset(self, value)
Type:
float

m2

x-value of right top of trapezoid

Get Method:
unreachable.fget(self)
Set Method:
unreachable.fset(self, value)
Type:
float

alpha

distance of left corner to m1

Get Method:
unreachable.fget(self)
Set Method:
unreachable.fset(self, value)
Type:
float

beta

distance of right corner to m2

Get Method:
unreachable.fget(self)
Set Method:
unreachable.fset(self, value)
Type:
float