Zero-Sum Games

Strategy Type

OperationsResearchModels.Game.StrategyTypeType
StrategyType

Description

An enumeration to represent the type of strategy in a game.

  • Pure: Indicates that the optimal strategy is pure, meaning that the player should choose one strategy with probability 1.
  • Mixed: Indicates that the optimal strategy is mixed, meaning that the player should randomize between multiple strategies with certain probabilities.
source

Game Problem

Game solver of the game matrix designed for the row player

OperationsResearchModels.solveMethod
solve(p::GameProblem; verbose::Bool = false)::Vector{GameResult}

Solves a zero-sum game using the simplex method.

Arguments

  • p::GameProblem: The problem instance containing the decision matrix.
  • verbose: If true, prints the model information.

Returns

  • An array of GameResult objects containing the probabilities and value of the game.

Example

mat = [1 4 5; 5 6 2]

# 1 4 5
# 5 6 2
# The row player has 2 strategies, and the column player has 3 strategies.
# If the row player selects the first strategy and the column player selects the second strategy,
# the row player receives 4.

problem = GameProblem(mat)

result = solve(problem)

result1 = result[1]  # The result for the row player

println(result1.probabilities)
# 2-element Vector{Float64}:
#  0.42857142857142855
#  0.5714285714285714

println(result1.value)
# 3.285714285714285

result2 = result[2]  # The result for the column player

println(result2.probabilities)
# 3-element Vector{Float64}:
#   0.42857142857142855
#  -0.0
#   0.5714285714285714

println(result2.value)
# -3.285714285714285
source

GameResult

OperationsResearchModels.Game.GameResultType
GameResult

Description

A structure to hold the result of a game.

Fields

  • probabilities: Probabilities of the strategies
  • value: Value of the game
  • model::JuMP.Model: The JuMP model used to solve the game.
  • alpha::Float64: The lower bound of the game value (maximin).
  • beta::Float64: The upper bound of the game value (minimax).
  • strategytype::StrategyType: Indicates whether the optimal strategy is pure or mixed.
source