Skip to content
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

Closed
oyamad opened this issue Mar 17, 2017 · 3 comments
Closed

Type instability: 1-player game, symmetric 2-player game #28

oyamad opened this issue Mar 17, 2017 · 3 comments

Comments

@oyamad
Copy link
Member

oyamad commented Mar 17, 2017

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 a NormalFormGame 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 returns

    • a 1-player NormalFormGame if the input array is n x 1;
    • a 2-player 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:

  • let NormalFormGame{T<:Real}(payoffs::Matrix{T}) always return a 2-player NormalFormGame (if payoff is square), so that a 1-player game cannot be constructed by a payoff array (vector in this case) and must be constructed by NormalFormGame(player_with_no_opponent), where player_with_no_opponent is of type Player{1,T}.
@oyamad
Copy link
Member Author

oyamad commented Mar 18, 2017

Alternative is #5, with removing NormalFormGame{T<:Real}(payoffs::Matrix{T}).

@sglyon
Copy link
Member

sglyon commented Mar 18, 2017

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.

@cc7768
Copy link
Member

cc7768 commented Mar 21, 2017

Hi @oyamad. I think this is a very sensible proposal and a nice solution to the problem.

@oyamad oyamad closed this as completed in fc14974 Mar 29, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants