def __mul__(self, other): """Lower expectation of a gamble""" gamble = Gamble(other) indicator = Gamble(gamble.domain()) return murasyp.mathprog.maximize( self | DesirSet(self.pspace() | gamble.domain() | indicator.domain()) | DesirSet([{indicator}, {-indicator}, {()}]), gamble, (0, {indicator: 1, -indicator: -1}))
def set_lower_pr(self, data, val): """Set the lower probability/prevision (expectation) of an event/gamble :arg `data`: the gamble for which a probability/prevision value is given :type `data`: arguments accepted by the :class:`~murasyp.gambles.Gamble` constructor :arg `val`: the probability/prevision value :type `val`: a representation of :class:`~numbers.Real` The nontrivial cone corresponing to the prevision specification is calculated and added to the set of desirable gambles. >>> D = DesirSet() >>> D.set_lower_pr(Gamble({'a', 'b'}) | {'a', 'b', 'c'}, .4) >>> assert ( ... D == ... DesirSet({Cone({Ray({'a': 1, 'c': '-2/3', 'b': 1}), ... Ray({'a': 1, 'c': 1, 'b': 1})})}) ... ) .. note:: The domain of the input gamble determines the conditioning event. """ gamble = Gamble(data) self.add({gamble - gamble._make_rational(val), Ray(gamble.domain())})