passagemath-polyhedra 10.6.31rc3__cp314-cp314-musllinux_1_2_x86_64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of passagemath-polyhedra might be problematic. Click here for more details.

Files changed (208) hide show
  1. passagemath_polyhedra-10.6.31rc3.dist-info/METADATA +367 -0
  2. passagemath_polyhedra-10.6.31rc3.dist-info/METADATA.bak +369 -0
  3. passagemath_polyhedra-10.6.31rc3.dist-info/RECORD +208 -0
  4. passagemath_polyhedra-10.6.31rc3.dist-info/WHEEL +5 -0
  5. passagemath_polyhedra-10.6.31rc3.dist-info/top_level.txt +2 -0
  6. passagemath_polyhedra.libs/libgcc_s-0cd532bd.so.1 +0 -0
  7. passagemath_polyhedra.libs/libgmp-0e7fc84e.so.10.5.0 +0 -0
  8. passagemath_polyhedra.libs/libgomp-8949ffbe.so.1.0.0 +0 -0
  9. passagemath_polyhedra.libs/libstdc++-5d72f927.so.6.0.33 +0 -0
  10. sage/all__sagemath_polyhedra.py +50 -0
  11. sage/game_theory/all.py +8 -0
  12. sage/game_theory/catalog.py +6 -0
  13. sage/game_theory/catalog_normal_form_games.py +923 -0
  14. sage/game_theory/cooperative_game.py +844 -0
  15. sage/game_theory/matching_game.py +1181 -0
  16. sage/game_theory/normal_form_game.py +2697 -0
  17. sage/game_theory/parser.py +275 -0
  18. sage/geometry/all__sagemath_polyhedra.py +22 -0
  19. sage/geometry/cone.py +6940 -0
  20. sage/geometry/cone_catalog.py +847 -0
  21. sage/geometry/cone_critical_angles.py +1027 -0
  22. sage/geometry/convex_set.py +1119 -0
  23. sage/geometry/fan.py +3743 -0
  24. sage/geometry/fan_isomorphism.py +389 -0
  25. sage/geometry/fan_morphism.py +1884 -0
  26. sage/geometry/hasse_diagram.py +202 -0
  27. sage/geometry/hyperplane_arrangement/affine_subspace.py +390 -0
  28. sage/geometry/hyperplane_arrangement/all.py +1 -0
  29. sage/geometry/hyperplane_arrangement/arrangement.py +3895 -0
  30. sage/geometry/hyperplane_arrangement/check_freeness.py +145 -0
  31. sage/geometry/hyperplane_arrangement/hyperplane.py +773 -0
  32. sage/geometry/hyperplane_arrangement/library.py +825 -0
  33. sage/geometry/hyperplane_arrangement/ordered_arrangement.py +642 -0
  34. sage/geometry/hyperplane_arrangement/plot.py +520 -0
  35. sage/geometry/integral_points.py +35 -0
  36. sage/geometry/integral_points_generic_dense.cpython-314-x86_64-linux-musl.so +0 -0
  37. sage/geometry/integral_points_generic_dense.pyx +7 -0
  38. sage/geometry/lattice_polytope.py +5894 -0
  39. sage/geometry/linear_expression.py +773 -0
  40. sage/geometry/newton_polygon.py +767 -0
  41. sage/geometry/point_collection.cpython-314-x86_64-linux-musl.so +0 -0
  42. sage/geometry/point_collection.pyx +1008 -0
  43. sage/geometry/polyhedral_complex.py +2616 -0
  44. sage/geometry/polyhedron/all.py +8 -0
  45. sage/geometry/polyhedron/backend_cdd.py +460 -0
  46. sage/geometry/polyhedron/backend_cdd_rdf.py +231 -0
  47. sage/geometry/polyhedron/backend_field.py +347 -0
  48. sage/geometry/polyhedron/backend_normaliz.py +2503 -0
  49. sage/geometry/polyhedron/backend_number_field.py +168 -0
  50. sage/geometry/polyhedron/backend_polymake.py +765 -0
  51. sage/geometry/polyhedron/backend_ppl.py +582 -0
  52. sage/geometry/polyhedron/base.py +1206 -0
  53. sage/geometry/polyhedron/base0.py +1444 -0
  54. sage/geometry/polyhedron/base1.py +886 -0
  55. sage/geometry/polyhedron/base2.py +812 -0
  56. sage/geometry/polyhedron/base3.py +1845 -0
  57. sage/geometry/polyhedron/base4.py +1262 -0
  58. sage/geometry/polyhedron/base5.py +2700 -0
  59. sage/geometry/polyhedron/base6.py +1741 -0
  60. sage/geometry/polyhedron/base7.py +997 -0
  61. sage/geometry/polyhedron/base_QQ.py +1258 -0
  62. sage/geometry/polyhedron/base_RDF.py +98 -0
  63. sage/geometry/polyhedron/base_ZZ.py +934 -0
  64. sage/geometry/polyhedron/base_mutable.py +215 -0
  65. sage/geometry/polyhedron/base_number_field.py +122 -0
  66. sage/geometry/polyhedron/cdd_file_format.py +155 -0
  67. sage/geometry/polyhedron/combinatorial_polyhedron/all.py +1 -0
  68. sage/geometry/polyhedron/combinatorial_polyhedron/base.cpython-314-x86_64-linux-musl.so +0 -0
  69. sage/geometry/polyhedron/combinatorial_polyhedron/base.pxd +76 -0
  70. sage/geometry/polyhedron/combinatorial_polyhedron/base.pyx +3859 -0
  71. sage/geometry/polyhedron/combinatorial_polyhedron/combinatorial_face.cpython-314-x86_64-linux-musl.so +0 -0
  72. sage/geometry/polyhedron/combinatorial_polyhedron/combinatorial_face.pxd +39 -0
  73. sage/geometry/polyhedron/combinatorial_polyhedron/combinatorial_face.pyx +1038 -0
  74. sage/geometry/polyhedron/combinatorial_polyhedron/conversions.cpython-314-x86_64-linux-musl.so +0 -0
  75. sage/geometry/polyhedron/combinatorial_polyhedron/conversions.pxd +9 -0
  76. sage/geometry/polyhedron/combinatorial_polyhedron/conversions.pyx +501 -0
  77. sage/geometry/polyhedron/combinatorial_polyhedron/face_data_structure.pxd +207 -0
  78. sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.cpython-314-x86_64-linux-musl.so +0 -0
  79. sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.pxd +102 -0
  80. sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.pyx +2274 -0
  81. sage/geometry/polyhedron/combinatorial_polyhedron/face_list_data_structure.cpython-314-x86_64-linux-musl.so +0 -0
  82. sage/geometry/polyhedron/combinatorial_polyhedron/face_list_data_structure.pxd +370 -0
  83. sage/geometry/polyhedron/combinatorial_polyhedron/face_list_data_structure.pyx +84 -0
  84. sage/geometry/polyhedron/combinatorial_polyhedron/list_of_faces.cpython-314-x86_64-linux-musl.so +0 -0
  85. sage/geometry/polyhedron/combinatorial_polyhedron/list_of_faces.pxd +31 -0
  86. sage/geometry/polyhedron/combinatorial_polyhedron/list_of_faces.pyx +587 -0
  87. sage/geometry/polyhedron/combinatorial_polyhedron/polyhedron_face_lattice.cpython-314-x86_64-linux-musl.so +0 -0
  88. sage/geometry/polyhedron/combinatorial_polyhedron/polyhedron_face_lattice.pxd +52 -0
  89. sage/geometry/polyhedron/combinatorial_polyhedron/polyhedron_face_lattice.pyx +560 -0
  90. sage/geometry/polyhedron/constructor.py +773 -0
  91. sage/geometry/polyhedron/double_description.py +753 -0
  92. sage/geometry/polyhedron/double_description_inhomogeneous.py +564 -0
  93. sage/geometry/polyhedron/face.py +1060 -0
  94. sage/geometry/polyhedron/generating_function.py +1810 -0
  95. sage/geometry/polyhedron/lattice_euclidean_group_element.py +178 -0
  96. sage/geometry/polyhedron/library.py +3502 -0
  97. sage/geometry/polyhedron/misc.py +121 -0
  98. sage/geometry/polyhedron/modules/all.py +1 -0
  99. sage/geometry/polyhedron/modules/formal_polyhedra_module.py +155 -0
  100. sage/geometry/polyhedron/palp_database.py +447 -0
  101. sage/geometry/polyhedron/parent.py +1279 -0
  102. sage/geometry/polyhedron/plot.py +1986 -0
  103. sage/geometry/polyhedron/ppl_lattice_polygon.py +556 -0
  104. sage/geometry/polyhedron/ppl_lattice_polytope.py +1257 -0
  105. sage/geometry/polyhedron/representation.py +1723 -0
  106. sage/geometry/pseudolines.py +515 -0
  107. sage/geometry/relative_interior.py +445 -0
  108. sage/geometry/toric_plotter.py +1103 -0
  109. sage/geometry/triangulation/all.py +2 -0
  110. sage/geometry/triangulation/base.cpython-314-x86_64-linux-musl.so +0 -0
  111. sage/geometry/triangulation/base.pyx +963 -0
  112. sage/geometry/triangulation/data.h +147 -0
  113. sage/geometry/triangulation/data.pxd +4 -0
  114. sage/geometry/triangulation/element.py +914 -0
  115. sage/geometry/triangulation/functions.h +10 -0
  116. sage/geometry/triangulation/functions.pxd +4 -0
  117. sage/geometry/triangulation/point_configuration.py +2256 -0
  118. sage/geometry/triangulation/triangulations.h +49 -0
  119. sage/geometry/triangulation/triangulations.pxd +7 -0
  120. sage/geometry/voronoi_diagram.py +319 -0
  121. sage/interfaces/all__sagemath_polyhedra.py +1 -0
  122. sage/interfaces/polymake.py +2028 -0
  123. sage/numerical/all.py +13 -0
  124. sage/numerical/all__sagemath_polyhedra.py +11 -0
  125. sage/numerical/backends/all.py +1 -0
  126. sage/numerical/backends/all__sagemath_polyhedra.py +1 -0
  127. sage/numerical/backends/cvxopt_backend.cpython-314-x86_64-linux-musl.so +0 -0
  128. sage/numerical/backends/cvxopt_backend.pyx +1006 -0
  129. sage/numerical/backends/cvxopt_backend_test.py +19 -0
  130. sage/numerical/backends/cvxopt_sdp_backend.cpython-314-x86_64-linux-musl.so +0 -0
  131. sage/numerical/backends/cvxopt_sdp_backend.pyx +382 -0
  132. sage/numerical/backends/cvxpy_backend.cpython-314-x86_64-linux-musl.so +0 -0
  133. sage/numerical/backends/cvxpy_backend.pxd +41 -0
  134. sage/numerical/backends/cvxpy_backend.pyx +934 -0
  135. sage/numerical/backends/cvxpy_backend_test.py +13 -0
  136. sage/numerical/backends/generic_backend_test.py +24 -0
  137. sage/numerical/backends/interactivelp_backend.cpython-314-x86_64-linux-musl.so +0 -0
  138. sage/numerical/backends/interactivelp_backend.pxd +36 -0
  139. sage/numerical/backends/interactivelp_backend.pyx +1231 -0
  140. sage/numerical/backends/interactivelp_backend_test.py +12 -0
  141. sage/numerical/backends/logging_backend.py +391 -0
  142. sage/numerical/backends/matrix_sdp_backend.cpython-314-x86_64-linux-musl.so +0 -0
  143. sage/numerical/backends/matrix_sdp_backend.pxd +15 -0
  144. sage/numerical/backends/matrix_sdp_backend.pyx +478 -0
  145. sage/numerical/backends/ppl_backend.cpython-314-x86_64-linux-musl.so +0 -0
  146. sage/numerical/backends/ppl_backend.pyx +1126 -0
  147. sage/numerical/backends/ppl_backend_test.py +13 -0
  148. sage/numerical/backends/scip_backend.cpython-314-x86_64-linux-musl.so +0 -0
  149. sage/numerical/backends/scip_backend.pxd +22 -0
  150. sage/numerical/backends/scip_backend.pyx +1289 -0
  151. sage/numerical/backends/scip_backend_test.py +13 -0
  152. sage/numerical/interactive_simplex_method.py +5338 -0
  153. sage/numerical/knapsack.py +665 -0
  154. sage/numerical/linear_functions.cpython-314-x86_64-linux-musl.so +0 -0
  155. sage/numerical/linear_functions.pxd +31 -0
  156. sage/numerical/linear_functions.pyx +1648 -0
  157. sage/numerical/linear_tensor.py +470 -0
  158. sage/numerical/linear_tensor_constraints.py +448 -0
  159. sage/numerical/linear_tensor_element.cpython-314-x86_64-linux-musl.so +0 -0
  160. sage/numerical/linear_tensor_element.pxd +6 -0
  161. sage/numerical/linear_tensor_element.pyx +459 -0
  162. sage/numerical/mip.cpython-314-x86_64-linux-musl.so +0 -0
  163. sage/numerical/mip.pxd +40 -0
  164. sage/numerical/mip.pyx +3667 -0
  165. sage/numerical/sdp.cpython-314-x86_64-linux-musl.so +0 -0
  166. sage/numerical/sdp.pxd +39 -0
  167. sage/numerical/sdp.pyx +1433 -0
  168. sage/rings/all__sagemath_polyhedra.py +3 -0
  169. sage/rings/polynomial/all__sagemath_polyhedra.py +10 -0
  170. sage/rings/polynomial/omega.py +982 -0
  171. sage/schemes/all__sagemath_polyhedra.py +2 -0
  172. sage/schemes/toric/all.py +10 -0
  173. sage/schemes/toric/chow_group.py +1248 -0
  174. sage/schemes/toric/divisor.py +2082 -0
  175. sage/schemes/toric/divisor_class.cpython-314-x86_64-linux-musl.so +0 -0
  176. sage/schemes/toric/divisor_class.pyx +322 -0
  177. sage/schemes/toric/fano_variety.py +1606 -0
  178. sage/schemes/toric/homset.py +650 -0
  179. sage/schemes/toric/ideal.py +451 -0
  180. sage/schemes/toric/library.py +1322 -0
  181. sage/schemes/toric/morphism.py +1958 -0
  182. sage/schemes/toric/points.py +1032 -0
  183. sage/schemes/toric/sheaf/all.py +1 -0
  184. sage/schemes/toric/sheaf/constructor.py +302 -0
  185. sage/schemes/toric/sheaf/klyachko.py +921 -0
  186. sage/schemes/toric/toric_subscheme.py +905 -0
  187. sage/schemes/toric/variety.py +3460 -0
  188. sage/schemes/toric/weierstrass.py +1078 -0
  189. sage/schemes/toric/weierstrass_covering.py +457 -0
  190. sage/schemes/toric/weierstrass_higher.py +288 -0
  191. sage_wheels/share/reflexive_polytopes/Full2d/zzdb.info +10 -0
  192. sage_wheels/share/reflexive_polytopes/Full2d/zzdb.v03 +0 -0
  193. sage_wheels/share/reflexive_polytopes/Full2d/zzdb.v04 +0 -0
  194. sage_wheels/share/reflexive_polytopes/Full2d/zzdb.v05 +1 -0
  195. sage_wheels/share/reflexive_polytopes/Full2d/zzdb.v06 +1 -0
  196. sage_wheels/share/reflexive_polytopes/Full3d/zzdb.info +22 -0
  197. sage_wheels/share/reflexive_polytopes/Full3d/zzdb.v04 +0 -0
  198. sage_wheels/share/reflexive_polytopes/Full3d/zzdb.v05 +0 -0
  199. sage_wheels/share/reflexive_polytopes/Full3d/zzdb.v06 +0 -0
  200. sage_wheels/share/reflexive_polytopes/Full3d/zzdb.v07 +0 -0
  201. sage_wheels/share/reflexive_polytopes/Full3d/zzdb.v08 +0 -0
  202. sage_wheels/share/reflexive_polytopes/Full3d/zzdb.v09 +0 -0
  203. sage_wheels/share/reflexive_polytopes/Full3d/zzdb.v10 +0 -0
  204. sage_wheels/share/reflexive_polytopes/Full3d/zzdb.v11 +1 -0
  205. sage_wheels/share/reflexive_polytopes/Full3d/zzdb.v12 +1 -0
  206. sage_wheels/share/reflexive_polytopes/Full3d/zzdb.v13 +1 -0
  207. sage_wheels/share/reflexive_polytopes/reflexive_polytopes_2d +80 -0
  208. sage_wheels/share/reflexive_polytopes/reflexive_polytopes_3d +37977 -0
