Skip to content

Commit ec38b7a

Browse files
put the doc in the correct place NE
1 parent 42ad089 commit ec38b7a

File tree

1 file changed

+156
-153
lines changed

1 file changed

+156
-153
lines changed

GameTheory/trial.m2

Lines changed: 156 additions & 153 deletions
Original file line numberDiff line numberDiff line change
@@ -373,159 +373,6 @@ maxNumberEquilibria List := d -> (
373373
mv
374374
)
375375

376-
beginDocumentation()
377-
378-
doc ///
379-
Node
380-
Key
381-
GameTheory
382-
Headline
383-
a Package
384-
Description
385-
Text
386-
Computations in game theory.
387-
Caveat
388-
Nothing here yet.
389-
Subnodes
390-
"Ideals of Nash equilibria"
391-
Node
392-
Key
393-
"Ideals of Nash equilibria"
394-
Headline
395-
computing the ideal of a totally mixed Nash equilibria
396-
Description
397-
Text
398-
This package provides methods for constructing the mixed probability polynomial rings and computing the Nash equilibrium polynomials and ideals, as well as the max number of isolated totally mixed Nash Equilibra via polyhedral methods. It depends on the Polyhedra package. An introduction together with the relevant definitions is given in Chapter 6, Sturmfels, Bernd, @EM "Solving Systems of Polynomial Equations"@. American Mathematical Society, 2002. ISBN 978-0-8218-3251-6.
399-
Text
400-
This package uses the following functions in the @TO Polyhedra@ package:
401-
Text
402-
@UL {
403-
{TO convexHull},
404-
{TO directProduct},
405-
{TO mixedVolume},
406-
{TO simplex},
407-
}@
408-
Subnodes
409-
nashEquilibriumRing
410-
nashEquilibriumIdeal
411-
maxNumberEquilibria
412-
Node
413-
Key
414-
(nashEquilibriumRing, List)
415-
nashEquilibriumRing
416-
Headline
417-
make the Nash Equilibrium ring
418-
Usage
419-
nashEquilibriumRing L
420-
Inputs
421-
L:List
422-
a list of n-@TO Tensor@s with uniform dimensions
423-
Outputs
424-
:Ring
425-
a polynomial ring generated from the mixed probabilities
426-
Description
427-
Text
428-
An $n$-player game consists of players labeled with $0,1,\cdots, n-1$. The $i$-th player can choose from $d_i$ pure strategies. Let $p_{i,j}$ be the probablility of the $i$-th player choosing the $j$-the strategy, where $j=0,\cdots, d_j-1$. The ideal of the totally mixed Nash equilibria of the game is defined in the polynomial ring over a field $k$ with generators $\{p_{i,j}:0\leq i\leq n-1, 0\leq j\leq d_j-1\}$.
429-
430-
This method computes this ring over $k=\mathbb{Q}$ from a list of tensors representing the payoff matrices of all the $n$ players. The ring generators are ordered lexicographically.
431-
Example
432-
tensors = apply(3, i -> randomTensor {2,4,3})
433-
R = nashEquilibriumRing tensors
434-
baseRing R
435-
gens R
436-
Node
437-
Key
438-
(nashEquilibriumIdeal, Ring, List)
439-
nashEquilibriumIdeal
440-
Headline
441-
make the Nash Equilibrium ideal
442-
Usage
443-
nashEquilibriumIdeal(R, L)
444-
Inputs
445-
R:Ring
446-
the Nash Equilibrium ring. Typically obtained via @TO nashEquilibriumRing@
447-
L:List
448-
a list of payoff tensors
449-
Outputs
450-
:Ideal
451-
An ideal in the Nash Equilibrium ring R generated by the Nash equilibrium polynomials, along with the linear relations of those probabilities variables, that the probabilities of each players sum to 1
452-
Description
453-
Text
454-
For an $n$-player game, the totally mixed Nash equilibria are the zero loci in the interior of the polytope of a system of polynomials in the variables $\{p_{i,j}:0\leq i\leq n-1, 0\leq j\leq d_j-1\}$. The coefficients of these polynomials are differences of the entries of the payoff matrices. From an algebraic-geometric point of view, these polynomials, together with the linear constraints that $\sum_j p_{i,j}=1$ for each $i$, generate an ideal in the polynomial ring computed by @TO nashEquilibriumRing@.
455-
456-
This method computes this Nash equilibrium ideal by generating the polynomials from the payoff matrices first, and appending the linear relations that the sum of probabilities for each player is one.
457-
Example
458-
tensors = apply(3, i -> randomTensor {2,2,2})
459-
R = nashEquilibriumRing tensors
460-
gens R
461-
I = nashEquilibriumIdeal(R, tensors)
462-
Text
463-
Here the embient ring $R$ is explicitly computed before finding the ideal $I$. Alternatively, one can assign both the ring and the ideal to variables in the same line:
464-
Example
465-
I2 = nashEquilibriumIdeal(R2 = nashEquilibriumRing tensors, tensors)
466-
gens R2
467-
Node
468-
Key
469-
(maxNumberEquilibria, List)
470-
maxNumberEquilibria
471-
Headline
472-
compute the maximum number of totally mixed Nash equilibria
473-
Usage
474-
maxNumberEquilibria L
475-
Inputs
476-
L:List
477-
a list of integers representing the dimensions of the game
478-
Outputs
479-
:ZZ
480-
an integer value, the mixed volume, representing the maximum number of totally mixed Nash equilibria
481-
Description
482-
Text
483-
For an $n$-player game where the $i$-th player has $d_i$ pure strategies, the maximum number of isolated totally mixed Nash equilibria is given by the mixed volume of the following list of polytopes:
484-
485-
\[ (\Delta^{(0)}, \cdots, \Delta^{(0)},\Delta^{(1)}, \cdots, \Delta^{(1)}, \cdots, \Delta^{(n-1)}, \cdots, \Delta^{(n-1)}),\]
486-
487-
where each $\Delta^{(i)}$ repeats $d_i - 1 $ times, and is defined by the direct product of simplices
488-
489-
\[ \Delta^{(i)} := \Delta_{d_1-1}\times \Delta_{d_2-1} \times \cdots \Delta_{d_{i-2}-1} \times \{0\} \times \Delta_{d_{i}-1} \times \cdots \times \Delta^{d_{i-1}-1}).\]
490-
491-
This function first generates a tuple of delta polytopes from d, computes their mixed volume, prints a summary message, and returns the mixed volume. The mixed volume is computed via the function @TO mixedVolume@ in the @TO polyhedra@ package. This function currently runs very slow for higher dimension and requires improvement.
492-
Example
493-
d = {2,2,2}
494-
mv = maxNumberEquilibria d
495-
Text
496-
Alternatively, if you have a tensor $T$, you can compute its maximum number as follows:
497-
Example
498-
T = randomTensor {2,2,2}
499-
mv2 = maxNumberEquilibria format T
500-
Node
501-
Key
502-
Tensor
503-
Headline
504-
representing the payoff matrices
505-
///
506-
507-
TEST ///
508-
-- Test nashEquilibriumRing with a list of tensors
509-
tensorList = apply(3, i -> randomTensor {2,2,2})
510-
R5 = nashEquilibriumRing tensorList
511-
assert(numgens R5 > 0)
512-
513-
-- Test nashEquilibriumIdeal construction
514-
I = nashEquilibriumIdeal(R5, tensorList)
515-
assert(isIdeal I)
516-
517-
-- Test maxNumberEquilibria (prints and returns the mixed volume)
518-
mv = maxNumberEquilibria {2,2,2}
519-
assert(mv == 2)
520-
521-
-- Test maxNumberEquilibria using a tensor's format
522-
T2 = randomTensor {2,2,2}
523-
mv2 = maxNumberEquilibria format T2
524-
assert(mv2 == 2)
525-
///
526-
527-
end--
528-
529376

