Package fuzzy :: Package fuzzify :: Module Plain
[hide private]
[frames] | no frames]

Source Code for Module fuzzy.fuzzify.Plain

 1  # -*- coding: utf-8 -*- 
 2  # 
 3  # Copyright (C) 2009  Rene Liebscher 
 4  # 
 5  # This program is free software; you can redistribute it and/or modify it under 
 6  # the terms of the GNU Lesser General Public License as published by the Free  
 7  # Software Foundation; either version 3 of the License, or (at your option) any 
 8  # later version. 
 9  # 
10  # This program is distributed in the hope that it will be useful, but WITHOUT  
11  # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 
12  # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 
13  # details. 
14  #  
15  # You should have received a copy of the GNU Lesser General Public License 
16  # along with this program; if not, see <http://www.gnu.org/licenses/>.  
17  # 
18   
19  """Fuzzification which sets adjectives values according their set memberships for given value.""" 
20   
21  __revision__ = "$Id: Plain.py,v 1.7 2010-10-29 19:24:41 rliebscher Exp $" 
22   
23   
24  from fuzzy.fuzzify.Base import Base 
25   
26   
27 -class Plain(Base): # pylint: disable=R0903
28 """Just fuzzify the input value using the membership values of the given adjectives""" 29
30 - def __init__(self, *args, **keywords):
31 super(Plain, self).__init__(*args, **keywords)
32
33 - def setValue(self, variable, value):
34 """Let adjectives calculate their membership values. 35 36 @param variable: variable which adjective to set 37 @type variable: L{fuzzy.Variable.Variable} 38 @param variable: value to set the adjectives 39 @type: float 40 """ 41 for adjective in variable.adjectives.values(): 42 adjective.setMembershipForValue(value) 43 return value
44