Conversation
|
Thank you for adding this! I'll try to find time to review very soon. As always, I appreciate the effort you take into including tests with your pull requests. |
|
@oyamad can you elaborate on parts of the type system you are concerned about? Are there specific methods or functions that gave or are giving you a hard time? |
|
Sorry I was not clear. I did many trials and errors and finally succeeded in getting rid of (almost) all warnings in
|
Referred to base/show.jl
|
I modified They look like: julia> player1 = Player([3 1; 0 2])
2x2 Player{2,Int64}:
3 1
0 2
julia> player2 = Player([2 0; 1 3])
2x2 Player{2,Int64}:
2 0
1 3
julia> g = NormalFormGame((player1, player2))
2x2 NormalFormGame{2,Int64}
julia> NormalFormGame((2, 2, 2))
2x2x2 NormalFormGame{3,Float64}
Let me leave (Tests fail for nightly with |
|
Hi @oyamad I'm sorry I haven't been super proactive in reviewing and merging this. The delay is caused partly because I have been busy and partly because I have been waiting to get the work over at https://github.com/QuantEcon/Games.jl to get off the ground. I think the plan going forward will be to have the game theory work start and progress over at that repository. Down the road we will consider merging that code into QuantEcon.jl, but we'll have to see how far things go and if it makes sense to keep Games.jl as a standalone package before making that decision. With that in mind, are you ok if we move this PR over to that repo and use it as a starting point for the work that will happen over there? |
|
@spencerlyon2 No problem at all. Sure, please move this PR to |
|
Closing in favor of QuantEcon/GameTheory.jl#1 |
This is a Julia version of normal_form_game.py (QuantEcon/QuantEcon.py#220).
See this notebook for demonstration.
TODO:
payoff_profile_arraymethodshow(io::IO, player::Player)andshow(io::IO, g::NormalFormGame)Issues:
@code_warntype, but I am not 100% sure.NTupleas an action profile: a tuple of integers (pure actions), a tuple of vectors of reals (mixed actions; vectors may be different in length), or a tuple of integers and vectors. Is it better to implement these methods also forArrays?Some features:
To constitute a
NormalFormGame,Playerinstances must be homogeneous in theireltypeofpayoff_array.type Player{N,T<:Real} payoff_array::Array{T,N} num_actions::Int num_opponents::Int tol::Float64 endtype NormalFormGame{N,T<:Real} players::NTuple{N,Player{N,T}} N::Int nums_actions::NTuple{N,Int} end(The current Python version allows heterogeneous
dtypes, but I think I am going to change it.)(EDIT: To be changed by Changes in normal_form_game QuantEcon.py#226.)