]> gitweb.michael.orlitzky.com - dunshire.git/blobdiff - test/symmetric_linear_game_test.py
Add game accessor methods for its L, K, e1, e2, and dimension.
[dunshire.git] / test / symmetric_linear_game_test.py
index 936a7e869283b4fd9ee2e82ddccefa5ef7253658..bba2f7ccfcb48c38312e5d5849aae892d40eac31 100644 (file)
@@ -66,8 +66,7 @@ class SymmetricLinearGameTest(TestCase): # pylint: disable=R0904
         """
         soln = G.solution()
 
-        expected = inner_product(G._L*soln.player1_optimal(),
-                                 soln.player2_optimal())
+        expected = G.payoff(soln.player1_optimal(), soln.player2_optimal())
         self.assert_within_tol(soln.game_value(), expected, G.condition())
 
 
@@ -171,7 +170,7 @@ class SymmetricLinearGameTest(TestCase): # pylint: disable=R0904
 
         # Make sure the same optimal pair works.
         self.assert_within_tol(value2,
-                               inner_product(H._L*x_bar, y_bar),
+                               H.payoff(x_bar, y_bar),
                                H.condition())
 
 
@@ -200,11 +199,11 @@ class SymmetricLinearGameTest(TestCase): # pylint: disable=R0904
         """
         # This is the "correct" representation of ``M``, but
         # COLUMN indexed...
-        M = -G._L.trans()
+        M = -G.L().trans()
 
         # so we have to transpose it when we feed it to the constructor.
         # Note: the condition number of ``H`` should be comparable to ``G``.
-        H = SymmetricLinearGame(M.trans(), G._K, G._e2, G._e1)
+        H = SymmetricLinearGame(M.trans(), G.K(), G.e2(), G.e1())
 
         soln1 = G.solution()
         x_bar = soln1.player1_optimal()
@@ -217,7 +216,7 @@ class SymmetricLinearGameTest(TestCase): # pylint: disable=R0904
 
         # Make sure the switched optimal pair works.
         self.assert_within_tol(soln2.game_value(),
-                               inner_product(M*y_bar, x_bar),
+                               H.payoff(y_bar, x_bar),
                                H.condition())
 
 
@@ -249,10 +248,10 @@ class SymmetricLinearGameTest(TestCase): # pylint: disable=R0904
         y_bar = soln.player2_optimal()
         value = soln.game_value()
 
-        ip1 = inner_product(y_bar, G._L*x_bar - value*G._e1)
+        ip1 = inner_product(y_bar, G.L()*x_bar - value*G.e1())
         self.assert_within_tol(ip1, 0, G.condition())
 
-        ip2 = inner_product(value*G._e2 - G._L.trans()*y_bar, x_bar)
+        ip2 = inner_product(value*G.e2() - G.L().trans()*y_bar, x_bar)
         self.assert_within_tol(ip2, 0, G.condition())
 
 
@@ -298,7 +297,7 @@ class SymmetricLinearGameTest(TestCase): # pylint: disable=R0904
         #
         # See :meth:`assert_within_tol` for an explanation of the
         # fudge factors.
-        eigs = eigenvalues_re(G._L)
+        eigs = eigenvalues_re(G.L())
 
         if soln.game_value() > EPSILON:
             # L should be positive stable