from cvxopt import matrix, printing, solvers
from .cones import CartesianProduct
-from .errors import GameUnsolvableException
+from .errors import GameUnsolvableException, PoorScalingException
from .matrices import append_col, append_row, identity
from . import options
If the game could not be solved (if an optimal solution to its
associated cone program was not found).
+ PoorScalingException
+ If the game could not be solved because CVXOPT crashed while
+ trying to take the square root of a negative number.
+
Examples
--------
# Actually solve the thing and obtain a dictionary describing
# what happened.
- soln_dict = solvers.conelp(c, G, h, C.cvxopt_dims(), A, b)
+ try:
+ soln_dict = solvers.conelp(c, G, h, C.cvxopt_dims(), A, b)
+ except ValueError as e:
+ if str(e) == 'math domain error':
+ # 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.
+ raise PoorScalingException(self)
+ else:
+ raise e
# The optimal strategies are named ``p`` and ``q`` in the
# background documentation, and we need to extract them from