From: Michael Orlitzky Date: Wed, 12 Oct 2016 19:51:39 +0000 (-0400) Subject: Add a test for the value of a positive operator on the nonnegative orthant. X-Git-Tag: 0.1.0~155 X-Git-Url: https://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=1c7a9200a0e65869f46eda49682f76a4f134dccd;p=dunshire.git Add a test for the value of a positive operator on the nonnegative orthant. --- diff --git a/src/dunshire/games.py b/src/dunshire/games.py index 76fbf7d..692a0ae 100644 --- a/src/dunshire/games.py +++ b/src/dunshire/games.py @@ -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)