BellScenario.jl - Games
BellScenario.AbstractGame — TypeAn AbstractGame is the abstract type that is parent to type representing a cost function for strategies. A Game is a linear inequality dual to Strategy matrices, it is represented by a matrix $G$ containing scalar coefficients and a bound $\beta$. The bound of the linear inequality is typically a maximum score attainable by Bell scenario using a certain set of resources. A Game $G$ is played by a Strategy $S$ to achieve a score computed as,
\[\beta \geq \langle G, S\rangle = \sum_{x,y} G_{y,x}S(y|x).\]
The game is "won" if the strategy scores greater than $\beta$, that is, the above inequality is violated. Since $\beta$ is the maximum score for a set of resources, the game is won only if the tested strategy used a set of resources of greater operational value than than considered when computing the bound $\beta$.
Conveniently, Strategy matrices have normalized columns and non-negative elements. This means that any game inequality can be converted into a form where game matrix $G$ has positive elements and $\beta$ designates a positive upper bound.
BellScenario.Game — TypeGame(game::Matrix{T}, β::Real) <: AbstractGame{T}A Game is represented by a Matrix of coefficients and a scalar bound β.
Type parameter T can be either Int64 or Float64.
BellScenario.BellGame — TypeBellGame(game::Matrix{Int64}, β::Int64, scenario::Scenario)A BellGame represents a Bell inequality or tight facet of the local polytope. Since the vertices of the local polytope are deterministic strategies with 0,1 elements, the linear inequalities describing facets of the local polytope have rational coefficients. Therefore, if a inequality tightly bounds the local polytope, it can be represented by a game with integer coefficients.
Conversion Methods
A BellGame is a matrix representation of a linear inequality that bounds a LocalPolytope for some Scenario. For convenience, conversion methods are provided to transform BellGames to alternative representations of polytope facets. There are two supported types which can be converted to/from BellGames:
- Facet -
Vector{Int64}, a column-major vectorization of the game matrix with the bound placed in the last element of the vector. IEQ- A facet data structure defined in XPORTA.jl.
Base.convert — MethodFacet (Vector{Int64}) -> BellGame
convert(
::Type{BellGame},
facet::Vector{Int64},
scenario::Union{BlackBox, LocalSignaling};
rep = "normalized"::String
)Base.convert — MethodFacet (Vector{Int64}) -> BellGame
convert(
::Type{BellGame},
facet::Vector{Int64},
scenario::BipartiteNonSignaling;
rep = "non-signaling"::String
)Transforms LocalPolytope facets into BellGame types.
Base.convert — MethodBellGame -> Facet (Vector{Int64})
convert(::Type{Vector{Int64}}, BG::BellGame; rep = "normalized" :: String)Base.convert — MethodBellGame -> Vector{Int64}
convert(::Type{Vector{Int64}},
BG::BellGame,
scenario::BipartiteNonSignaling;
rep = "non-signaling" :: String
)Transforms a BellGame for a BipartiteNonSignaling scenario into a facet vector.
Base.convert — MethodXPORTA.IEQ to BellGame's
convert(
::Type{Vector{BellGame}},
ieq::IEQ,
scenario::Union{BlackBox, LocalSignaling};
rep = "normalized" :: String
)Base.convert — MethodBellGame's to XPORTA.IEQ
convert(::Type{IEQ}, bell_games::Vector{BellGame}; rep = "normalized" :: String)File I/O
In practice, one may need to view are large set of BellGames in a human-readable form.
BellScenario.pretty_print_txt — Functionpretty_print_txt( bell_games :: Vector{BellGame}, filename :: String )Prints a set of BellGame's to filename.txt in a human-readable form.