>>> norm(s1.player2_optimal() - s2.player2_optimal()) < ABS_TOL
True
+ This game cannot be solved with the default tolerance, but it
+ can be solved with a weaker one::
+
+ >>> from dunshire import *
+ >>> from dunshire.options import ABS_TOL
+ >>> L = [[ 0.58538005706658102767, 1.53764301129883040886],
+ ... [-1.34901059721452210027, 1.50121179114155500756]]
+ >>> K = NonnegativeOrthant(2)
+ >>> e1 = [1.04537193228494995623, 1.39699624965841895374]
+ >>> e2 = [0.35326554172108337593, 0.11795703527854853321]
+ >>> SLG = SymmetricLinearGame(L,K,e1,e2)
+ >>> print(SLG._try_solution(ABS_TOL / 10))
+ Traceback (most recent call last):
+ ...
+ dunshire.errors.GameUnsolvableException: Solution failed...
+ >>> print(SLG._try_solution(ABS_TOL))
+ Game value: 9.1100945
+ Player 1 optimal:
+ [-0.0000000]
+ [ 8.4776631]
+ Player 2 optimal:
+ [0.0000000]
+ [0.7158216]
+
"""
try:
- solvers.options['show_progress'] = options.VERBOSE
- solvers.options['abs_tol'] = tolerance
+ opts = {'show_progress': options.VERBOSE, 'abstol': tolerance}
soln_dict = solvers.conelp(self._c(),
self._G(),
self._h(),
self._C().cvxopt_dims(),
self._A(),
- self._b())
- except ValueError as e:
- if str(e) == 'math domain error':
+ self._b(),
+ options=opts)
+ except ValueError as error:
+ if str(error) == '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
+ raise error
# The optimal strategies are named ``p`` and ``q`` in the
# background documentation, and we need to extract them from