]> gitweb.michael.orlitzky.com - dunshire.git/commitdiff
Pass ABS_TOL to CVXOPT when solving games.
authorMichael Orlitzky <michael@orlitzky.com>
Thu, 3 Nov 2016 12:08:31 +0000 (08:08 -0400)
committerMichael Orlitzky <michael@orlitzky.com>
Thu, 3 Nov 2016 12:08:31 +0000 (08:08 -0400)
Our ABS_TOL is less than the CVXOPT default, and it looks like using
ours reduces the number of "unknown" results that we get. So let's try
that for now.

dunshire/games.py

index 1f672abeb3870f45b13a8d9d169e8df0f1059d98..c2ca68ea7faee4f751410a1dbf27c31517400d9f 100644 (file)
@@ -12,8 +12,6 @@ from .matrices import append_col, append_row, condition_number, identity
 from . import options
 
 printing.options['dformat'] = options.FLOAT_FORMAT
-solvers.options['show_progress'] = options.VERBOSE
-
 
 class Solution:
     """
@@ -467,6 +465,8 @@ class SymmetricLinearGame:
         # Actually solve the thing and obtain a dictionary describing
         # what happened.
         try:
+            solvers.options['show_progress'] = options.VERBOSE
+            solvers.options['abs_tol'] = options.ABS_TOL
             soln_dict = solvers.conelp(c, self._G(), h,
                                        C.cvxopt_dims(), self._A(), b)
         except ValueError as e:
@@ -511,7 +511,7 @@ class SymmetricLinearGame:
             # 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:
+            if abs(p1_value - p2_value) > 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)