-
-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Type instability: 1-player game, symmetric 2-player game #28
Comments
Alternative is #5, with removing |
I think I like your proposal in the comment at the end of the original post here. But, I will totally defer to your judgement here. |
Hi @oyamad. I think this is a very sensible proposal and a nice solution to the problem. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The problem causing #2 (comment):
If an M-dimensional array is passed with M>=3, then
NormalFormGame{T<:Real,M}(payoffs::Array{T,M})
is called, which returns aNormalFormGame
with N=M-1>=2 players.If a 2-dimensitonal array (matrix) is passed, then
NormalFormGame{T<:Real}(payoffs::Matrix{T})
is called and it returnsNormalFormGame
if the input array is n x 1;NormalFormGame
if the input array is n x m with m>=2 and is square (n=m), in which case the game is thought of as a symmetric 2-player game.The latter design is the source of the type instability.
My proposal is:
NormalFormGame{T<:Real}(payoffs::Matrix{T})
always return a 2-playerNormalFormGame
(ifpayoff
is square), so that a 1-player game cannot be constructed by a payoff array (vector in this case) and must be constructed byNormalFormGame(player_with_no_opponent)
, whereplayer_with_no_opponent
is of typePlayer{1,T}
.The text was updated successfully, but these errors were encountered: