X-Git-Url: http://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=dunshire%2Fgames.py;h=e25db28a8e7349e88b9bdd18f16d0eea0b5c03c1;hb=d988995ea403db9d6f63a7101d31b8d624fc379e;hp=c841caae752b9075ee28030d2a15df5d42354308;hpb=3ee9db27adb69d68871ef26ec22ef144f351e99d;p=dunshire.git diff --git a/dunshire/games.py b/dunshire/games.py index c841caa..e25db28 100644 --- a/dunshire/games.py +++ b/dunshire/games.py @@ -346,7 +346,7 @@ class SymmetricLinearGame: str(self._K), indented_e1, indented_e2, - self._condition()) + self.condition()) def _zero(self): @@ -505,7 +505,13 @@ class SymmetricLinearGame: # objectives match (within a tolerance) and that the # primal/dual optimal solutions are within the cone (to a # tolerance as well). - if abs(p1_value - p2_value) > options.ABS_TOL: + # + # The fudge factor of two is basically unjustified, but + # makes intuitive sense when you imagine that the primal + # value could be under the true optimal by ``ABS_TOL`` + # and the dual value could be over by the same amount. + # + if abs(p1_value - p2_value) > 2*options.ABS_TOL: raise GameUnsolvableException(self, soln_dict) if (p1_optimal not in self._K) or (p2_optimal not in self._K): raise GameUnsolvableException(self, soln_dict) @@ -513,7 +519,7 @@ class SymmetricLinearGame: return Solution(p1_value, p1_optimal, p2_optimal) - def _condition(self): + def condition(self): r""" Return the condition number of this game. @@ -541,7 +547,7 @@ class SymmetricLinearGame: >>> e1 = [1] >>> e2 = e1 >>> SLG = SymmetricLinearGame(L, K, e1, e2) - >>> actual = SLG._condition() + >>> actual = SLG.condition() >>> expected = 1.8090169943749477 >>> abs(actual - expected) < options.ABS_TOL True