-
-
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
Pure strategy nash equilibrium #12
Conversation
@cc7768 Thanks! It seems the type of function pure_strategy_NE{N}(nfg::NormalFormGame{N})
...
ne = Array(NTuple{N,Int}, 0)
...
end Or we could add a type alias typealias PureActionProfile{N} NTuple{N,PureAction} |
Should typealias PureAction Integer in normal_form_game.jl be typealias PureAction Int ? |
@oyamad if we want to use That being said, I looked through normal_form_game.jl and it seems to me that we only ever use I like that right now it allows for any Integer type and think we should continue to support this. If we do, we just need to be careful that internal uses of |
# For each action profile check whether it is NE | ||
as = CartesianRange(na) | ||
for a in as | ||
_a = a.I::NTuple{np, Int} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having to insert type checks is never a great thing because (I believe) it incurs minor runtime cost.
It might be better to add a method is_nash{N}(::NormalFormGame{N}, ::CartesianIndex{N})
and then we can skip the _a
bit all together
@spencerlyon2 I see, thanks. |
Some thoughts on the function name.
|
Maybe better to create a new file |
Excellent. Thanks for the feedback.
|
I think I would prefer |
With respect to what @spencerlyon2 said earlier about not using Also, removing the type check didn't change anything (as in we don't need it). The type of Moved the test to Changed function name to |
The following seems to work: typealias PureAction Integer
typealias PureActionProfile{N,T<:PureAction} NTuple{N,T}
function pure_nash{N}(nfg::NormalFormGame{N})
...
ne = Array(PureActionProfile{N,Int}, 0)
...
end If we follow this approach, should typealias PureAction Integer be rather typealias AbstractPureAction Integer ? In that case, how could we consistently define |
@@ -0,0 +1,26 @@ | |||
""" | |||
Finds all pure strategy Nash equilibrium for a normal form |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
strategy -> action
equilibrium -> equilibria
(or just "pure Nash equilibria")
Resolved documentation wording. I like the solution you suggest for the type problem. I would be happy with not defining the |
Fine with me. |
Maybe rename Otherwise I think this is ready to merge. |
I renamed the file. I am ready for this to be merged to master. I will wait for you to merge it in order to make sure that we agree. Thanks for the feedback on this PR @oyamad and @spencerlyon2! I think it is much better than the original version. |
@cc7768 Thanks, please do merge. |
This adds just a simple brute force algorithm for finding pure strategy Nash equilibrium -- Literally just iterates through all possible action profiles and stores them if they satisfy
is_nash
.Has a very simple 2 player prisoner's dilemma test.