]> gitweb.michael.orlitzky.com - dunshire.git/commitdiff
Use the DEBUG_FLOAT_FORMAT when printing exception details.
authorMichael Orlitzky <michael@orlitzky.com>
Thu, 10 Nov 2016 21:15:30 +0000 (16:15 -0500)
committerMichael Orlitzky <michael@orlitzky.com>
Sun, 13 Nov 2016 20:19:26 +0000 (15:19 -0500)
dunshire/games.py

index 437b53336ab5791cbf010ff15aa5f78509ea57c0..ff3ec0001b4c3508ceef2c43afb6d13ffb7d403f 100644 (file)
@@ -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: