Learning Algorithms
Exported
GameTheory.AbstractBRD
— TypeAbstractBRD
Abstract type representing the best response dynamics model.
GameTheory.BRD
— TypeBRD
Type representing the best response dynamics model.
Fields
N::Int
: The number of players.player::Player{2,T}
:Player
instance in the model.num_actions::Int
: The number of actions for players.
GameTheory.BRD
— MethodBRD(N, payoff_array)
Create a new BRD instance.
Arguments
N::Integer
: The number of players.payoff_array::Matrix
: Payoff array for each player.
Returns
::BRD
: The best response dynamics model.
GameTheory.KMR
— TypeKMR
Type representing the Kandori Mailath Rob model.
Fields
N::Int
: The number of players.player::Player
:Player
instance in the model.num_actions::Int
: The number of actions for players.epsilon::Float64
: The probability of strategy flips.
GameTheory.KMR
— MethodKMR(N, payoff_array, epsilon)
Create a new KMR instance.
Arguments
N::Integer
: The number of players.payoff_array::Matrix
: The payoff array for each player.epsilon::Float64
: The probability of strategy flips.
Returns
::KMR
: The Kandori Mailath Rob model.
GameTheory.SamplingBRD
— TypeSamplingBRD
Type representing the sampling best response dynamics model.
Fields
N::Int
: The number of players.player::Player
:Player
instance in the model.num_actions::Int
: The number of actions for players.k::Int
: Sample size.
GameTheory.SamplingBRD
— MethodSamplingBRD(N, payoff_array, k)
Create a new SamplingBRD instance.
Arguments
N::Integer
: The number of players.payoff_array::Matrix
: Payoff array for a player.k::Integer
: Sample size.
Returns
::SamplingBRD
: The sampling best response dynamics model.
GameTheory.play
— Functionplay([rng=Random.GLOBAL_RNG, ]brd, init_action_dist[, options=BROptions(); num_reps=1])
Return the action distribution after num_reps
times iteration
Arguments
rng::AbstractRNG
: Random number generator used.brd::AbstractBRD
:AbstractBRD
instance.init_action_dist::Vector{<:Integer}
: The initial distribution of players' actions.options::BROptions
: Options forbest_response
method.num_reps::Integer
: The number of iterations.
Returns
::Vector{<:Integer}
: The action distribution after iterations.
GameTheory.AbstractFictitiousPlay
— TypeAbstractFictitiousPlay
Abstract type representing a fictitious play model.
GameTheory.AbstractGain
— TypeAbstractGain
Abstract type representing the gain in a fictitious play model.
GameTheory.ConstantGain
— TypeConstantGain
Type representing a constant gain.
GameTheory.DecreasingGain
— TypeDecreasingGain
Type representing a decresing gain.
GameTheory.FictitiousPlay
— TypeFictitiousPlay(fp[, gain=fp.gain])
Construct a new FictitiousPlay
instance from fp
.
Arguments
fp::AbstractFictitiousPlay
:AbstractFictitiousPlay
instance.gain::AbstractGain
: Argument to specify the gain or step size.
Returns
::FictitiousPlay
: The fictitious play model.
GameTheory.FictitiousPlay
— TypeFictitiousPlay{N, T, TG}
Type representing a fictitious play model with N players.
Fields
players::NTuple{N,Player{N,T}}
: Tuple ofPlayer
instances.nums_actions::NTuple{N,Int}
: Tuple of the numbers of actions, one for each player.gain::TG<:AbstractGain
: Gain type.
GameTheory.FictitiousPlay
— TypeFictitiousPlay(g[, gain=DecreasingGain()])
Construct a FictitiousPlay
instance from NormalFormGame
.
Arguments
g::NormalFormGame
:NormalFormGame
instance.gain::AbstractGain
: Argument to specify the gain or step size;DecreasingGain()
orConstantGain(size)
.
Returns
::FictitiousPlay
: The fictitious play model.
GameTheory.StochasticFictitiousPlay
— TypeStochasticFictitiousPlay(g, d[, gain=DecreasingGain()])
Construct a StochasticFictitiousPlay
instance.
Arguments
g::NormalFormGame
:NormalFormGame
instance.d::Distributions.Distribution
:Distribution
instance from which payoff perturbations are drawn.gain::AbstractGain
: Argument to specify the gain or step size;DecreasingGain()
orConstantGain(size)
.
Returns
::StochasticFictitiousPlay
: The stochastic fictitious play model.
GameTheory.StochasticFictitiousPlay
— TypeStochasticFictitiousPlay(fp[, d=fp.d, gain=fp.gain])
Construct a new StochasticFictitiousPlay
instance from fp
.
Arguments
fp::AbstractFictitiousPlay
:AbstractFictitiousPlay
instance.d::Distributions.Distribution
:Distribution
instance from which payoff perturbations are drawn.gain::AbstractGain
: Argument to specify the gain or step size.
Returns
::StochasticFictitiousPlay
: The stochastic fictitious play model.
GameTheory.StochasticFictitiousPlay
— TypeStochasticFictitiousPlay{N, T, TG, TD}
Type representing a stochastic fictitious play model with N players.
Fields
players::NTuple{N,Player{N,T}}
: Tuple ofPlayer
instances.nums_actions::NTuple{N,Int}
: Tuple of the numbers of actions, one for each player.gain::TG<:AbstractGain
: Gain type.d::TD<:Distributions.Distribution
:Distribution
instance from which payoff perturbations are drawn.
GameTheory.AbstractRevision
— TypeAbstractRevision
Abstract type representing revision method.
GameTheory.AsynchronousRevision
— TypeAsynchronousRevision
Type representing an asynchronous revision.
GameTheory.LocalInteraction
— TypeLocalInteraction{N, T, S, A, TR}
Type representing the local interaction model with N players.
Fields
players::NTuple{N,Player{2,T}}
: Tuple ofPlayer
instances.num_actions::Integer
: The number of actions for players.adj_matrix::Array{S,2}
: Adjacency matrix of the graph in the model.revision<:AbstractRevision
: The way to revise the action profile.
GameTheory.LocalInteraction
— MethodLocalInteraction(payoff_matrix,
adj_matrix[, revision=SimultaneousRevision()])
Construct a LocalInteraction
instance.
Arguments
payoff_matrix::Matrix
: The payoff matrix of the game.adj_matrix::AbstractMatrix
: Adjacency matrix of the graph in the model.revision::AbstractRevision
: Arguments to specify the revision method.SimultaneousRevision()
orAsynchronousRevision
Returns
::LocalInteraction
: The local interaction model.
GameTheory.LocalInteraction
— MethodLocalInteraction(g, adj_matrix[, revision=SimultaneousRevision()])
Construct a LocalInteraction
instance.
Arguments
g::NormalFormGame
: The game used in the model.adj_matrix::AbstractMatrix
: Adjacency matrix of the graph in the model.revision::AbstractRevision
: Arguments to specify the revision method;SimultaneousRevision()
orAsynchronousRevision()
.
Returns
::LocalInteraction
: The local interaction model.
GameTheory.SimultaneousRevision
— TypeSimultaneousRevision
Type representing a simultaneous revision.
GameTheory.LogitDynamics
— TypeLogitDynamics{N, T, S}
Type representing the Logit-Dynamics model.
Fields
players::NTuple{N,Player{N,T}}
: Tuple ofPlayer
instances.nums_actions::NTuple{N,Int}
: Tuple of the numbers of actions, one for each player.beta<:Real
: The level of noise in a player's decision.choice_probs::Vector{Array}
: The choice probabilities of each action, one for each player.
GameTheory.LogitDynamics
— MethodLogitDynamics(g, beta)
Construct a LogitDynamics
instance.
Arguments
g::NormalFormGame{N,T}
:NormalFormGame
instance.beta::S
: The level of noise in players' decision.
Returns
::LogitDynamics
: The Logit-Dynamics model.
GameTheory.play!
— Methodplay!(rng, ld, player_ind, actions)
Return a new action of player indexed by player_ind
given each players' choice probabilities.
Arguments
rng::AbstractRNG
: Random number generator used.ld::LogitDynamics{N}
:LogitDynamics
instance.player_ind::Integer
: A player index who takes an action.actions::Vector{<:Integer}
: The action profile.
Returns
::Integer
: The new action of the player indexed byplayer_ind
.
GameTheory.play
— Methodplay([rng=Random.GLOBAL_RNG,] ld, init_actions[; num_reps=1])
Return new action profile after num_reps
iterations.
Arguments
rng::AbstractRNG
: Random number generator used.ld::LogitDynamics{N}
:LogitDynamics
instance.init_actions::PureActionProfile
: Initial action profile.num_reps::Integer
: The number of iterations.
Returns
::Vector{<:Integer}
: New action profile.
GameTheory.time_series
— Methodtime_series([rng=Random.GLOBAL_RNG,] ld, ts_length, init_actions)
Return a time series of action profiles.
Arguments
rng::AbstractRNG
: Random number generator used.ld::LogitDynamics{N}
:LogitDynamics
instance.ts_length::Integer
: The length of time series.init_actions::PureActionProfile
: Initial action profile.
Returns
::Matrix{<:Integer}
: The time series of action profiles.
Internal
GameTheory.time_series!
— Methodtime_series!(rng, brd, out, player_ind_seq, options)
Update the matrix out
which is used in time_series
method given a player index sequence.
Arguments
rng::AbstractRNG
: Random number generator used.brd::AbstractBRD
: Instance of the model.out::Matrix{<:Integer}
: Matrix representing the time series of action profiles.player_ind_seq::Vector{<:Integer}
: The vector of player index.options::BROptions
: Options forbest_response
method.
Returns
out::Matrix{<:Integer}
: Updatedout
.
GameTheory.time_series!
— Methodtime_series!(rng, fp, out[, options=BROptions(); t_init=1])
Update the tuple of matrices out
which is used in time_series
method.
Arguments
rng::AbstractRNG
: Random number generator used.fp::AbstractFictitiousPlay{N}
:AbstractFictitiousPlay
instance.out::NTuple{N,Matrix{<:Real}}
: Tuple of matrices which represent the time series of mixed action profile.options::BROptions
: Options forbest_response
.t_init::Integer
: The period when the iteration starts.
Returns
out::NTuple{N,Matrix{<:Real}}
: Updatedout
.
GameTheory.time_series!
— Methodtime_series!(li, out, options, player_ind_seq)
Update the matrix out
which is used in time_series
method given player index sequence.
Arguments
li::LocalInteraction{N}
:LocalInteraction
instance.out::Matrix{<:Integer}
: Matrix representing a time series of action profiles.options::BROptions
: Options forbest_response
method.player_ind_seq::Vector{<:Integer}
: Vector representing the index of players to take an action.
Returns
out::Matrix{<:Integer}
: Updatedout
.
GameTheory.time_series!
— Methodtime_series!(li, out, options)
Update the matrix out
which is used in time_series
method. All players take their actions simultaneously.
Arguments
li::LocalInteraction{N}
:LocalInteraction
instance.out::Matrix{<:Integer}
: Matrix representing a time series of action profiles.options::BROptions
: Options forbest_response
method.
Returns
out::Matrix{<:Integer}
: Updatedout
.
GameTheory.time_series!
— Methodtime_series!(rng, ld, out, player_ind_seq)
Update the matrix out
which is used in time_series
method given a player index sequence.
Arguments
rng::AbstractRNG
: Random number generator used.ld::LogitDynamics{N}
:LogitDynamics
instance.out::Matrix{<:Integer}
: Matrix representing the time series of action profiles.player_ind_seq::Vector{<:Integer}
: The sequence of player index, which is determined randomly.
Returns
::Matrix{<:Integer}
: Updatedout
.