예제 #1
0
파일: desirs.py 프로젝트: equaeghe/murasyp
    def asl(self):
        """Check whether the set of desirable gambles avoids sure loss

          :rtype: :class:`bool`

        A set of desirable gambles does not avoid sure loss if and only if some
        nonnegative linear combination of desirable gambles is everywhere
        negative.

        >>> D = DesirSet()
        >>> D.add([{'a': -1, 'b': -1, 'c': 1}])
        >>> D.add([{'a': 1, 'b': -1, 'c': -1}])
        >>> D.asl()
        True
        >>> D.add([{'a': -1, 'b': 1, 'c': -1}])
        >>> D.asl()
        False
        >>> D = DesirSet('ab')
        >>> D.add([{'b': -1}])
        >>> D.asl()
        True

        """
        D = DesirSet([Cone.union(*(self | DesirSet([self.pspace()])))])
        return murasyp.mathprog.feasible(D) == set()
예제 #2
0
    def get_credal(self):
        """Generate the corresponding (closed) credal set

          :returns: the (closed) credal set that corresponds as an uncertainty
            model
          :rtype: :class:`~murasyp.credalsets.CredalSet`

        >>> D = DesirSet(['abc'])
        >>> D.set_lower_pr({'a': 1, 'b': 0, 'c': 1}, .5)
        >>> D.get_credal()
        CredalSet([PMFunc({'a': '1/2', 'b': '1/2'}), PMFunc({'c': '1/2', 'b': '1/2'}), PMFunc({'a': 1}), PMFunc({'c': 1})])

        """
        C = Cone.union(*self)
        return murasyp.credalsets.CredalSet(murasyp.mathprog.vf_enumeration(C))