Skip to content

Commit fe8efb5

Browse files
add tests to NE functions
1 parent c625888 commit fe8efb5

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

GameTheory/trial.m2

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1825,6 +1825,36 @@ TEST ///
18251825
assert(isIdeal I)
18261826
///
18271827

1828+
TEST ///
1829+
testIndices = enumerateTensorIndices {2,2,2};
1830+
TList = apply(3, i-> zeroTensor {2,2,2});
1831+
TE = {{2, 2, 0, 1, 2, 2, 1, 1}, {2, 2, 0, 2, 2, 0, 1, 2}, {1, 1, 1, 2, 0, 0, 2, 1}};
1832+
scan(3, k->scan(pairs testIndices, (j,i)->(TList#k#i = TE#k#j)));
1833+
R2 = nashEquilibriumRing TList;
1834+
I = nashEquilibriumIdeal(R2, TList);
1835+
ComputedGens = first entries gens I;
1836+
TargetGens = {p_{1,1} * p_{2,0}, -2 * p_{0,0} * p_{2,0} - p_{0,1} * p_{2,0} + 2 * p_{0,1} * p_{2,1}, p_{0,0} * p_{1,1} - p_{0,1} * p_{1,1}, p_{0,0} + p_{0,1} - 1, p_{1,0} + p_{1,1} - 1, p_{2,0} + p_{2,1} - 1};
1837+
assert(ComputedGens == TargetGens)
1838+
///
1839+
1840+
---------------------------------
1841+
--- TEST deltaList ---
1842+
---------------------------------
1843+
TEST ///
1844+
DL = deltaList {2,4,5}
1845+
d = apply(DL, p->dim p)
1846+
assert(d == {7, 5, 5, 5, 4, 4, 4, 4})
1847+
ad = apply(DL, p->ambDim p)
1848+
assert(ad == toList (8 : 8))
1849+
///
1850+
1851+
TEST ///
1852+
DL2 = deltaList {2,2,2}
1853+
ComputedV = apply(DL2, p->entries vertices p)
1854+
TargetV = {{{0, 0, 0, 0}, {0, 1, 0, 1}, {0, 0, 1, 1}}, {{0, 1, 0, 1}, {0, 0, 0, 0}, {0, 0, 1, 1}}, {{0, 1, 0, 1}, {0, 0, 1, 1}, {0, 0, 0, 0}}}
1855+
assert(ComputedV == TargetV)
1856+
///
1857+
18281858
---------------------------------
18291859
--- TEST maxNumberEquilibria ---
18301860
---------------------------------

0 commit comments

Comments
 (0)