From 1c7a9200a0e65869f46eda49682f76a4f134dccd Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 12 Oct 2016 15:51:39 -0400 Subject: [PATCH] Add a test for the value of a positive operator on the nonnegative orthant. --- src/dunshire/games.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) 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) -- 2.43.2