def __init__(self, name, operators=('MIN', 'MAX', 'ZADEH'), activation='MIN', accumulation='MAX'): """ Initialize a block of rules :param name: rule-block name :param operators: definitions for 'and', 'or' and 'not' operators :param activation: definition of activation method :param accumulation: definition of accumulation method """ self.accumulation = get_norm(accumulation) self.activation = get_norm(activation) self.set_operators(operators) self.name = name self.inputs = {} self.outputs = {} self.rules = []
def set_operators(self, operators): """Set the function norms used for 'and', 'or' and 'not' operators""" and_, or_, not_ = operators self.and_ = get_norm(and_ or 'MIN') self.or_ = get_norm(or_ or 'MAX') self.not_ = get_norm(not_ or 'ZADEH')