def __init__(self, rules, weights, evaluation='ave'):
        """
        :param list rules:
            Subrules for this rule. Subrule can be either an iterable of length
            2, the (Feature, Mapper)-pair, or another Rule instance.

        :param list weights:
            Weights for the subrules.

        :param evaluation:
            How rule's internal evaluation is done. Either one of the
            predefined functions, or user defined callable which takes two
            arguments: rule and artifact (in that order). Predefined functions
            and their keywords are:

            * 'ave': :py:func:`~creamas.core.rule.weighted_average`
            * 'min': :py:func:`~creamas.core.rule.minimum`
            * 'max': :py:func:`~creamas.core.rule.maximum`

        """
        assert len(rules) == len(weights)
        self.__domains = set()
        self.__R = []
        self.__W = []

        for i in range(len(rules)):
            self.add_subrule(rules[i], weights[i])

        if evaluation == 'ave':
            self.evaluate = partial(weighted_average, self)
        elif evaluation == 'min':
            self.evaluate = partial(minimum, self)
        elif evaluation == 'max':
            self.evaluate = partial(maximum, self)
        elif hasattr(evaluation, '__call__'):
            self.evaluate = partial(evaluation, self)
        else:
            raise ValueError("'evaluation' keyword must be one of the "
                             "recognized types or callable, got {}."
                             .format(evaluation))
def __init__ ( self , rules , weights , evaluation = 'ave' ) : assert len ( rules ) == len ( weights ) self . __domains = set ( ) self . __R = [ ] self . __W = [ ] for i in range ( len ( rules ) ) : self . add_subrule ( rules [ i ] , weights [ i ] ) if evaluation == 'ave' : self . evaluate = partial ( weighted_average , self ) elif evaluation == 'min' : self . evaluate = partial ( minimum , self ) elif evaluation == 'max' : self . evaluate = partial ( maximum , self ) elif hasattr ( evaluation , '__call__' ) : self . evaluate = partial ( evaluation , self ) else : raise ValueError ( "'evaluation' keyword must be one of the " "recognized types or callable, got {}." . format ( evaluation ) )
:param list rules:
            Subrules for this rule. Subrule can be either an iterable of length
            2, the (Feature, Mapper)-pair, or another Rule instance.

        :param list weights:
            Weights for the subrules.

        :param evaluation:
            How rule's internal evaluation is done. Either one of the
            predefined functions, or user defined callable which takes two
            arguments: rule and artifact (in that order). Predefined functions
            and their keywords are:

            * 'ave': :py:func:`~creamas.core.rule.weighted_average`
            * 'min': :py:func:`~creamas.core.rule.minimum`
            * 'max': :py:func:`~creamas.core.rule.maximum`