Reference

Utilities

Nash.outerFunction
outer(vecs::Array{Array{T,1},1}) where T<:Real

Takes vector of vectors and return outer product tensor

Input parameters

  • vecs::Array{Array{T,1},1} - array of vectors to use in outer product
source
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
source
Nash.plot_brFunction
plot_br(br::CDDLib.Polyhedron{T}) where T<:Real

Plots best reply in the form of simplex (3d and above)

Input parameters

  • br::CDDLib.Polyhedron{T}) - bestreply function (with returnval="chull") output
source

Games

Nash.generate_gameFunction

generate_game(payoffm...)

Returns given payoff matrices for given number of players with given number of actions

Input parameters

  • payoffm - payoff matrices
source
Nash.random_2players_gameFunction

random2playersgame(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 sampled
  • p1_size::Int - number of actions of first player
  • p2_size::Int - number of actions of second player
source
Nash.random_nplayers_gameFunction

randomnplayersgame(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 sampled
  • size::Union{Array{Int,1},Tuple} - vector or tuple of number of players' actions
source

Equilibria and best responses

Nash.get_payoffFunction
get_payoff(game::Dict{String,<:AbstractArray}, s::Vector{Vector{T}}) where T<:Real

Produces payoff profile for given game and actions probabilities array

Input parameters

  • game::Dict{String,<:AbstractArray} - array of vectors to use in outer product
  • s::Vector{Vector{T}} - collection of actions probabilities for each player in a game
source
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 product
  • s::Vector{Vector{SymPy.Sym}} - collection of actions probabilities for each player in a game
source
Nash.best_replyFunction
best_reply(game::Dict{String,<:Array}, s::Vector{Vector{T}} where T<:Real,
k::Int, epsil::F=0.0 ;return_val::String = "array") where F<:Real

Returns 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 matrices
  • s::Vector{Vector{T}} where T<:Real - collection of actions probabilities for each player in a game
  • k::Int - player for which the best reply is returned
  • epsil::F = 0.0 - probability of error (if the answer is disturbed)
  • return_val::String = "array" - type of returned value ("array" or "chull")
source
Nash.is_nash_qFunction
is_nash_q(game::Dict{String,<:Array}, s::Vector{Vector{T}}) where T<:Real

Returns a dictionary of logical vectors indicating whether given profile is Nash equilibrium.

Input parameters

  • game::Dict{String,<:Array} - dictionary of players and their payoff matrices
  • s::Vector{Vector{T}}) - collection of actions probabilities for each player
source
Nash.iterate_best_replyFunction
iterate_best_reply(game::Dict{String,<:Array},
        s::Vector{Vector{T}} where T<:Real,
        epsil::F = 0.0, it_num::Int = 10)  where F<:Real

Returns 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 matrices
  • s::Vector{Vector{T}} where T<:Real - collection of actions probabilities for each player
  • epsil::F = 0.0 - probability of error (if the answer is disturbed)
  • it_num::Int = 10 - an integer specifying how many iterations should be repeated
source
Nash.vFunctionFunction

vFunction(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 game
  • s::Vector{Vector{T}} - strategy profile for which we want to compute V - function
source

Markov chains

Nash.game2markovFunction
game2markov(game::Dict{String,<:Array}, s::Vector{Vector{T}}) where T<:Real

Returns Markov chain of a given game and given vector of action probabilities

Input parameters

  • game::Dict{String,<:Array} - dictionary of players and their payoff matrices
  • s::Vector{Vector{T}} - collection of actions probabilities for each player
source
Nash.plot_markovFunction
plot_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)
source

Symmetric games

Nash.random_symmetric_2players_gameFunction
random_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 sampled
  • p_size::Int - number of actions of a player
source
Nash.find_symmetric_nash_equilibrium_2players_gameFunction
find_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 matrices
  • s::Array{SymPy.Sym,1} - collection of actions probabilities
source
Nash.create_symmetries_graphFunction
create_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
source
Nash.check_equality_conditionFunction
check_equality_condition(g::SymmetriesGraph, payout_1, payout_2)

Checks if there needs to be an equality between two payouts

Input parameters

  • g::SymmetriesGraph - symmetries graph
  • payout_1 - first payout
  • payout_2 - second payout
source
Nash.find_all_equalitiesFunction
find_all_equalities(g::SymmetriesGraph)

Finds all payout tuples, that need to be equal

Input parameters

  • g::SymmetriesGraph - symmetries graph
source

Symmetric games

Nash.create_replicator_eqsFunction
create_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 matrices
  • s::Array{SymPy.Sym,1} - collection of symbolic actions probabilities
source