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()
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))