@@ -0,0 +1,275 @@
1
+ # sage_setup: distribution = sagemath-polyhedra
2
+ """
3
+ Parser For gambit And lrs Nash Equilibria
4
+ """
5
+ # ****************************************************************************
6
+ # Copyright (C) 2014 James Campbell james.campbell@tanti.org.uk
7
+ # 2015 Vincent Knight
8
+ #
9
+ # This program is free software: you can redistribute it and/or modify
10
+ # it under the terms of the GNU General Public License as published by
11
+ # the Free Software Foundation, either version 2 of the License, or
12
+ # (at your option) any later version.
13
+ # https://www.gnu.org/licenses/
14
+ # ****************************************************************************
15
+
16
+
17
+ class Parser:
18
+ r"""
19
+ A class for parsing the outputs of different algorithms called in other
20
+ software packages.
21
+
22
+ Two parsers are included, one for the ``'lrs'`` algorithm and another for
23
+ the ``'LCP'`` algorithm.
24
+ """
25
+
26
+ def __init__(self, raw_string):
27
+ """
28
+ Initialise a Parser instance by storing a ``raw_string``
29
+ (currently only used with H representation of a game).
30
+
31
+ EXAMPLES::
32
+
33
+ sage: from sage.cpython.string import bytes_to_str
34
+ sage: from sage.game_theory.parser import Parser
35
+ sage: from subprocess import Popen, PIPE
36
+ sage: A = matrix([[1]])
37
+ sage: B = matrix([[5]])
38
+ sage: g = NormalFormGame([A,B])
39
+ sage: game_str = g._lrs_nash_format(A, B)
40
+ sage: game_name = tmp_filename()
41
+ sage: with open(game_name, 'w') as game_file:
42
+ ....: _ = game_file.write(game_str)
43
+ sage: from sage.features.lrs import LrsNash
44
+ sage: process = Popen([LrsNash().absolute_filename(), game_name], # optional - lrslib
45
+ ....: stdout=PIPE, stderr=PIPE)
46
+ sage: lrs_output = [bytes_to_str(row) for row in process.stdout] # optional - lrslib
47
+ sage: Parser(lrs_output).format_lrs() # optional - lrslib
48
+ [[(1,), (1,)]]
49
+
50
+ This class is also used to parse the output of algorithms from
51
+ the gambit python interface using :meth:`format_gambit()`.
52
+ """
53
+ self.raw_string = raw_string
54
+
55
+ def format_lrs(self):
56
+ r"""
57
+ Parses the output of lrs so as to return vectors
58
+ corresponding to equilibria.
59
+
60
+ TESTS::
61
+
62
+ sage: from sage.cpython.string import bytes_to_str
63
+ sage: from sage.game_theory.parser import Parser
64
+ sage: from subprocess import Popen, PIPE
65
+ sage: A = matrix([[1, 2], [3, 2]])
66
+ sage: g = NormalFormGame([A])
67
+ sage: game_str = g._lrs_nash_format(A, -A)
68
+ sage: game_name = tmp_filename()
69
+ sage: with open(game_name, 'w') as game_file:
70
+ ....: _ = game_file.write(game_str)
71
+ sage: from sage.features.lrs import LrsNash
72
+ sage: process = Popen([LrsNash().absolute_filename(), game_name], # optional - lrslib
73
+ ....: stdout=PIPE, stderr=PIPE)
74
+ sage: lrs_output = [bytes_to_str(row) for row in process.stdout] # optional - lrslib
75
+
76
+ The above creates a game, writes the H representations to
77
+ temporary files, calls lrs and stores the output in ``lrs_output``
78
+ (ignoring some system parameters that get returned)::
79
+
80
+ sage: lrs_output # optional - lrslib
81
+ [...,
82
+ '2 0 1 2 \n',
83
+ '1 1/2 1/2 -2 \n',
84
+ '\n',
85
+ '2 0 1 2 \n',
86
+ '1 0 1 -2 \n',
87
+ '\n',
88
+ '*Number of equilibria found: 2\n',
89
+ '*Player 1: vertices=3 bases=3 pivots=5\n',
90
+ '*Player 2: vertices=2 bases=1 pivots=6\n',
91
+ '\n',...]
92
+
93
+ The above is pretty messy, here is the output when we put it through
94
+ the parser::
95
+
96
+ sage: nasheq = Parser(lrs_output).format_lrs() # optional - lrslib
97
+ sage: nasheq # optional - lrslib
98
+ [[(1/2, 1/2), (0, 1)], [(0, 1), (0, 1)]]
99
+
100
+ Another game::
101
+
102
+ sage: A = matrix([[-7, -5, 5],
103
+ ....: [5, 5, 3],
104
+ ....: [1, -6, 1]])
105
+ sage: B = matrix([[-9, 7, 9],
106
+ ....: [6, -2, -3],
107
+ ....: [-4, 6, -10]])
108
+ sage: g = NormalFormGame([A, B])
109
+ sage: game_str = g._lrs_nash_format(A, B)
110
+ sage: game_name = tmp_filename()
111
+ sage: with open(game_name, 'w') as game_file:
112
+ ....: _ = game_file.write(game_str)
113
+ sage: from sage.features.lrs import LrsNash
114
+ sage: process = Popen([LrsNash().absolute_filename(), game_name], # optional - lrslib
115
+ ....: stdout=PIPE, stderr=PIPE)
116
+ sage: lrs_output = [bytes_to_str(row) for row in process.stdout] # optional - lrslib
117
+ sage: print(lrs_output) # optional - lrslib
118
+ [...,
119
+ '2 0 1/6 5/6 10/3 \n',
120
+ '2 1/7 0 6/7 23/7 \n',
121
+ '1 1/3 2/3 0 1 \n',
122
+ '\n',
123
+ '2 0 0 1 5 \n',
124
+ '1 1 0 0 9 \n',
125
+ '\n',
126
+ '2 1 0 0 5 \n',
127
+ '1 0 1 0 6 \n',
128
+ '\n',
129
+ '*Number of equilibria found: 4\n',
130
+ '*Player 1: vertices=6 bases=7 pivots=10\n',
131
+ '*Player 2: vertices=4 bases=2 pivots=14\n',
132
+ '\n',...]
133
+
134
+ sage: nasheq = Parser(lrs_output).format_lrs() # optional - lrslib
135
+ sage: sorted(nasheq) # optional - lrslib
136
+ [[(0, 1, 0), (1, 0, 0)],
137
+ [(1/3, 2/3, 0), (0, 1/6, 5/6)],
138
+ [(1/3, 2/3, 0), (1/7, 0, 6/7)],
139
+ [(1, 0, 0), (0, 0, 1)]]
140
+
141
+ The former legacy format has been removed in :issue:`39464`.
142
+ """
143
+ equilibria = []
144
+ from sage.misc.sage_eval import sage_eval
145
+ from itertools import groupby, dropwhile
146
+ lines = iter(self.raw_string)
147
+ # Skip comment lines starting with a single star
148
+ lines = dropwhile(lambda line: line.startswith('*'), lines)
149
+ for collection in [list(x[1]) for x in groupby(lines, lambda x: x == '\n')]:
150
+ if collection[0].startswith('2'):
151
+ s1 = tuple([sage_eval(k) for k in collection[-1].split()][1:-1])
152
+ for s2 in collection[:-1]:
153
+ s2 = tuple([sage_eval(k) for k in s2.split()][1:-1])
154
+ equilibria.append([s1, s2])
155
+
156
+ return equilibria
157
+
158
+ def format_gambit(self, gambit_game):
159
+ r"""
160
+ Parses the output of gambit so as to return vectors
161
+ corresponding to equilibria obtained using the LCP algorithm.
162
+
163
+ TESTS:
164
+
165
+ Here we construct a two by two game in gambit::
166
+
167
+ sage: # optional - gambit
168
+ sage: import gambit
169
+ sage: from sage.game_theory.parser import Parser
170
+ sage: g = gambit.Game.new_table([2,2])
171
+ sage: g[int(0), int(0)][int(0)] = int(2)
172
+ sage: g[int(0), int(0)][int(1)] = int(1)
173
+ sage: g[int(0), int(1)][int(0)] = int(0)
174
+ sage: g[int(0), int(1)][int(1)] = int(0)
175
+ sage: g[int(1), int(0)][int(0)] = int(0)
176
+ sage: g[int(1), int(0)][int(1)] = int(0)
177
+ sage: g[int(1), int(1)][int(0)] = int(1)
178
+ sage: g[int(1), int(1)][int(1)] = int(2)
179
+ sage: solver = gambit.nash.ExternalLCPSolver()
180
+
181
+ Here is the output of the LCP algorithm::
182
+
183
+ sage: LCP_output = solver.solve(g) # optional - gambit
184
+ sage: LCP_output # optional - gambit
185
+ [<NashProfile for '': [[1.0, 0.0], [1.0, 0.0]]>,
186
+ <NashProfile for '': [[0.6666666667, 0.3333333333], [0.3333333333, 0.6666666667]]>,
187
+ <NashProfile for '': [[0.0, 1.0], [0.0, 1.0]]>]
188
+
189
+ The Parser class outputs the equilibrium::
190
+
191
+ sage: nasheq = Parser(LCP_output).format_gambit(g) # optional - gambit
192
+ sage: nasheq # optional - gambit
193
+ [[(1.0, 0.0), (1.0, 0.0)],
194
+ [(0.6666666667, 0.3333333333), (0.3333333333, 0.6666666667)],
195
+ [(0.0, 1.0), (0.0, 1.0)]]
196
+
197
+ Here is another game::
198
+
199
+ sage: # optional - gambit
200
+ sage: g = gambit.Game.new_table([2,2])
201
+ sage: g[int(0), int(0)][int(0)] = int(4)
202
+ sage: g[int(0), int(0)][int(1)] = int(8)
203
+ sage: g[int(0), int(1)][int(0)] = int(0)
204
+ sage: g[int(0), int(1)][int(1)] = int(1)
205
+ sage: g[int(1), int(0)][int(0)] = int(1)
206
+ sage: g[int(1), int(0)][int(1)] = int(3)
207
+ sage: g[int(1), int(1)][int(0)] = int(1)
208
+ sage: g[int(1), int(1)][int(1)] = int(0)
209
+ sage: solver = gambit.nash.ExternalLCPSolver()
210
+
211
+ Here is the LCP output::
212
+
213
+ sage: LCP_output = solver.solve(g) # optional - gambit
214
+ sage: LCP_output # optional - gambit
215
+ [<NashProfile for '': [[1.0, 0.0], [1.0, 0.0]]>]
216
+
217
+ The corresponding parsed equilibrium::
218
+
219
+ sage: nasheq = Parser(LCP_output).format_gambit(g) # optional - gambit
220
+ sage: nasheq # optional - gambit
221
+ [[(1.0, 0.0), (1.0, 0.0)]]
222
+
223
+ Here is a larger degenerate game::
224
+
225
+ sage: # optional - gambit
226
+ sage: g = gambit.Game.new_table([3,3])
227
+ sage: g[int(0), int(0)][int(0)] = int(-7)
228
+ sage: g[int(0), int(0)][int(1)] = int(-9)
229
+ sage: g[int(0), int(1)][int(0)] = int(-5)
230
+ sage: g[int(0), int(1)][int(1)] = int(7)
231
+ sage: g[int(0), int(2)][int(0)] = int(5)
232
+ sage: g[int(0), int(2)][int(1)] = int(9)
233
+ sage: g[int(1), int(0)][int(0)] = int(5)
234
+ sage: g[int(1), int(0)][int(1)] = int(6)
235
+ sage: g[int(1), int(1)][int(0)] = int(5)
236
+ sage: g[int(1), int(1)][int(1)] = int(-2)
237
+ sage: g[int(1), int(2)][int(0)] = int(3)
238
+ sage: g[int(1), int(2)][int(1)] = int(-3)
239
+ sage: g[int(2), int(0)][int(0)] = int(1)
240
+ sage: g[int(2), int(0)][int(1)] = int(-4)
241
+ sage: g[int(2), int(1)][int(0)] = int(-6)
242
+ sage: g[int(2), int(1)][int(1)] = int(6)
243
+ sage: g[int(2), int(2)][int(0)] = int(1)
244
+ sage: g[int(2), int(2)][int(1)] = int(-10)
245
+ sage: solver = gambit.nash.ExternalLCPSolver()
246
+
247
+ Here is the LCP output::
248
+
249
+ sage: LCP_output = solver.solve(g) # optional - gambit
250
+ sage: LCP_output # optional - gambit
251
+ [<NashProfile for '': [[1.0, 0.0, 0.0], [0.0, 0.0, 1.0]]>,
252
+ <NashProfile for '': [[0.3333333333, 0.6666666667, 0.0], [0.1428571429, 0.0, 0.8571428571]]>,
253
+ <NashProfile for '': [[0.0, 1.0, 0.0], [1.0, 0.0, 0.0]]>]
254
+
255
+ The corresponding parsed equilibrium::
256
+
257
+ sage: nasheq = Parser(LCP_output).format_gambit(g) # optional - gambit
258
+ sage: nasheq # optional - gambit
259
+ [[(1.0, 0.0, 0.0), (0.0, 0.0, 1.0)],
260
+ [(0.3333333333, 0.6666666667, 0.0), (0.1428571429, 0.0, 0.8571428571)],
261
+ [(0.0, 1.0, 0.0), (1.0, 0.0, 0.0)]]
262
+
263
+ Note, that this differs from the same output of the lrs algorithm due
264
+ the fact that the game is degenerate.
265
+ """
266
+ nice_stuff = []
267
+ for gambitstrategy in self.raw_string:
268
+ gambitstrategy = list(gambitstrategy)
269
+ profile = [tuple(gambitstrategy[:len(gambit_game.players[0].strategies)])]
270
+ for player in list(gambit_game.players)[1:]:
271
+ previousplayerstrategylength = len(profile[-1])
272
+ profile.append(tuple(gambitstrategy[previousplayerstrategylength: previousplayerstrategylength + len(player.strategies)]))
273
+ nice_stuff.append(profile)
274
+
275
+ return nice_stuff
@@ -0,0 +1,22 @@
1
+ # sage_setup: distribution = sagemath-polyhedra
2
+ from sage.geometry.all__sagemath_modules import *
3
+
4
+ from sage.geometry.polyhedron.all import *
5
+ from sage.misc.lazy_import import lazy_import
6
+
7
+ lazy_import('sage.geometry.polyhedral_complex', 'PolyhedralComplex')
8
+ lazy_import('sage.geometry.cone', ['Cone', 'random_cone'])
9
+ lazy_import('sage.geometry', 'cone_catalog', 'cones')
10
+ lazy_import('sage.geometry.fan', ['Fan', 'FaceFan', 'NormalFan', 'Fan2d'])
11
+ lazy_import('sage.geometry.fan_morphism', 'FanMorphism')
12
+ lazy_import('sage.geometry.lattice_polytope',
13
+ ['LatticePolytope', 'NefPartition',
14
+ 'ReflexivePolytope', 'ReflexivePolytopes'])
15
+ lazy_import('sage.geometry', 'lattice_polytope')
16
+ lazy_import('sage.geometry', 'toric_plotter')
17
+ lazy_import('sage.geometry.voronoi_diagram', 'VoronoiDiagram')
18
+ lazy_import('sage.geometry.hyperplane_arrangement.arrangement',
19
+ 'HyperplaneArrangements')
20
+ lazy_import('sage.geometry.hyperplane_arrangement.ordered_arrangement', 'OrderedHyperplaneArrangements')
21
+ lazy_import('sage.geometry.hyperplane_arrangement.library', 'hyperplane_arrangements')
22
+ del lazy_import