Belief propagation
The SpinGlassPEPS.jl
package is capable of handling clusters with up to 24 spins, which results in a total of 2^24 degrees of freedom per cluster. This makes the contraction of the tensor network generated from such a Hamiltonian computationally expensive. To address this, SpinGlassPEPS.jl
offers an optional feature for local dimensional reduction of cluster degrees of freedom by selectively choosing the most probable states within each cluster. This method reduces the dimensionality of the problem by focusing on the most relevant and energetically favorable states. The marginal probabilities of each Potts variable are approximated using the Loopy Belief Propagation (LBP) algorithm.
SpinGlassNetworks.potts_hamiltonian_2site
— Functionpotts_hamiltonian_2site(
potts_h::LabelledGraphs.LabelledGraph{S, T},
beta::Real
) -> LabelledGraphs.LabelledGraph{MetaGraphs.MetaDiGraph{Int64, Float64}}
Constructs a Potts Hamiltonian for a given Potts Hamiltonian with a 2-site cluster approximation used in Pegasus graph.
Arguments:
potts_h::LabelledGraph{S, T}
: The Potts Hamiltonian represented as a labelled graph.beta::Real
: The inverse temperature parameter for the 2-site cluster Hamiltonian construction.
Returns:
new_potts_h::LabelledGraph{MetaDiGraph}
: A new labelled graph representing the 2-site cluster Hamiltonian.
This function constructs a Potts Hamiltonian potts_h
by applying a 2-site cluster approximation. It combines and merges vertices and edges of the original graph to create a simplified representation of the Hamiltonian.
The resulting new_potts_h
graph represents the 2-site cluster Hamiltonian with simplified interactions between clusters. The energy values, projectors, and spectra associated with the new vertices and edges are computed based on the provided temperature parameter beta
.
SpinGlassNetworks.belief_propagation
— Functionbelief_propagation(
potts_h::LabelledGraphs.LabelledGraph{S, T},
beta::Real;
tol,
iter
) -> Dict{Any, Any}
Perform loopy belief propagation on a given Potts Hamiltonian.
Arguments:
potts_h::LabelledGraph{S, T}
: The Potts Hamiltonian represented as a labelled graph.beta::Real
: The inverse temperature parameter for the belief propagation algorithm.tol::Real (optional, default=1e-6)
: The convergence tolerance. The algorithm stops when the message updates between iterations are smaller than this value.iter::Int (optional, default=1)
: The maximum number of iterations to perform.
Returns:
beliefs::Dict
: A dictionary where keys are vertices of Potts Hamiltonian, and values are the
resulting beliefs after belief propagation.
The function implements loopy belief propagation on the given Potts Hamiltonian potts_h
to calculate beliefs for each vertex. Belief propagation is an iterative algorithm that computes beliefs by passing messages between vertices and edges of the Potts Hamiltonian. The algorithm continues until convergence or until the specified maximum number of iterations is reached. The beliefs are computed based on the inverse temperature parameter beta
, which controls the influence of energy values on the beliefs.
SpinGlassNetworks.truncate_potts_hamiltonian_2site_BP
— Functiontruncate_potts_hamiltonian_2site_BP(
potts_h::LabelledGraphs.LabelledGraph{S, T},
beliefs::Dict,
num_states::Int64;
...
) -> LabelledGraphs.LabelledGraph{MetaGraphs.MetaDiGraph{Int64, Float64}}
truncate_potts_hamiltonian_2site_BP(
potts_h::LabelledGraphs.LabelledGraph{S, T},
beliefs::Dict,
num_states::Int64,
result_folder::String;
...
) -> LabelledGraphs.LabelledGraph{MetaGraphs.MetaDiGraph{Int64, Float64}}
truncate_potts_hamiltonian_2site_BP(
potts_h::LabelledGraphs.LabelledGraph{S, T},
beliefs::Dict,
num_states::Int64,
result_folder::String,
inst::String;
beta
) -> LabelledGraphs.LabelledGraph{MetaGraphs.MetaDiGraph{Int64, Float64}}
Truncate a Potts Hamiltonian based on 2-site belief propagation states.
This function truncates a Potts Hamiltonian by considering 2-site belief propagation states and selecting the most probable states to keep. It computes the beliefs for all 2-site combinations and selects the states that maximize the probability.
Arguments:
potts_h::LabelledGraph{S, T}
: The Potts Hamiltonian represented as a labelled graph.beliefs::Dict
: A dictionary containing belief values for 2-site interactions.num_states::Int
: The maximum number of most probable states to keep.beta::Real (optional)
: The inverse temperature parameter (default is 1.0).
Returns:
LabelledGraph{S, T}
: A truncated Potts Hamiltonian.