Built-in graphs
Following is the list of the graph models which are provided with the module. After loading the RRRMC
module, they can be constructed like in this example:
julia> X = RRRMC.GraphRRG(10, 3)
Note that for models which involve randomness in the constructor you may want to set the random seed with Random.seed!
before calling the constructor, for reproducibility purposes.
Basic spin glass models
Random regular graphs
RRRMC.RRG.GraphRRG
— TypeGraphRRG(N::Integer, K::Integer, LEV = (-1,1)) <: DiscrGraph
A DiscGraph
implementing a random regular graph with N
spins and connectivity K
. Note: N*K
must be even. Also, the graph generator uses the pairing model method by Bollobás, with a cutoff on the number of restarts, and thus it may occasionally fail if K
is large.
The interactions are extracted at random from LEV
, which must be a Tuple
of Real
s. No external fields.
RRRMC.RRG.GraphRRGNormal
— TypeGraphRRGNormal(N::Integer, K::Integer) <: SimpleGraph{Float64}
A SimpleGraph
implementing a random regular graph with N
spins and connectivity K
. Note: N*K
must be even. Also, the graph generator uses the pairing model method by Bollobás, with a cutoff on the number of restarts, and thus it may occasionally fail if K
is large.
Same as GraphRRG
, but the interactions are extracted from a normal distribution with unit variance.
RRRMC.RRG.GraphRRGNormalDiscretized
— TypeGraphRRGNormalDiscretized(N::Integer, K::Integer, LEV) <: DoubleGraph{DiscrGraph,Float64}
A DoubleGraph
implementing a random regular graph with N
spins and connectivity K
. Note: N*K
must be even. Also, the graph generator uses the pairing model method by Bollobás, with a cutoff on the number of restarts, and thus it may occasionally fail if K
is large.
The interactions are extracted from a normal distribution with unit variance, and are then discretized using the values in LEV
, which must be a Tuple
of Real
s. No external fields.
Same as GraphRRGNormal
, but it works differently when used with rrrMC
.
Edwards-Anderson graphs
RRRMC.EA.GraphEA
— TypeGraphEA(L::Integer, D::Integer, LEV = (-1,1)) <: DiscrGraph
An Edwards-Anderson DiscrGraph
: spins are arranged on a square lattice of size L
in D
dimensions (i.e. there are $L^D$ total spins), with periodic boundary conditions.
The interactions are extracted at random from LEV
, which must be a Tuple
of Real
s. No external fields.
RRRMC.EA.GraphEANormal
— TypeGraphEANormal(L::Integer, D::Integer) <: SimpleGraph{Float64}
An Edwards-Anderson SimpleGraph
: spins are arranged on a square lattice of size L
in D
dimensions (i.e. there are $L^D$ total spins), with periodic boundary conditions.
Same as GraphEA
, but the interactions are extracted from a normal distribution with unit variance.
RRRMC.EA.GraphEANormalDiscretized
— TypeGraphEANormalDiscretized(L::Integer, D::Integer, LEV) <: DoubleGraph{DiscrGraph,Float64}
An Edwards-Anderson DoubleGraph
: spins are arranged on a square lattice of size L
in D
dimensions (i.e. there are $L^D$ total spins), with periodic boundary conditions.
The interactions are extracted at random from a normal distribution with unit variance, and are then discretized using the values in LEV
, which must be a Tuple
of Real
s. No external fields.
Same as GraphEANormal
, but works differently when used with rrrMC
.
p-spin
RRRMC.PSpin3.GraphPSpin3
— TypeGraphPSpin3(N::Integer, K::Integer) <: DiscrGraph{Int}
A DiscrGraph
implementing a $p$-spin regular graph with $p=3$. N
is the number of spins, and must be divisible by $3$; K
is the connectivity. All interactions are set to $J=1$.
Sherrington-Kirkpatrick graphs
RRRMC.SK.GraphSK
— TypeGraphSK(N::Integer) <: SimpleGraph{Float64}
A SimpleGraph
implementing a Sherrington-Kirkpatrick fully-connected Ising model with N
spins and random binary interactions ($J ∈ \{-1/√N,1/√N\}$) and no external fields.
Same as GraphSKNormal
, but with binary interactions.
RRRMC.SK.GraphSKNormal
— TypeGraphSK(N::Integer) <: SimpleGraph{Float64}
A SimpleGraph
implementing a Sherrington-Kirkpatrick fully-connected Ising model with N
spins and random interactions extracted from a normal distribution with zero mean and $1/N$ variance, and no external fields.
Same as GraphSK
, but with Gaussian interactions.
Binary Neural Networks
RRRMC.PercStep.GraphPercStep
— TypeGraphPercStep(N::Integer, P::Integer) <: SimpleGraph{Int}
A SimpleGraph
implementing a single-layer binary perceptron with N
binary ($±1$) synapses, trained on P
random i.i.d. $±1$ patterns.
The energy of the model is computed as the number of misclassified patterns.
See also GraphPercLinear
, GraphPercXEntr
.
RRRMC.PercLinear.GraphPercLinear
— TypeGraphPercLinear(N::Integer, P::Integer) <: SimpleGraph{Float64}
A SimpleGraph
implementing a single-layer binary perceptron with N
binary ($±1$) synapses, trained on P
random i.i.d. $±1$ patterns.
The energy of the model is computed for each pattern as the minimum number of weights which need to be flipped in order to satisfy that pattern.
See also GraphPercStep
, GraphPercXEntr
.
RRRMC.PercXEntr.GraphPercXEntr
— TypeGraphPercXEntr(N::Integer, P::Integer, λ::Float64) <: SimpleGraph{Float64}
A SimpleGraph
implementing a single-layer binary perceptron with N
binary ($±1$) synapses, trained on P
random i.i.d. $±1$ patterns.
The energy of the model is computed for each pattern using the cross-entropy loss (with a λ
parameter: $\log(1 + \exp(-2λ σ⋅ξ / √N))$.
See also GraphPercStep
, GraphPercLinear
RRRMC.CommStep.GraphCommStep
— TypeGraphCommStep(K1::Integer, K2::Integer, P::Integer; fc = false) <: SimpleGraph{Int}
A SimpleGraph
implementing a two-layer binary committee machine with K2
hidden units, where each hidden unit has K1
binary ($±1$) synapses, trained on P
random i.i.d. $±1$ patterns. The output of each hidden unit is computed through a step function $sign(x)$. Both K1
and K2
must be odd. The default is to generate a tree-like machine, but it can be made fully-connected with the argument fc=true
.
The energy of the model is computed as the number of misclassified patterns.
RRRMC.CommReLU.GraphCommReLU
— TypeGraphCommReLU(K1::Integer, K2::Integer, P::Integer; fc = false) <: SimpleGraph{Int}
A SimpleGraph
implementing a two-layer binary committee machine with K2
hidden units, where each hidden unit has K1
binary ($±1$) synapses, trained on P
random i.i.d. $±1$ patterns. The output of each hidden unit is computed through a ReLU function $max(0,x)$, and then half of the K2
units have a negative weight associated to their output. Both K1
and K2
must be even. The default is to generate a tree-like machine, but it can be made fully-connected with the argument fc=true
.
The energy of the model is computed as the number of misclassified patterns.
RRRMC.CommQu.GraphCommQu
— TypeGraphCommQu(K1::Integer, K2::Integer, P::Integer; fc = false) <: SimpleGraph{Int}
A SimpleGraph
implementing a two-layer binary committee machine with K2
hidden units, where each hidden unit has K1
binary ($±1$) synapses, trained on P
random i.i.d. $±1$ patterns. The output of each hidden unit is computed through a quadratic function $x^2$, and then half of the K2
units have a negative weight associated to their output. Both K1
and K2
must be even. The default is to generate a tree-like machine, but it can be made fully-connected with the argument fc=true
.
The energy of the model is computed as the number of misclassified patterns.
SAT
RRRMC.SAT.GraphSAT
— TypeGraphSAT(N::Integer, α::Real, K::Integer)
A DiscrGraph
implementing a random K
-SAT graph with N
spins and αN
clauses.
The energy of the model is the number of violated clauses.
Quantum models with transverse fields
RRRMC.QT.GraphQuant
— TypeGraphQuant(N::Integer, M::Integer, Γ::Float64, β::Float64, Gconstr, args...) <: DoubleGraph
A DoubleGraph
which implements a quantum Ising spin model in a transverse magnetic field, using the Suzuki-Trotter transformation. This allows to model the quantum transverse field case for any classical Ising model previously defined. This kind of graph can be simulated efficiently with rrrMC
.
N
is the number of spins, M
the number of Suzuki-Trotter replicas, Γ
the transverse field, β
the inverse temperature. GConstr
is the (classical) graph constructor, and args
the arguments to the contructor.
See also Qenergy
and transverse_mag
.
Robust Ensemble models
RRRMC.RE.GraphRobustEnsemble
— TypeGraphRobustEnsemble(N::Integer, M::Integer, γ::Float64, β::Float64, Gconstr, args...) <: DoubleGraph
A DoubleGraph
which implements a "Robust Ensemble" model, given any other Ising model previously defined. This kind of graph can be simulated efficiently with rrrMC
.
N
is the number of spins, M
the number of replicas, γ
the interaction strength, β
the inverse temperature. GConstr
is the (original) graph constructor, and args
the arguments to the contructor.
This is similar to GraphLocalEntropy
, but the reference configuration is traced out.
See also REenergies
.
Local Entropy models
RRRMC.LE.GraphLocalEntropy
— TypeGraphLocalEntropy(N::Integer, M::Integer, γ::Float64, β::Float64, Gconstr, args...) <: DoubleGraph
A DoubleGraph
which implements a "Local Entropy" model, given any other Ising model previously defined. This simulates a replicated system in which each replica interacts with an extra "reference" configuration. This kind of graph can be simulated efficiently with rrrMC
.
N
is the number of spins, M
the number of replicas, γ
the interaction strength, β
the inverse temperature. GConstr
is the (original) graph constructor, and args
the arguments to the contructor.
This is similar to GraphRobustEnsemble
, but the reference is simulated explicitly.
See also LEenergies
and cenergy
.
RRRMC.TLE.GraphTopologicalLocalEntropy
— TypeGraphTopologicalLocalEntropy(N::Integer, M::Integer, γ::Float64, λ::Float64, β::Float64, Gconstr, args...) <: DoubleGraph
A DoubleGraph
which implements a "Local Entropy" model, given any other Ising model previously defined. This simulates a replicated system in which each replica interacts with an extra "reference" configuration. This kind of graph can be simulated efficiently with rrrMC
.
N
is the number of spins, M
the number of replicas, γ
the interaction strength of the replicas with the reference, λ
is the topological interaction strenght, β
the inverse temperature. GConstr
is the (original) graph constructor, and args
the arguments to the contructor.
This is similar to GraphLocalEntropy
, but with the additional topological interaction.
See also TLEenergies
and cenergy
.
Mixed models
RRRMC.Mixed.GraphMixed
— TypeGraphMixed(graphs::AbstractGraph...)
A SimpleGraph
mixing 2 or more base graphs into a single model. The energy function of a mixed graph is just the sum of the energy functions of the individual graphs in graphs
.
***Usage Example***:
X = RRRMC.GraphMixed(RRRMC.GraphRRG(10, 3),
RRRMC.GraphSK(10))
X = RRRMC.GraphMixed(RRRMC.GraphSK(31),
RRRMC.GraphPercStep(31, 30),
RRRMC.GraphSAT(31, 3, 4.2))
Models with additional fields
RRRMC.AddFields.GraphAddFields
— TypeGraphAddFields(fields::Vector, g::AbstractGraph) <: DoubleGraph
A DoubleGraph
that implements a model in which additional fields
are added to the graph g
. The additional fields can then be taken care of efficiently with rrrMC
.
RRRMC.AddFields.GraphAddSubFields
— TypeGraphAddSubFields(fields::Vector, g::AbstractGraph) <: DoubleGraph
A DoubleGraph
that implements a model in which the given fields
are added and subtracted to the graph g
. The fields can then be taken care of efficiently with rrrMC
.
Trivial models used for testing and debugging
RRRMC.Empty.GraphEmpty
— TypeGraphEmpty(N::Integer) <: SimpleGraph{Int}
A trivial SimpleGraph
type with N
free, non-interacting spins. (The energy is always 0
.)
Only useful for testing/debugging purposes.
RRRMC.TwoSpin.GraphTwoSpin
— TypeGraphTwoSpin() <: DiscrGraph{Int}
A trivial DiscrGraph
type with 2 spins inteacting ferromagnetically ($J=1$), without fields.
Only useful for testing/debugging purposes.
RRRMC.ThreeSpin.GraphThreeSpin
— TypeGraphThreeSpin() <: DiscrGraph{Int}
A trivial DiscrGraph
type with 3 spins, ferromagnetic interactions ($J=1$), no fields, and periodic boundary conditions.
Only useful for testing/debugging purposes.
RRRMC.Fields.GraphFields
— TypeGraphFields(N::Integer, LEV::Tuple = (1,)) <: DiscrGraph
A simple DiscrGraph
type with N
non-interacting variables, each of which is subject to a local field. The fields are extracted at random from LEV
, which must be a Tuple
of Real
s.
Mostly useful for testing/debugging purposes.
RRRMC.Fields.GraphFieldsNormalDiscretized
— TypeGraphFieldsNormalDiscretized(N::Integer, LEV::Tuple) <: DoubleGraph{Float64,GraphFields}
A simple DoubleGraph
type with N
non-interacting variables, each of which is subject to a local field. The fields are extracted independently from a normal distribution with unit variance, and then are discretized using the values in LEV
, which must be a Tuple
of Real
s.
Mostly useful for testing/debugging purposes.
RRRMC.Ising1D.GraphIsing1D
— TypeGraphIsing1D(N::Integer) <: DiscrGraph{Int}
A simple 1-dimensional DiscrGraph
type with N
spins, antiferromagnetic interactions ($J=-1$), contstant fields ($h=1$), and periodic boundary conditions.
Mostly useful for testing/debugging purposes.