Package fuzzy :: Module OutputVariable
[hide private]
[frames] | no frames]

Source Code for Module fuzzy.OutputVariable

 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  """General instance of an output variable.""" 
19  __revision__ = "$Id: OutputVariable.py,v 1.14 2010-03-28 18:38:08 rliebscher Exp $" 
20   
21  from fuzzy.Variable import Variable 
22   
23 -class OutputVariable(Variable):
24 """General instance of an output variable. 25 The defuzzification is provided by special object for this purpose, 26 set as defuzzify param. 27 Also marker, so you can check if any variable is an (instance of) output variable 28 29 @ivar defuzzify: Defuzzification method. 30 @type defuzzify: L{fuzzy.defuzzify.Base.Base} 31 """ 32
33 - def __init__(self, defuzzify=None, *args, **keywords):
34 """Initialize this output variable with a defuzzification method. 35 36 @param defuzzify: Defuzzification method. 37 @type defuzzify: L{fuzzy.defuzzify.Base.Base} 38 """ 39 super(OutputVariable, self).__init__(*args, **keywords) 40 self.defuzzify = defuzzify
41
42 - def getValue(self):
43 """defuzzification""" 44 return self.defuzzify.getValue(self)
45
46 - def _repr_params(self, params):
47 """Helper for representation of instance. 48 49 Add all own params to given list in params. 50 """ 51 params.append(repr(self.defuzzify)) 52 super(OutputVariable, self)._repr_params(params)
53