Reference
Utilities
Nash.outer — Functionouter(vecs::Array{Array{T,1},1}) where T<:RealTakes vector of vectors and return outer product tensor
Input parameters
vecs::Array{Array{T,1},1}- array of vectors to use in outer product
outer(vecs::Array{Array{SymPy.Sym,1},1})Takes vector of symbolic vectors and return outer product tensor
Input parameters
vecs::Array{Array{SymPy.Sym,1},1}- array of symbolic vectors to use in outer product
Nash.plot_br — Functionplot_br(br::CDDLib.Polyhedron{T}) where T<:RealPlots best reply in the form of simplex (3d and above)
Input parameters
br::CDDLib.Polyhedron{T})- bestreply function (with returnval="chull") output
Games
Nash.generate_game — Functiongenerate_game(payoffm...)
Returns given payoff matrices for given number of players with given number of actions
Input parameters
payoffm- payoff matrices
Nash.random_2players_game — Functionrandom2playersgame(dist::Distributions.Sampleable,p1size::Int,p2size::Int)
Returns random payoff matrices for 2 players with given number of actions
Input parameters
dist::Distributions.Sampleable- distribution from which payoffs are sampledp1_size::Int- number of actions of first playerp2_size::Int- number of actions of second player
Nash.random_nplayers_game — Functionrandomnplayersgame(dist::Distributions.Sampleable, size::Union{Array{Int,1},Tuple})
Returns random payoffs for n players with given number of actions
Input parameters
dist::Distributions.Sampleable- distribution from which payoffs are sampledsize::Union{Array{Int,1},Tuple}- vector or tuple of number of players' actions
Equilibria and best responses
Nash.get_payoff — Functionget_payoff(game::Dict{String,<:AbstractArray}, s::Vector{Vector{T}}) where T<:RealProduces payoff profile for given game and actions probabilities array
Input parameters
game::Dict{String,<:AbstractArray}- array of vectors to use in outer products::Vector{Vector{T}}- collection of actions probabilities for each player in a game
get_payoff(game::Dict{String,<:AbstractArray}, s::Vector{Vector{SymPy.Sym}})Produces payoff profile for given game and actions probabilities symbolic array
Input parameters
game::Dict{String,<:AbstractArray}- array of vectors to use in outer products::Vector{Vector{SymPy.Sym}}- collection of actions probabilities for each player in a game
Nash.best_reply — Functionbest_reply(game::Dict{String,<:Array}, s::Vector{Vector{T}} where T<:Real,
k::Int, epsil::F=0.0 ;return_val::String = "array") where F<:RealReturns best reply of given player to actions of his counterparts (defined by strategy profile) in the form of array or convex hull
Input parameters
game::Dict{String,<:Array}- dictionary of players and their payoff matricess::Vector{Vector{T}} where T<:Real- collection of actions probabilities for each player in a gamek::Int- player for which the best reply is returnedepsil::F = 0.0- probability of error (if the answer is disturbed)return_val::String = "array"- type of returned value ("array" or "chull")
Nash.is_nash_q — Functionis_nash_q(game::Dict{String,<:Array}, s::Vector{Vector{T}}) where T<:RealReturns a dictionary of logical vectors indicating whether given profile is Nash equilibrium.
Input parameters
game::Dict{String,<:Array}- dictionary of players and their payoff matricess::Vector{Vector{T}})- collection of actions probabilities for each player
Nash.iterate_best_reply — Functioniterate_best_reply(game::Dict{String,<:Array},
s::Vector{Vector{T}} where T<:Real,
epsil::F = 0.0, it_num::Int = 10) where F<:RealReturns an array of arrays representing each players' game strategies (action probabilities) history in every iteration
Input parameters
game::Dict{String,<:Array}- dictionary of players and their payoff matricess::Vector{Vector{T}} where T<:Real- collection of actions probabilities for each playerepsil::F = 0.0- probability of error (if the answer is disturbed)it_num::Int = 10- an integer specifying how many iterations should be repeated
Nash.vFunction — FunctionvFunction(game::Dict{String,<:AbstractArray}, s::Vector{Vector{T}}) where T<:Real
Computes numerically for a given game and a given profile V - function crucial to implement finding NE through optimization, if it equal to 0 - given profile is a Nash Equilibrium, if greater - not
Input Parameters
game::Dict{String,<:AbstractArray}- dictionary containing a games::Vector{Vector{T}}- strategy profile for which we want to compute V - function
Markov chains
Nash.game2markov — Functiongame2markov(game::Dict{String,<:Array}, s::Vector{Vector{T}}) where T<:RealReturns Markov chain of a given game and given vector of action probabilities
Input parameters
game::Dict{String,<:Array}- dictionary of players and their payoff matricess::Vector{Vector{T}}- collection of actions probabilities for each player
Nash.plot_markov — Functionplot_markov(no_steps::Int, mc::MarkovChain{Int,Array{Int,2},Array{Int,1}})Plots a path of Markov chain simulation of a given time length and all initial values
Input parameters
no_steps::Int- scalar of time length (number of iterations)mc::MarkovChain{Int,Array{Int,2},Array{Int,1}}- Markov chain of a game (game2markov output function)
Symmetric games
Nash.random_symmetric_2players_game — Functionrandom_symmetric_2players_game(dist::Distributions.Sampleable,p1_size::Int,p2_size::Int)Returns random symmetric payoff matrices for 2 players with given number of actions
Input parameters
dist::Distributions.Sampleable- distribution from which payoffs are sampledp_size::Int- number of actions of a player
Nash.find_symmetric_nash_equilibrium_2players_game — Functionfind_symmetric_nash_equilibrium_2players_game(game::Dict{String,<:AbstractArray}, s::Array{SymPy.Sym,1})Finds necessary values to find symmetric Nash equilibrium
Input parameters
game::Dict{String,<:AbstractArray}- dictionary of players and their payoff matricess::Array{SymPy.Sym,1}- collection of actions probabilities
Nash.create_symmetries_graph — Functioncreate_symmetries_graph(actions_no_vector::Array{Int64})Return graph of needed symmetries in the game
Input parameters
actions_no_vector::Array{Int64}- array of number of actions of consecutive players
Nash.check_equality_condition — Functioncheck_equality_condition(g::SymmetriesGraph, payout_1, payout_2)Checks if there needs to be an equality between two payouts
Input parameters
g::SymmetriesGraph- symmetries graphpayout_1- first payoutpayout_2- second payout
Nash.find_all_equalities — Functionfind_all_equalities(g::SymmetriesGraph)Finds all payout tuples, that need to be equal
Input parameters
g::SymmetriesGraph- symmetries graph
Symmetric games
Nash.create_replicator_eqs — Functioncreate_replicator_eqs(game::Dict{String,<:AbstractArray}, s::Array{SymPy.Sym,1})Creates differential equations for replicator
Input parameters
game::Dict{String,<:AbstractArray}- dictionary of players and their payoff matricess::Array{SymPy.Sym,1}- collection of symbolic actions probabilities