530377

531378
--***************************************--
@@ -921,6 +768,140 @@ doc ///
921768
assemblePlayeriPolynomials
922769
///
923770

771+
----------------------------------------
772+
-- Documentation NashEquilibriumIdeal --
773+
----------------------------------------
774+
775+
beginDocumentation()
776+
777+
doc ///
778+
Node
779+
Key
780+
GameTheory
781+
Headline
782+
a Package
783+
Description
784+
Text
785+
Computations in game theory.
786+
Caveat
787+
Nothing here yet.
788+
Subnodes
789+
"Ideals of Nash equilibria"
790+
Node
791+
Key
792+
"Ideals of Nash equilibria"
793+
Headline
794+
computing the ideal of a totally mixed Nash equilibria
795+
Description
796+
Text
797+
This package provides methods for constructing the mixed probability polynomial rings and computing the Nash equilibrium polynomials and ideals, as well as the max number of isolated totally mixed Nash Equilibra via polyhedral methods. It depends on the Polyhedra package. An introduction together with the relevant definitions is given in Chapter 6, Sturmfels, Bernd, @EM "Solving Systems of Polynomial Equations"@. American Mathematical Society, 2002. ISBN 978-0-8218-3251-6.
798+
Text
799+
This package uses the following functions in the @TO Polyhedra@ package:
800+
Text
801+
@UL {
802+
{TO convexHull},
803+
{TO directProduct},
804+
{TO mixedVolume},
805+
{TO simplex},
806+
}@
807+
Subnodes
808+
nashEquilibriumRing
809+
nashEquilibriumIdeal
810+
maxNumberEquilibria
811+
Node
812+
Key
813+
(nashEquilibriumRing, List)
814+
nashEquilibriumRing
815+
Headline
816+
make the Nash Equilibrium ring
817+
Usage
818+
nashEquilibriumRing L
819+
Inputs
820+
L:List
821+
a list of n-@TO Tensor@s with uniform dimensions
822+
Outputs
823+
:Ring
824+
a polynomial ring generated from the mixed probabilities
825+
Description
826+
Text
827+
An $n$-player game consists of players labeled with $0,1,\cdots, n-1$. The $i$-th player can choose from $d_i$ pure strategies. Let $p_{i,j}$ be the probablility of the $i$-th player choosing the $j$-the strategy, where $j=0,\cdots, d_j-1$. The ideal of the totally mixed Nash equilibria of the game is defined in the polynomial ring over a field $k$ with generators $\{p_{i,j}:0\leq i\leq n-1, 0\leq j\leq d_j-1\}$.
828+
829+
This method computes this ring over $k=\mathbb{Q}$ from a list of tensors representing the payoff matrices of all the $n$ players. The ring generators are ordered lexicographically.
830+
Example
831+
tensors = apply(3, i -> randomTensor {2,4,3})
832+
R = nashEquilibriumRing tensors
833+
baseRing R
834+
gens R
835+
Node
836+
Key
837+
(nashEquilibriumIdeal, Ring, List)
838+
nashEquilibriumIdeal
839+
Headline
840+
make the Nash Equilibrium ideal
841+
Usage
842+
nashEquilibriumIdeal(R, L)
843+
Inputs
844+
R:Ring
845+
the Nash Equilibrium ring. Typically obtained via @TO nashEquilibriumRing@
846+
L:List
847+
a list of payoff tensors
848+
Outputs
849+
:Ideal
850+
An ideal in the Nash Equilibrium ring R generated by the Nash equilibrium polynomials, along with the linear relations of those probabilities variables, that the probabilities of each players sum to 1
851+
Description
852+
Text
853+
For an $n$-player game, the totally mixed Nash equilibria are the zero loci in the interior of the polytope of a system of polynomials in the variables $\{p_{i,j}:0\leq i\leq n-1, 0\leq j\leq d_j-1\}$. The coefficients of these polynomials are differences of the entries of the payoff matrices. From an algebraic-geometric point of view, these polynomials, together with the linear constraints that $\sum_j p_{i,j}=1$ for each $i$, generate an ideal in the polynomial ring computed by @TO nashEquilibriumRing@.
854+
855+
This method computes this Nash equilibrium ideal by generating the polynomials from the payoff matrices first, and appending the linear relations that the sum of probabilities for each player is one.
856+
Example
857+
tensors = apply(3, i -> randomTensor {2,2,2})
858+
R = nashEquilibriumRing tensors
859+
gens R
860+
I = nashEquilibriumIdeal(R, tensors)
861+
Text
862+
Here the embient ring $R$ is explicitly computed before finding the ideal $I$. Alternatively, one can assign both the ring and the ideal to variables in the same line:
863+
Example
864+
I2 = nashEquilibriumIdeal(R2 = nashEquilibriumRing tensors, tensors)
865+
gens R2
866+
Node
867+
Key
868+
(maxNumberEquilibria, List)
869+
maxNumberEquilibria
870+
Headline
871+
compute the maximum number of totally mixed Nash equilibria
872+
Usage
873+
maxNumberEquilibria L
874+
Inputs
875+
L:List
876+
a list of integers representing the dimensions of the game
877+
Outputs
878+
:ZZ
879+
an integer value, the mixed volume, representing the maximum number of totally mixed Nash equilibria
880+
Description
881+
Text
882+
For an $n$-player game where the $i$-th player has $d_i$ pure strategies, the maximum number of isolated totally mixed Nash equilibria is given by the mixed volume of the following list of polytopes:
883+
884+
\[ (\Delta^{(0)}, \cdots, \Delta^{(0)},\Delta^{(1)}, \cdots, \Delta^{(1)}, \cdots, \Delta^{(n-1)}, \cdots, \Delta^{(n-1)}),\]
885+
886+
where each $\Delta^{(i)}$ repeats $d_i - 1 $ times, and is defined by the direct product of simplices
887+
888+
\[ \Delta^{(i)} := \Delta_{d_1-1}\times \Delta_{d_2-1} \times \cdots \Delta_{d_{i-2}-1} \times \{0\} \times \Delta_{d_{i}-1} \times \cdots \times \Delta^{d_{i-1}-1}).\]
889+
890+
This function first generates a tuple of delta polytopes from d, computes their mixed volume, prints a summary message, and returns the mixed volume. The mixed volume is computed via the function @TO mixedVolume@ in the @TO polyhedra@ package. This function currently runs very slow for higher dimension and requires improvement.
891+
Example
892+
d = {2,2,2}
893+
mv = maxNumberEquilibria d
894+
Text
895+
Alternatively, if you have a tensor $T$, you can compute its maximum number as follows:
896+
Example
897+
T = randomTensor {2,2,2}
898+
mv2 = maxNumberEquilibria format T
899+
Node
900+
Key
901+
Tensor
902+
Headline
903+
representing the payoff matrices
904+
///
924905

