X-Git-Url: http://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=src%2Fdunshire%2Fgames.py;fp=src%2Fdunshire%2Fgames.py;h=692a0ae550305c3ae56833d500c263498f070889;hb=1c7a9200a0e65869f46eda49682f76a4f134dccd;hp=76fbf7deedfec733bf4213bec000bdf449087e75;hpb=9da611019b85e58ecab8450f9a9043c6f4a184d1;p=dunshire.git 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)