You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# where $n_i \in \{0, 1\}$ is the number of particles at site $i$, and $w_i$ is the weight associated with it. For unweighted graphs, the weights are uniform.
35
-
# The solution space hard-core lattice gas is equivalent to that of an independent set problem. The independent set problem involves finding a set of vertices in a graph such that no two vertices in the set are adjacent (i.e., there is no edge connecting them).
36
+
# $U$ is the repulsive interaction strength between two particles.
37
+
# To represent the independence constraint, we let $U = \infty$, i.e. coexitence of two particles at two sites connected by an edge is completely forbidden.
38
+
# The solution space hard-core lattice gas is equivalent to that of an independent set problem.
39
+
# The independent set problem involves finding a set of vertices in a graph such that no two vertices in the set are adjacent (i.e., there is no edge connecting them).
36
40
# One can create a tensor network based modeling of an independent set problem with package [`GenericTensorNetworks.jl`](https://github.com/QuEraComputing/GenericTensorNetworks.jl).
37
41
using GenericTensorNetworks
38
42
problem =IndependentSet(graph; optimizer=GreedyMethod());
39
43
40
-
# There has been a lot of discussions related to solution space properties in the `GenericTensorNetworks` [documentaion page](https://queracomputing.github.io/GenericTensorNetworks.jl/dev/generated/IndependentSet/).
41
-
# In this example, we show how to use `TensorInference` to use probabilistic inference for understand the finite temperature properties of this statistic physics model.
44
+
# There are plenty of discussions related to solution space properties in the `GenericTensorNetworks` [documentaion page](https://queracomputing.github.io/GenericTensorNetworks.jl/dev/generated/IndependentSet/).
45
+
# In this example, we show how to use `TensorInference` to use probabilistic inference for understand the finite temperature properties of this statistical model.
42
46
# We use [`TensorNetworkModel`](@ref) to convert a combinatorial optimization problem to a probabilistic model.
43
47
# Here, we let the inverse temperature be $\beta = 3$.
44
48
@@ -62,7 +66,8 @@ pmodel2 = TensorNetworkModel(problem, β; mars=[[e.src, e.dst] for e in edges(gr
62
66
mars =marginals(pmodel2);
63
67
64
68
# We show the probability that both sites on an edge are not occupied
65
-
show_graph(graph; locs=sites, edge_colors=[(b = mars[[e.src, e.dst]][1, 1]; (1-b, 1-b, 1-b)) for e inedges(graph)], texts=fill("", nv(graph)), edge_line_width=5)
69
+
show_graph(graph; locs=sites, edge_colors=[(b = mars[[e.src, e.dst]][1, 1]; (1-b, 1-b, 1-b)) for e inedges(graph)], texts=fill("", nv(graph)),
70
+
edge_line_widths=edge_colors=[8*mars[[e.src, e.dst]][1, 1] for e inedges(graph)])
66
71
67
72
# ## The most likely configuration
68
73
# The MAP and MMAP can be used to get the most likely configuration given an evidence.
@@ -90,5 +95,5 @@ sum(config2)
90
95
# One can ue [`sample`](@ref) to generate samples from hard-core lattice gas at finite temperature.
91
96
# The return value is a matrix, with the columns correspond to different samples.
0 commit comments