925906
----------------------------------------
926907
-- Documentation toMarkovRing --
@@ -1433,7 +1414,29 @@ assert(class CE === Polyhedron)
14331414
assert(#vertices CE > ------
14341415
///
14351416

1417+
---------------------------------
1418+
--- TEST nashEquilibriumIdeal ---
1419+
---------------------------------
1420+
1421+
TEST ///
1422+
-- Test nashEquilibriumRing with a list of tensors
1423+
tensorList = apply(3, i -> randomTensor {2,2,2})
1424+
R5 = nashEquilibriumRing tensorList
1425+
assert(numgens R5 > 0)
1426+
1427+
-- Test nashEquilibriumIdeal construction
1428+
I = nashEquilibriumIdeal(R5, tensorList)
1429+
assert(isIdeal I)
14361430

1431+
-- Test maxNumberEquilibria (prints and returns the mixed volume)
1432+
mv = maxNumberEquilibria {2,2,2}
1433+
assert(mv == 2)
1434+
1435+
-- Test maxNumberEquilibria using a tensor's format
1436+
T2 = randomTensor {2,2,2}
1437+
mv2 = maxNumberEquilibria format T2
1438+
assert(mv2 == 2)
1439+
///
14371440

14381441
--------------------------------------
14391442
-- TEST toMarkovRing

0 commit comments

Comments
 (0)