- def solution(self):
- """
- Solve this linear game and return a :class:`Solution`.
-
- Returns
- -------
-
- :class:`Solution`
- A :class:`Solution` object describing the game's value and
- the optimal strategies of both players.
-
- Raises
- ------
- GameUnsolvableException
- 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
- --------
-
- This example is computed in Gowda and Ravindran in the section
- "The value of a Z-transformation"::
-
- >>> from dunshire import *
- >>> K = NonnegativeOrthant(3)
- >>> L = [[1,-5,-15],[-1,2,-3],[-12,-15,1]]
- >>> e1 = [1,1,1]
- >>> e2 = [1,1,1]
- >>> SLG = SymmetricLinearGame(L, K, e1, e2)
- >>> print(SLG.solution())
- Game value: -6.1724138
- Player 1 optimal:
- [ 0.551...]
- [-0.000...]
- [ 0.448...]
- Player 2 optimal:
- [0.448...]
- [0.000...]
- [0.551...]
-
- The value of the following game can be computed using the fact
- that the identity is invertible::
-
- >>> from dunshire import *
- >>> K = NonnegativeOrthant(3)
- >>> L = [[1,0,0],[0,1,0],[0,0,1]]
- >>> e1 = [1,2,3]
- >>> e2 = [4,5,6]
- >>> SLG = SymmetricLinearGame(L, K, e1, e2)
- >>> print(SLG.solution())
- Game value: 0.0312500
- Player 1 optimal:
- [0.031...]
- [0.062...]
- [0.093...]
- Player 2 optimal:
- [0.125...]
- [0.156...]
- [0.187...]
+ # 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):
+ raise GameUnsolvableException(self, soln_dict)