From 428ef4a28dc25409df02f6af024043c21307a646 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Thu, 10 Nov 2016 16:15:30 -0500 Subject: [PATCH] Use the DEBUG_FLOAT_FORMAT when printing exception details. --- dunshire/games.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dunshire/games.py b/dunshire/games.py index 437b533..ff3ec00 100644 --- a/dunshire/games.py +++ b/dunshire/games.py @@ -939,6 +939,7 @@ class SymmetricLinearGame: # Oops, CVXOPT tried to take the square root of a # negative number. Report some details about the game # rather than just the underlying CVXOPT crash. + printing.options['dformat'] = options.DEBUG_FLOAT_FORMAT raise PoorScalingException(self) else: raise error @@ -963,6 +964,7 @@ class SymmetricLinearGame: # that CVXOPT is convinced the problem is infeasible (and that # cannot happen). if soln_dict['status'] in ['primal infeasible', 'dual infeasible']: + printing.options['dformat'] = options.DEBUG_FLOAT_FORMAT raise GameUnsolvableException(self, soln_dict) # The "optimal" and "unknown" results, we actually treat the @@ -976,11 +978,13 @@ class SymmetricLinearGame: # it) because otherwise CVXOPT might return "unknown" and give # us two points in the cone that are nowhere near optimal. if abs(p1_value - p2_value) > 2*options.ABS_TOL: + printing.options['dformat'] = options.DEBUG_FLOAT_FORMAT raise GameUnsolvableException(self, soln_dict) # And we also check that the points it gave us belong to the # cone, just in case... if (p1_optimal not in self._K) or (p2_optimal not in self._K): + printing.options['dformat'] = options.DEBUG_FLOAT_FORMAT raise GameUnsolvableException(self, soln_dict) # For the game value, we could use any of: -- 2.43.2