Utilities
This is documentation for util.jl.
Exported
GameTheory.NormalFormGame — Method
NormalFormGame([T], p)Construct a NormalFormGame (of eltype T if specified) from a GAMPayoffVector p.
Examples
julia> nums_actions = (3, 2);
julia> payoffs = collect(1:12);
julia> @show payoffs;
payoffs = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
julia> p = GAMPayoffVector(nums_actions, payoffs);
julia> g = NormalFormGame(p);
julia> println(g)
3×2 NormalFormGame{2, Int64}:
[1, 7] [4, 10]
[2, 8] [5, 11]
[3, 9] [6, 12]Internal
GameTheory.GAMPayoffVector — Type
GAMPayoffVector{N,T}Internal intermediate representation that stores payoffs in a single flat vector.
Payoff values are ordered as in the GameTracer .gam format:
- Player-major blocks: player 1, ..., player N.
- Within each block, action profiles are ordered with player 1 varying fastest, then player 2, ..., player N (i.e., Fortran/column-major order).
Fields
nums_actions::NTuple{N,Int}: Tuple of the numbers of actions, one for each player.payoffs::Vector{T}: Vector storing payoffs in .gam order.
GameTheory.GAMPayoffVector — Method
GAMPayoffVector([T], g)Construct a GAMPayoffVector (of eltype T if specified) from a NormalFormGame g.
Examples
julia> player1 = Player([1 4; 2 5; 3 6]);
julia> player2 = Player([7 8 9; 10 11 12]);
julia> g = NormalFormGame(player1, player2);
julia> println(g)
3×2 NormalFormGame{2, Int64}:
[1, 7] [4, 10]
[2, 8] [5, 11]
[3, 9] [6, 12]
julia> p = GAMPayoffVector(g);
julia> @show p.payoffs;
p.payoffs = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]GameTheory.clp_optimizer_silent — Method
clp_optimizer_silent()Function that returns a Clp.Optimizer instance in silent mode.