# These are mostly actually needed.
from cvxopt import matrix, printing, solvers
-from cones import CartesianProduct, IceCream, NonnegativeOrthant
-from errors import GameUnsolvableException
-from matrices import (append_col, append_row, eigenvalues_re, identity,
- inner_product, norm)
-import options
+from .cones import CartesianProduct, IceCream, NonnegativeOrthant
+from .errors import GameUnsolvableException
+from .matrices import (append_col, append_row, eigenvalues_re, identity,
+ inner_product, norm)
+from . import options
printing.options['dformat'] = options.FLOAT_FORMAT
solvers.options['show_progress'] = options.VERBOSE
Examples
--------
- >>> from cones import NonnegativeOrthant
>>> K = NonnegativeOrthant(3)
>>> L = [[1,-5,-15],[-1,2,-3],[-12,-15,1]]
>>> e1 = [1,1,1]
Lists can (and probably should) be used for every argument::
- >>> from cones import NonnegativeOrthant
>>> K = NonnegativeOrthant(2)
>>> L = [[1,0],[0,1]]
>>> e1 = [1,1]
>>> import cvxopt
>>> import numpy
- >>> from cones import NonnegativeOrthant
>>> K = NonnegativeOrthant(2)
>>> L = [[1,0],[0,1]]
>>> e1 = cvxopt.matrix([1,1])
otherwise indexed by columns::
>>> import cvxopt
- >>> from cones import NonnegativeOrthant
>>> K = NonnegativeOrthant(2)
>>> L = [[1,2],[3,4]]
>>> e1 = [1,1]
This example is computed in Gowda and Ravindran in the section
"The value of a Z-transformation"::
- >>> from cones import NonnegativeOrthant
>>> K = NonnegativeOrthant(3)
>>> L = [[1,-5,-15],[-1,2,-3],[-12,-15,1]]
>>> e1 = [1,1,1]
The value of the following game can be computed using the fact
that the identity is invertible::
- >>> from cones import NonnegativeOrthant
>>> K = NonnegativeOrthant(3)
>>> L = [[1,0,0],[0,1,0],[0,0,1]]
>>> e1 = [1,2,3]
Examples
--------
- >>> from cones import NonnegativeOrthant
>>> K = NonnegativeOrthant(3)
>>> L = [[1,-5,-15],[-1,2,-3],[-12,-15,1]]
>>> e1 = [1,1,1]
return (L, K, matrix(e1), matrix(e2))
-class SymmetricLinearGameTest(TestCase):
+# Tell pylint to shut up about the large number of methods.
+class SymmetricLinearGameTest(TestCase): # pylint: disable=R0904
"""
Tests for the SymmetricLinearGame and Solution classes.
"""
This test theoretically applies to the ice-cream cone as well,
but we don't know how to make positive operators on that cone.
"""
- (_, K, e1, e2) = _random_orthant_params()
-
- # Ignore that L, we need a nonnegative one.
+ (K, e1, e2) = _random_orthant_params()[1:]
L = _random_nonnegative_matrix(K.dimension())
game = SymmetricLinearGame(L, K, e1, e2)
"""
Test that a Lyapunov game on the nonnegative orthant works.
"""
- (L, K, e1, e2) = _random_orthant_params()
-
- # Ignore that L, we need a diagonal (Lyapunov-like) one.
- # (And we don't need to transpose those.)
+ (K, e1, e2) = _random_orthant_params()[1:]
L = _random_diagonal_matrix(K.dimension())
self.assert_lyapunov_works(L, K, e1, e2)
"""
Test that a Lyapunov game on the ice-cream cone works.
"""
- (L, K, e1, e2) = _random_icecream_params()
-
- # Ignore that L, we need a diagonal (Lyapunov-like) one.
- # (And we don't need to transpose those.)
+ (K, e1, e2) = _random_icecream_params()[1:]
L = _random_lyapunov_like_icecream(K.dimension())
self.assert_lyapunov_works(L, K, e1, e2)