|
| 1 | +@testset "Testing vertex Enumeration" begin |
| 2 | + |
| 3 | + @testset "test 3 by 2 non-degenerate normal form game(Float)" begin |
| 4 | + g = NormalFormGame(Player([3.0 3.0; 2.0 5.0; 0.0 6.0]), |
| 5 | + Player([3.0 2.0 3.0; 2.0 6.0 1.0])) |
| 6 | + NEs = [([0.0, 1/3, 2/3], [1/3, 2/3]), |
| 7 | + ([0.8, 0.2, 0.0], [2/3, 1/3]), |
| 8 | + ([1.0, 0.0, 0.0], [1.0, 0.0])] |
| 9 | + |
| 10 | + for (actions_computed, actions) in zip(NEs, vertex_enumeration(g)) |
| 11 | + for (action_computed, action) in zip(actions_computed, actions) |
| 12 | + @test action_computed ≈ action |
| 13 | + @test eltype(action_computed) <: AbstractFloat |
| 14 | + end |
| 15 | + end |
| 16 | + end |
| 17 | + |
| 18 | + # @testset "test 3 by 2 non-degenerate normal form game(Int)" begin |
| 19 | + # g = NormalFormGame(Player([3 3; 2 5; 0 6]), |
| 20 | + # Player([3 2 3; 2 6 1])) |
| 21 | + # NEs = [([1.0, 0.0, 0.0], [1.0, 0.0]), |
| 22 | + # ([0.8, 0.2, 0.0], [2/3, 1/3]), |
| 23 | + # ([0.0, 1/3, 2/3], [1/3, 2/3])] |
| 24 | + |
| 25 | + # for (actions_computed, actions) in zip(NEs, support_enumeration(g)) |
| 26 | + # for (action_computed, action) in zip(actions_computed, actions) |
| 27 | + # @test action_computed ≈ action |
| 28 | + # @test eltype(action_computed) <: AbstractFloat |
| 29 | + # end |
| 30 | + # end |
| 31 | + # end |
| 32 | + |
| 33 | + # @testset "test 3 by 2 non-degenerate normal form game(Rational)" begin |
| 34 | + # g = NormalFormGame(Player([3//1 3//1; 2//1 5//1; 0//1 6//1]), |
| 35 | + # Player([3//1 2//1 3//1; 2//1 6//1 1//1])) |
| 36 | + # NEs = [([1//1, 0//1, 0//1], [1//1, 0//1]), |
| 37 | + # ([4//5, 1//5, 0//1], [2//3, 1//3]), |
| 38 | + # ([0//1, 1//3, 2//3], [1//3, 2//3])] |
| 39 | + |
| 40 | + # for (actions_computed, actions) in zip(NEs, support_enumeration(g)) |
| 41 | + # for (action_computed, action) in zip(actions_computed, actions) |
| 42 | + # @test action_computed ≈ action |
| 43 | + # @test eltype(action_computed) <: Rational |
| 44 | + # end |
| 45 | + # end |
| 46 | + # end |
| 47 | + |
| 48 | + @testset "test 3 by 2 degenerate normal form game(Float)" begin |
| 49 | + g = NormalFormGame(Player([1.0 -1.0; -1.0 1.0; 0.0 0.0]), |
| 50 | + Player([1.0 0.0 0.0; 0.0 0.0 0.0])) |
| 51 | + NEs = [([1.0, 0.0, 0.0], [1.0, 0.0]), |
| 52 | + ([0.0, 1.0, 0.0], [0.0, 1.0])] |
| 53 | + |
| 54 | + for (actions_computed, actions) in zip(NEs, vertex_enumeration(g)) |
| 55 | + for (action_computed, action) in zip(actions_computed, actions) |
| 56 | + @test action_computed ≈ action |
| 57 | + @test eltype(action_computed) <: AbstractFloat |
| 58 | + end |
| 59 | + end |
| 60 | + end |
| 61 | + |
| 62 | + # @testset "test 3 by 2 degenerate normal form game(Int)" begin |
| 63 | + # g = NormalFormGame(Player([1 -1; -1 1; 0 0]), |
| 64 | + # Player([1 0 0; 0 0 0])) |
| 65 | + # NEs = [([1.0, 0.0, 0.0], [1.0, 0.0]), |
| 66 | + # ([0.0, 1.0, 0.0], [0.0, 1.0])] |
| 67 | + |
| 68 | + # for (actions_computed, actions) in zip(NEs, support_enumeration(g)) |
| 69 | + # for (action_computed, action) in zip(actions_computed, actions) |
| 70 | + # @test action_computed ≈ action |
| 71 | + # @test eltype(action_computed) <: AbstractFloat |
| 72 | + # end |
| 73 | + # end |
| 74 | + # end |
| 75 | + |
| 76 | + # @testset "test 3 by 2 degenerate normal form game(Rational)" begin |
| 77 | + # g = NormalFormGame(Player([1//1 -1//1; -1//1 1//1; 0//1 0//1]), |
| 78 | + # Player([1//1 0//1 0//1; 0//1 0//1 0//1])) |
| 79 | + # NEs = [([1//1, 0//1, 0//1], [1//1, 0//1]), |
| 80 | + # ([0//1, 1//1, 0//1], [0//1, 1//1])] |
| 81 | + |
| 82 | + # for (actions_computed, actions) in zip(NEs, support_enumeration(g)) |
| 83 | + # for (action_computed, action) in zip(actions_computed, actions) |
| 84 | + # @test action_computed ≈ action |
| 85 | + # @test eltype(action_computed) <: Rational |
| 86 | + # end |
| 87 | + # end |
| 88 | + # end |
| 89 | + |
| 90 | + |
| 91 | +end |
0 commit comments