GameTheory.jl icon indicating copy to clipboard operation
GameTheory.jl copied to clipboard

Vertex enumeration

Open samwycherley opened this issue 2 years ago • 7 comments

Adds the vertex enumeration algorithm from B. von Stengel, Chapter 3 in Nisan et al (eds.) Algorithmic Game Theory (2007), using Polyhedra.jl. Still not quite as fast as support_enumeration (but close).

samwycherley avatar Jun 03 '22 21:06 samwycherley

@samwycherley Thank you for the PR!

First of all, will you add your test file to runtests.jl by

include("test_vertex_enumeration.jl")

oyamad avatar Jun 04 '22 01:06 oyamad

@oyamad Sorry, should be fixed now

samwycherley avatar Jun 04 '22 07:06 samwycherley

Thanks. A few general comments first:

  • For readability, could you reduce the length of each line? I limit to 80 characters per line myself, while it seems standard to be 92 characters in Julia?

  • Could you delete the parts of the code that are commented out?

  • Is possible to return NEs with Rational entries if the input game has Rational payoffs? support_enumeration supports this:

    julia> g = NormalFormGame(Player([3//1 3; 2 5; 0 6]),
                              Player([3//1 2 3; 2 6 1]))
    3×2 NormalFormGame{2, Rational{Int64}}
    
    julia> support_enumeration(g)
    3-element Vector{Tuple{Vector{Rational{Int64}}, Vector{Rational{Int64}}}}:
     ([1//1, 0//1, 0//1], [1//1, 0//1])
     ([4//5, 1//5, 0//1], [2//3, 1//3])
     ([0//1, 1//3, 2//3], [1//3, 2//3])
    

oyamad avatar Jun 04 '22 19:06 oyamad

  • Please allow the user to pass a Polyhedra package to Polyhedra.polyhedron. As an example, see the plib option in outerapproximation.

oyamad avatar Jun 04 '22 20:06 oyamad

Thanks for the suggestions! It should now work that inputting rational payoffs returns a vector of rational Nash equilibria, and I have also implemented the other suggestions.

samwycherley avatar Jun 04 '22 23:06 samwycherley

Great!

  • Could you add a test with a Rational input (see this for an example)?

oyamad avatar Jun 04 '22 23:06 oyamad

Added. I've also moved NEs_approx_equal from test_support_enumeration.jl to runtests.jl since I changed the vertex enumeration tests to use it

samwycherley avatar Jun 05 '22 17:06 samwycherley