]> gitweb.michael.orlitzky.com - dunshire.git/commitdiff
Add a test for the value of a positive operator on the nonnegative orthant.
authorMichael Orlitzky <michael@orlitzky.com>
Wed, 12 Oct 2016 19:51:39 +0000 (15:51 -0400)
committerMichael Orlitzky <michael@orlitzky.com>
Wed, 12 Oct 2016 19:51:39 +0000 (15:51 -0400)
src/dunshire/games.py

index 76fbf7deedfec733bf4213bec000bdf449087e75..692a0ae550305c3ae56833d500c263498f070889 100644 (file)
@@ -804,3 +804,21 @@ class SymmetricLinearGameTest(TestCase):
         """
         (L, K, e1, e2) = _random_icecream_params()
         self.assert_orthogonality(L, K, e1, e2)
+
+
+    def test_positive_operator_value(self):
+        """
+        Test that a positive operator on the nonnegative orthant gives
+        rise to a a game with a nonnegative value.
+
+        This test theoretically applies to the ice-cream cone as well,
+        but we don't know how to make positive operators on that cone.
+        """
+        (L, K, e1, e2) = _random_orthant_params()
+
+        # Make the entries of ``L`` nonnegative... this makes it a
+        # positive operator on ``K``.
+        L = [[abs(entry) for entry in row] for row in L]
+
+        game = SymmetricLinearGame(L, K, e1, e2)
+        self.assertTrue(game.solution().game_value() >= -options.ABS_TOL)