A-Lounsbury / pysimultaneous

A class for handling simultaneous games with any number of players
0 stars 0 forks source link

Fix outcome probabilities for the k-rationalizability model #23

Closed A-Lounsbury closed 3 months ago

A-Lounsbury commented 3 months ago

This test

krmodel = [
    [
        [[2, 12], [5, 6], [9, 0]],
        [[0, 24], [19, 5], [10, 10]],
        [[1, 3], [7, 5], [5, 25]],
    ]
]

G = SimGame(2)
G.enterData(2, [3, 3], krmodel)
G.print()
print()
G.printKMatrix(probabilities=[0.1, 0.4, 0.4, 0.1])

results in

P(1, 2) = 0.10000000000000002
P(1, 0) = 0.9000000000000002
P(0, 2) = 0.10000000000000003
P(0, 0) = 0.9000000000000004
EU_0 = 1.8500000000000005
EU_1 = 16.700000000000003
(1, 2) (1, 0) (1, 0) (1, 0)
(1, 2) (1, 0) (1, 0) (1, 0)
(0, 2) (0, 0) (0, 0) (0, 0)
(0, 2) (0, 0) (0, 0) (0, 0)

while the expected result is

P(1, 2) = 0.05
P(1, 0) = 0.45
P(0, 2) = 0.05
P(0, 0) = 0.45
A-Lounsbury commented 3 months ago

It is very strange that the expected utilities are correct while the outcome probabilities are not. I really have no clue how that's happening.

A-Lounsbury commented 3 months ago

Instead of clearing self.oucomeProbabilities with self.outcomeProbabilities = [0.0 for n in range(len(self.kOutcomes))], we were simply appending more 0.0s.