From 1d296b163fb5b4c974bbd3e64d12e8b880b9812a Mon Sep 17 00:00:00 2001 From: annamariadziubyna Date: Sun, 28 Jul 2024 20:02:18 +0200 Subject: [PATCH 01/12] add example for the paper --- benchmarks/bench.jl | 126 ++++++++++++++++++ publication/bench.jl | 54 ++++++++ .../instances/square_diagonal/3x3x2.txt | 89 +++++++++++++ 3 files changed, 269 insertions(+) create mode 100644 benchmarks/bench.jl create mode 100644 publication/bench.jl create mode 100644 publication/instances/square_diagonal/3x3x2.txt diff --git a/benchmarks/bench.jl b/benchmarks/bench.jl new file mode 100644 index 00000000..d5974753 --- /dev/null +++ b/benchmarks/bench.jl @@ -0,0 +1,126 @@ +using MPI +using LinearAlgebra +using MKL +using SpinGlassEngine +using SpinGlassNetworks +using SpinGlassTensors +using SpinGlassExhaustive +using Logging +using CSV +using DataFrames +using Memoization + +function brute_force_gpu(ig::IsingGraph; num_states::Int) + brute_force(ig, :GPU, num_states=num_states) +end + +MPI.Init() +size = MPI.Comm_size(MPI.COMM_WORLD) +rank = MPI.Comm_rank(MPI.COMM_WORLD) + +M, N, T = 7, 7, 3 +INSTANCE_DIR = "$(@__DIR__)/../test/instances/pegasus_random/P8/RCO/SpinGlass" +OUTPUT_DIR = "$(@__DIR__)/results/pegasus_random/P8/RCO/final_bench_float32_beta2" +if !Base.Filesystem.isdir(OUTPUT_DIR) + Base.Filesystem.mkpath(OUTPUT_DIR) +end +BETAS = [2.0,] #collect(0.5:0.5:3) +LAYOUT = (GaugesEnergy,) +TRANSFORM = all_lattice_transformations +TT = Float32 +GAUGE = NoUpdate +STRATEGY = Zipper #SVDTruncate +SPARSITY = Sparse +graduate_truncation = :graduate_truncate + +INDβ = [3,] #[1, 2, 3] +MAX_STATES = 1024 +BOND_DIM = 8 +DE = 16.0 + +MAX_SWEEPS = 0 +VAR_TOL = 1E-16 +TOL_SVD = 1E-16 +ITERS_SVD = 2 +ITERS_VAR = 1 +DTEMP_MULT = 2 +METHOD = :psvd_sparse +disable_logging(LogLevel(1)) +BLAS.set_num_threads(1) + +function pegasus_sim(inst, trans, β, Layout) + δp = 0.0 + + potts_h = potts_hamiltonian( + ising_graph(INSTANCE_DIR * "/" * inst), + spectrum=full_spectrum, + cluster_assignment_rule=pegasus_lattice((M, N, T)) + ) + params = MpsParameters{TT}(;bd=BOND_DIM, ϵ =TT(VAR_TOL), sw=MAX_SWEEPS, ts=TT(TOL_SVD), is=ITERS_SVD, iv=ITERS_VAR, dm=DTEMP_MULT, m=METHOD) + search_params = SearchParameters(;max_states=MAX_STATES, cut_off_prob=δp) + + net = PEPSNetwork{SquareCrossDoubleNode{Layout}, SPARSITY, TT}(M, N, potts_h, trans) + ctr = MpsContractor{STRATEGY, GAUGE, TT}(net, params; onGPU = true, βs = TT[β/6, β/3, β/2, β], graduate_truncation = graduate_truncation) + sol, s = low_energy_spectrum(ctr, search_params, merge_branches(ctr; merge_type=:nofit)) + + # cRAM = round(Base.summarysize(Memoization.caches) * 1E-9; sigdigits=2) + clear_memoize_cache() + sol, ctr +end + +function run_bench(inst::String, β::Real, t, l) + hash_name = hash(string(inst, β, t, l)) + out_path = string(OUTPUT_DIR, "/", hash_name, ".csv") + + if isfile(out_path) + println("Skipping for $β, $t, $l.") + else + data = try + tic_toc = @elapsed sol, ctr = pegasus_sim(inst, t, β, l) + + data = DataFrame( + :instance => inst, + :β => β, + :Layout => l, + :transform => t, + :energy => sol.energies[begin], + :probabilities => sol.probabilities, + :discarded_probability => sol.largest_discarded_probability, + :statistic => minimum(values(ctr.statistics)), + :max_states => MAX_STATES, + :bond_dim => BOND_DIM, + :de => DE, + :max_sweeps => MAX_SWEEPS, + :var_tol => VAR_TOL, + :time => tic_toc + # :cRAM => cRAM + ) + catch err + data = DataFrame( + :instance => inst, + :β => β, + :Layout => l, + :transform => t, + :max_states => MAX_STATES, + :bond_dim => BOND_DIM, + :de => DE, + :max_sweeps => MAX_SWEEPS, + :var_tol => VAR_TOL, + :error => err + ) + end + println(data) + CSV.write(out_path, data, delim = ';', append = false) + end #if +end + +all_params = collect( + Iterators.product( + readdir(INSTANCE_DIR, join=false), BETAS, TRANSFORM, LAYOUT) +) + +for i ∈ (1+rank):size:length(all_params) + run_bench(all_params[i]...) + GC.gc() +end +# run_bench(all_params[1]...) \ No newline at end of file diff --git a/publication/bench.jl b/publication/bench.jl new file mode 100644 index 00000000..9eb3a677 --- /dev/null +++ b/publication/bench.jl @@ -0,0 +1,54 @@ +using SpinGlassEngine +using SpinGlassNetworks + +function get_instance(topology::NTuple{3, Int}) + m, n, t = topology + "$(@__DIR__)/instances/square_diagonal/$(m)x$(n)x$(t).txt" +end + +function run_square_diag_bench(::Type{T}; topology::NTuple{3, Int}) where {T} + m, n, _ = topology + instance = get_instance(topology) + lattice = super_square_lattice(topology) + + hamming_dist = 5 + eng = 10 + + best_energies = T[] + + potts_h = potts_hamiltonian( + ising_graph(instance), + spectrum = full_spectrum, + cluster_assignment_rule = lattice, + ) + + params = MpsParameters{T}(; bd = 16, ϵ = T(1E-16), sw = 0, ts = T(1E-16)) + search_params = SearchParameters(; max_states = 2^8, cut_off_prob = T(1E-4)) + + for transform ∈ all_lattice_transformations + net = PEPSNetwork{KingSingleNode{GaugesEnergy}, Dense, T}( + m, n, potts_h, transform + ) + + ctr = MpsContractor{SVDTruncate, NoUpdate, T}( + net, params; onGPU = false, βs = [T(2)], graduate_truncation = :graduate_truncate + ) + + merge_strategy = merge_branches( + ctr; merge_type = :nofit, update_droplets = SingleLayerDroplets(eng, hamming_dist, :hamming) + ) + + sol, _ = low_energy_spectrum(ctr, search_params, merge_strategy) + + push!(best_energies, sol.energies[1]) + clear_memoize_cache() + end + + ground = best_energies[1] + @assert all(ground .≈ best_energies) + + println("Best energy found: $(ground)") +end + +T = Float64 +@time run_square_diag_bench(T; topology = (3, 3, 2)) \ No newline at end of file diff --git a/publication/instances/square_diagonal/3x3x2.txt b/publication/instances/square_diagonal/3x3x2.txt new file mode 100644 index 00000000..0e603cb5 --- /dev/null +++ b/publication/instances/square_diagonal/3x3x2.txt @@ -0,0 +1,89 @@ +1 2 -0.5320600854590267 +3 4 0.38402265869664154 +3 1 -0.5436924524983267 +3 2 0.21977738991479145 +4 1 -0.5628699912291399 +4 2 0.7923812769160723 +5 6 0.38332124497444475 +5 3 -0.2766447992621366 +5 4 0.43076811014522653 +6 3 0.08210571803994982 +6 4 -0.9915874978177643 +7 8 0.6014253456011047 +7 1 0.37763583164851355 +7 2 -0.26590744578208203 +8 1 0.9690946973530548 +8 2 -0.67694551766651 +9 10 -0.14153430905690412 +9 3 0.16759090162116919 +9 4 -0.8174998097136141 +10 3 -0.40403760194281046 +10 4 -0.6356483089131602 +9 7 0.04392506131183804 +9 8 0.9829874976922899 +10 7 -0.35689548049316144 +10 8 -0.1672648223095825 +9 1 -0.5786261566035802 +9 2 -0.34406623378116596 +10 1 0.100481750570526 +10 2 0.8038842162474464 +11 12 -0.8956911493893849 +11 5 -0.8630057217020062 +11 6 0.6306623988860585 +12 5 0.7504141436046725 +12 6 -0.9352371863606841 +11 9 -0.6803222587957678 +11 10 0.689782704271011 +12 9 0.7752150591589735 +12 10 -0.8343312141855883 +11 3 -0.5559557250718317 +11 4 0.17582966006044876 +12 3 0.19181763419530173 +12 4 0.27431075715253805 +13 14 0.7478095997218 +13 7 -0.4883614012946449 +13 8 0.9576256441396791 +14 7 -0.28912688765567185 +14 8 0.1089802463072973 +15 16 0.38262916472610375 +15 9 -0.3873909056772129 +15 10 -0.25725344989877863 +16 9 0.28309439316509377 +16 10 0.2501090573988438 +15 13 -0.6485175435412747 +15 14 -0.7668063443712008 +16 13 0.8137706230969115 +16 14 -0.2661847224606624 +15 7 -0.6442936476294694 +15 8 -0.5878720857895017 +16 7 -0.2581141133504936 +16 8 0.8888574164902534 +17 18 0.041339313482924744 +17 11 0.08787406849163526 +17 12 0.3277246664347784 +18 11 0.6635244080829124 +18 12 0.895970973800222 +17 15 -0.8035789245059162 +17 16 -0.21808521717755824 +18 15 -0.08569957531620931 +18 16 -0.49482281831259667 +17 9 0.2431182105351657 +17 10 0.20271622624323782 +18 9 0.6760555244443007 +18 10 -0.9602980312054934 +3 7 -0.24974831265384578 +3 8 0.9495698025338444 +4 7 0.8113253594825927 +4 8 0.7115673096585802 +5 9 0.025972963895515067 +5 10 -0.05189668641649137 +6 9 -0.28231537364653914 +6 10 -0.6298126342821251 +9 13 -0.17065967935812698 +9 14 -0.5828355422867022 +10 13 -0.6395271429265674 +10 14 -0.6326498113627528 +11 15 -0.342645305990952 +11 16 -0.6444311859249112 +12 15 0.5023530387484465 +12 16 0.4161687742404492 \ No newline at end of file From b95f5e8fb7ff80b5e0beb9e1a4a08524c3ae76eb Mon Sep 17 00:00:00 2001 From: annamariadziubyna Date: Tue, 30 Jul 2024 07:37:19 +0200 Subject: [PATCH 02/12] rename params in MpsParameters --- benchmarks/bench.jl | 6 +++--- examples/pegasus.jl | 2 +- publication/bench.jl | 2 +- src/contractor.jl | 18 +++++++++--------- src/king_single_node.jl | 4 +++- test/chimera_overlap_python.jl | 2 +- .../squarestar_double_node_zephyr.jl | 2 +- test/random_markov_field.jl | 2 +- test/search_chimera_droplets.jl | 2 +- test/search_chimera_full.jl | 2 +- test/search_chimera_pathological.jl | 2 +- test/search_chimera_pathological_Z2.jl | 2 +- test/search_chimera_pathological_droplets.jl | 2 +- test/search_chimera_pathological_hamming.jl | 2 +- test/search_chimera_smallest.jl | 2 +- test/search_chimera_smallest_droplets.jl | 2 +- test/search_cross_square_star.jl | 2 +- test/search_pegasus_droplets.jl | 2 +- test/search_pegasus_nodiag_square_cross.jl | 2 +- test/search_pegasus_square_cross.jl | 2 +- test/search_smallest_cross_square_cross.jl | 2 +- test/search_square_double_node_basic.jl | 2 +- test/search_square_lattice.jl | 2 +- test/search_squarecross_double_node_basic.jl | 2 +- 24 files changed, 36 insertions(+), 34 deletions(-) diff --git a/benchmarks/bench.jl b/benchmarks/bench.jl index d5974753..62dee3f3 100644 --- a/benchmarks/bench.jl +++ b/benchmarks/bench.jl @@ -20,14 +20,14 @@ rank = MPI.Comm_rank(MPI.COMM_WORLD) M, N, T = 7, 7, 3 INSTANCE_DIR = "$(@__DIR__)/../test/instances/pegasus_random/P8/RCO/SpinGlass" -OUTPUT_DIR = "$(@__DIR__)/results/pegasus_random/P8/RCO/final_bench_float32_beta2" +OUTPUT_DIR = "$(@__DIR__)/results/pegasus_random/P8/RCO/final_bench_float64_beta2" if !Base.Filesystem.isdir(OUTPUT_DIR) Base.Filesystem.mkpath(OUTPUT_DIR) end BETAS = [2.0,] #collect(0.5:0.5:3) LAYOUT = (GaugesEnergy,) TRANSFORM = all_lattice_transformations -TT = Float32 +TT = Float64 GAUGE = NoUpdate STRATEGY = Zipper #SVDTruncate SPARSITY = Sparse @@ -56,7 +56,7 @@ function pegasus_sim(inst, trans, β, Layout) spectrum=full_spectrum, cluster_assignment_rule=pegasus_lattice((M, N, T)) ) - params = MpsParameters{TT}(;bd=BOND_DIM, ϵ =TT(VAR_TOL), sw=MAX_SWEEPS, ts=TT(TOL_SVD), is=ITERS_SVD, iv=ITERS_VAR, dm=DTEMP_MULT, m=METHOD) + params = MpsParameters{TT}(;bond_dim=BOND_DIM, var_tol=TT(VAR_TOL), num_sweeps=MAX_SWEEPS, tol_SVD=TT(TOL_SVD), iters_SVD=ITERS_SVD, iters_var=ITERS_VAR, Dtemp_multiplier=DTEMP_MULT, method=METHOD) search_params = SearchParameters(;max_states=MAX_STATES, cut_off_prob=δp) net = PEPSNetwork{SquareCrossDoubleNode{Layout}, SPARSITY, TT}(M, N, potts_h, trans) diff --git a/examples/pegasus.jl b/examples/pegasus.jl index 3341d482..5eaa62a8 100644 --- a/examples/pegasus.jl +++ b/examples/pegasus.jl @@ -25,7 +25,7 @@ function bench(instance::String, β::Real, bond_dim::Integer, num_states::Intege cluster_assignment_rule = pegasus_lattice((m, n, t)), ) - params = MpsParameters{Float64}(; bd = bond_dim, ϵ = 1E-8, sw = 4, ts = 1E-16) + params = MpsParameters{Float64}(; bond_dim = bond_dim, var_tol = 1E-8, num_sweeps = 4, tol_SVD = 1E-16) search_params = SearchParameters(; max_states = num_states, cut_off_prob = δp) Strategy = Zipper Sparsity = Sparse diff --git a/publication/bench.jl b/publication/bench.jl index 9eb3a677..351cf982 100644 --- a/publication/bench.jl +++ b/publication/bench.jl @@ -22,7 +22,7 @@ function run_square_diag_bench(::Type{T}; topology::NTuple{3, Int}) where {T} cluster_assignment_rule = lattice, ) - params = MpsParameters{T}(; bd = 16, ϵ = T(1E-16), sw = 0, ts = T(1E-16)) + params = MpsParameters{T}(; bond_dim = 16, var_tol = T(1E-16), num_sweeps = 0, tol_SVD = T(1E-16)) search_params = SearchParameters(; max_states = 2^8, cut_off_prob = T(1E-4)) for transform ∈ all_lattice_transformations diff --git a/src/contractor.jl b/src/contractor.jl index fa1b7ea0..0aa3f79c 100644 --- a/src/contractor.jl +++ b/src/contractor.jl @@ -87,15 +87,15 @@ struct MpsParameters{S<:Real} method::Symbol MpsParameters{S}(; - bd = typemax(Int), - ϵ::S = S(1E-8), - sw = 4, - ts::S = S(1E-16), - is = 1, - iv = 1, - dm = 2, - m = :psvd_sparse, - ) where {S} = new(bd, ϵ, sw, ts, is, iv, dm, m) + bond_dim = typemax(Int), + var_tol::S = S(1E-8), + num_sweeps = 4, + tol_SVD::S = S(1E-16), + iters_svd = 1, + iters_var = 1, + Dtemp_multiplier = 2, + method = :psvd_sparse, + ) where {S} = new(bond_dim, var_tol, num_sweeps, tol_SVD, iters_svd, iters_var, Dtemp_multiplier, method) end """ diff --git a/src/king_single_node.jl b/src/king_single_node.jl index e646c186..2a4351cb 100644 --- a/src/king_single_node.jl +++ b/src/king_single_node.jl @@ -205,7 +205,7 @@ function conditional_probability( v = ((i, j - 1), (i - 1, j - 1), (i - 1, j)) @nexprs 3 k -> (en_k = projected_energy(ctr.peps, (i, j), v[k], ∂v[2*j-1+k])) probs = probability(local_energy(ctr.peps, (i, j)) .+ en_1 .+ en_2 .+ en_3, β) - + # println("probs1 ", probs) p_rb = projector(ctr.peps, (i, j), (i + 1, j - 1)) pr = projector(ctr.peps, (i, j), @ntuple 3 k -> (i + 2 - k, j + 1)) pd = projector(ctr.peps, (i, j), (i + 1, j)) @@ -219,7 +219,9 @@ function conditional_probability( m = @inbounds M[:, :, pd[σ]] r = @inbounds R[:, pr[σ]] @inbounds probs[σ] *= (lmx'*m*r)[] + # println("probs2 ", probs) end + # println("probs3 ", probs) push!(ctr.statistics, ((i, j), ∂v) => error_measure(probs)) normalize_probability(probs) diff --git a/test/chimera_overlap_python.jl b/test/chimera_overlap_python.jl index 6b031798..e102a4d6 100644 --- a/test/chimera_overlap_python.jl +++ b/test/chimera_overlap_python.jl @@ -24,7 +24,7 @@ potts_h = potts_hamiltonian( cluster_assignment_rule = super_square_lattice((m, n, t)), ) -params = MpsParameters{Float64}(; bd = bond_dim, ϵ = 1E-8, sw = 4) +params = MpsParameters{Float64}(; bond_dim = bond_dim, var_tol = 1E-8, num_sweeps = 4) search_params = SearchParameters(; max_states = num_states, cut_off_prob = δp) Strategy = SVDTruncate diff --git a/test/experimental/squarestar_double_node_zephyr.jl b/test/experimental/squarestar_double_node_zephyr.jl index 77a47098..d891ef9a 100644 --- a/test/experimental/squarestar_double_node_zephyr.jl +++ b/test/experimental/squarestar_double_node_zephyr.jl @@ -34,7 +34,7 @@ potts_h = potts_hamiltonian( iter = iter, ) -params = MpsParameters{Float64}(; bd = bond_dim, ϵ = 1E-8, sw = 10, ts = 1E-16) +params = MpsParameters{Float64}(; bond_dim = bond_dim, var_tol = 1E-8, num_sweeps = 10, tol_SVD = 1E-16) search_params = SearchParameters(num_states, δp) # Solve using PEPS search diff --git a/test/random_markov_field.jl b/test/random_markov_field.jl index d07861ff..bfa432ab 100644 --- a/test/random_markov_field.jl +++ b/test/random_markov_field.jl @@ -7,7 +7,7 @@ num_states = 64 potts_h = potts_hamiltonian(instance_dir) Nx, Ny = get_prop(potts_h, :Nx), get_prop(potts_h, :Ny) - params = MpsParameters{Float64}(; bd = bond_dim, ϵ = 1E-8, sw = 4) + params = MpsParameters{Float64}(; bond_dim = bond_dim, var_tol = 1E-8, num_sweeps = 4) search_params = SearchParameters(; max_states = num_states, cut_off_prob = δp) Gauge = NoUpdate graduate_truncation = :graduate_truncate diff --git a/test/search_chimera_droplets.jl b/test/search_chimera_droplets.jl index c86033fb..91f489e0 100644 --- a/test/search_chimera_droplets.jl +++ b/test/search_chimera_droplets.jl @@ -24,7 +24,7 @@ function bench(instance::String) spectrum = my_brute_force, cluster_assignment_rule = super_square_lattice((m, n, t)), ) - params = MpsParameters{Float64}(; bd = bond_dim, ϵ = 1E-8, sw = 4, ts = 1E-16) + params = MpsParameters{Float64}(; bond_dim = bond_dim, var_tol = 1E-8, num_sweeps = 4, tol_SVD = 1E-16) search_params = SearchParameters(; max_states = num_states, cut_off_prob = δp) energies = Vector{Float64}[] diff --git a/test/search_chimera_full.jl b/test/search_chimera_full.jl index 40733607..9d3c077d 100644 --- a/test/search_chimera_full.jl +++ b/test/search_chimera_full.jl @@ -23,7 +23,7 @@ function bench(instance::String) spectrum = full_spectrum, cluster_assignment_rule = super_square_lattice((m, n, t)), ) - params = MpsParameters{Float64}(; bd = bond_dim, ϵ = 1E-8, sw = 4, ts = 1E-16) + params = MpsParameters{Float64}(; bond_dim = bond_dim, var_tol = 1E-8, num_sweeps = 4, tol_SVD = 1E-16) search_params = SearchParameters(; max_states = num_states, cut_off_prob = δp) energies = Vector{Float64}[] diff --git a/test/search_chimera_pathological.jl b/test/search_chimera_pathological.jl index 21381225..f4bccf56 100644 --- a/test/search_chimera_pathological.jl +++ b/test/search_chimera_pathological.jl @@ -114,7 +114,7 @@ transform = $transform spectrum = full_spectrum, cluster_assignment_rule = super_square_lattice((m, n, t)), ) - params = MpsParameters{Float64}(; bd = bond_dim, ϵ = 1E-8, sw = 4) + params = MpsParameters{Float64}(; bond_dim = bond_dim, var_tol = 1E-8, num_sweeps = 4) search_params = SearchParameters(; max_states = num_states, cut_off_prob = 0.0) Gauge = NoUpdate diff --git a/test/search_chimera_pathological_Z2.jl b/test/search_chimera_pathological_Z2.jl index fc290780..5d4c7752 100644 --- a/test/search_chimera_pathological_Z2.jl +++ b/test/search_chimera_pathological_Z2.jl @@ -103,7 +103,7 @@ spectrum = full_spectrum, cluster_assignment_rule = super_square_lattice((m, n, t)), ) - params = MpsParameters{Float64}(; bd = bond_dim, ϵ = 1E-8, sw = 4) + params = MpsParameters{Float64}(; bond_dim = bond_dim, var_tol = 1E-8, num_sweeps = 4) search_params = SearchParameters(; max_states = num_states, cut_off_prob = 0.0) Gauge = NoUpdate diff --git a/test/search_chimera_pathological_droplets.jl b/test/search_chimera_pathological_droplets.jl index c379375f..b0389799 100644 --- a/test/search_chimera_pathological_droplets.jl +++ b/test/search_chimera_pathological_droplets.jl @@ -104,7 +104,7 @@ spectrum = full_spectrum, cluster_assignment_rule = super_square_lattice((m, n, t)), ) - params = MpsParameters{Float64}(; bd = bond_dim, ϵ = 1E-8, sw = 4) + params = MpsParameters{Float64}(; bond_dim = bond_dim, var_tol = 1E-8, num_sweeps = 4) search_params = SearchParameters(; max_states = num_states, cut_off_prob = 0.0) Gauge = NoUpdate diff --git a/test/search_chimera_pathological_hamming.jl b/test/search_chimera_pathological_hamming.jl index 7bee9ee9..dbb4e512 100644 --- a/test/search_chimera_pathological_hamming.jl +++ b/test/search_chimera_pathological_hamming.jl @@ -117,7 +117,7 @@ end cluster_assignment_rule = super_square_lattice((m, n, t)), ) - params = MpsParameters{Float64}(; bd = bond_dim, ϵ = 1E-8, sw = 4) + params = MpsParameters{Float64}(; bond_dim = bond_dim, var_tol = 1E-8, num_sweeps = 4) search_params = SearchParameters(; max_states = num_states, cut_off_prob = 0.0) Gauge = NoUpdate diff --git a/test/search_chimera_smallest.jl b/test/search_chimera_smallest.jl index ed266a82..d3f4da6f 100644 --- a/test/search_chimera_smallest.jl +++ b/test/search_chimera_smallest.jl @@ -20,7 +20,7 @@ Gauge = NoUpdate for T in [Float32, Float64] energies = Vector{T}[] - params = MpsParameters{T}(; bd = bond_dim, ϵ = T(1E-8), sw = 4) + params = MpsParameters{T}(; bond_dim = bond_dim, var_tol = T(1E-8), num_sweeps = 4) for Strategy ∈ (SVDTruncate, Zipper), Sparsity ∈ (Dense, Sparse), Layout ∈ (EnergyGauges, GaugesEnergy, EngGaugesEng), diff --git a/test/search_chimera_smallest_droplets.jl b/test/search_chimera_smallest_droplets.jl index a7af33e8..b0c8c3d8 100644 --- a/test/search_chimera_smallest_droplets.jl +++ b/test/search_chimera_smallest_droplets.jl @@ -16,7 +16,7 @@ cluster_assignment_rule = super_square_lattice((m, n, t)), ) - params = MpsParameters{Float64}(; bd = bond_dim, ϵ = 1E-8, sw = 4) + params = MpsParameters{Float64}(; bond_dim = bond_dim, var_tol = 1E-8, num_sweeps = 4) search_params = SearchParameters(; max_states = num_states, cut_off_prob = 0.0) Gauge = NoUpdate diff --git a/test/search_cross_square_star.jl b/test/search_cross_square_star.jl index 6b283ec6..844276a7 100644 --- a/test/search_cross_square_star.jl +++ b/test/search_cross_square_star.jl @@ -15,7 +15,7 @@ spectrum = full_spectrum, cluster_assignment_rule = super_square_lattice((m, n, t)), ) - params = MpsParameters{Float64}(; bd = bond_dim, ϵ = 1E-8, sw = 4) + params = MpsParameters{Float64}(; bond_dim = bond_dim, var_tol = 1E-8, num_sweeps = 4) search_params = SearchParameters(; max_states = num_states, cut_off_prob = 0.0) Gauge = NoUpdate diff --git a/test/search_pegasus_droplets.jl b/test/search_pegasus_droplets.jl index 415d8477..14a9daa2 100644 --- a/test/search_pegasus_droplets.jl +++ b/test/search_pegasus_droplets.jl @@ -24,7 +24,7 @@ function bench(instance::String) spectrum = my_brute_force, cluster_assignment_rule = pegasus_lattice((m, n, t)), ) - params = MpsParameters{Float64}(; bd = bond_dim, ϵ = 1E-8, sw = 4, ts = 1E-16) + params = MpsParameters{Float64}(; bond_dim = bond_dim, var_tol = 1E-8, num_sweeps = 4, tol_SVD = 1E-16) search_params = SearchParameters(; max_states = num_states, cut_off_prob = δp) energies = Vector{Float64}[] diff --git a/test/search_pegasus_nodiag_square_cross.jl b/test/search_pegasus_nodiag_square_cross.jl index 36bb3f62..112883b7 100644 --- a/test/search_pegasus_nodiag_square_cross.jl +++ b/test/search_pegasus_nodiag_square_cross.jl @@ -19,7 +19,7 @@ function bench(instance::String) spectrum = my_brute_force, cluster_assignment_rule = super_square_lattice((m, n, t)), ) - params = MpsParameters{Float64}(; bd = bond_dim, ϵ = 1E-8, sw = 4) + params = MpsParameters{Float64}(; bond_dim = bond_dim, var_tol = 1E-8, num_sweeps = 4) search_params = SearchParameters(; max_states = num_states, cut_off_prob = δp) # Solve using PEPS search diff --git a/test/search_pegasus_square_cross.jl b/test/search_pegasus_square_cross.jl index b32b6888..3166726d 100644 --- a/test/search_pegasus_square_cross.jl +++ b/test/search_pegasus_square_cross.jl @@ -17,7 +17,7 @@ function bench(instance::String) spectrum = my_brute_force, cluster_assignment_rule = super_square_lattice((m, n, t)), ) - params = MpsParameters{Float64}(; bd = bond_dim, ϵ = 1E-8, sw = 4) + params = MpsParameters{Float64}(; bond_dim = bond_dim, var_tol = 1E-8, num_sweeps = 4) search_params = SearchParameters(max_states = num_states, cut_off_prob = δp) Gauge = NoUpdate graduate_truncation = :graduate_truncate diff --git a/test/search_smallest_cross_square_cross.jl b/test/search_smallest_cross_square_cross.jl index 57c1bce8..ec7721a5 100644 --- a/test/search_smallest_cross_square_cross.jl +++ b/test/search_smallest_cross_square_cross.jl @@ -15,7 +15,7 @@ spectrum = full_spectrum, cluster_assignment_rule = super_square_lattice((m, n, t)), ) - params = MpsParameters{Float64}(; bd = bond_dim, ϵ = 1E-8, sw = 4) + params = MpsParameters{Float64}(; bond_dim = bond_dim, var_tol = 1E-8, num_sweeps = 4) search_params = SearchParameters(; max_states = num_states, cut_off_prob = 0.0) for Strategy ∈ (SVDTruncate, MPSAnnealing, Zipper), Sparsity ∈ (Dense, Sparse) diff --git a/test/search_square_double_node_basic.jl b/test/search_square_double_node_basic.jl index e4083a89..dda5b5cb 100644 --- a/test/search_square_double_node_basic.jl +++ b/test/search_square_double_node_basic.jl @@ -20,7 +20,7 @@ function run_test_square_double_node(instance, m, n, t) cluster_assignment_rule = super_square_lattice((m, n, 8)), ) - params = MpsParameters{Float64}(; bd = bond_dim, ϵ = 1E-8, sw = 4) + params = MpsParameters{Float64}(; bond_dim = bond_dim, var_tol = 1E-8, num_sweeps = 4) search_params = SearchParameters(; max_states = num_states, cut_off_prob = δp) energies = [] Gauge = NoUpdate diff --git a/test/search_square_lattice.jl b/test/search_square_lattice.jl index f1efcdf6..66dd95d2 100644 --- a/test/search_square_lattice.jl +++ b/test/search_square_lattice.jl @@ -15,7 +15,7 @@ function bench(instance::String) spectrum = full_spectrum, cluster_assignment_rule = super_square_lattice((m, n, t)), ) - params = MpsParameters{Float64}(; bd = bond_dim, ϵ = 1E-8, sw = 4) + params = MpsParameters{Float64}(; bond_dim = bond_dim, var_tol = 1E-8, num_sweeps = 4) search_params = SearchParameters(; max_states = num_states, cut_off_prob = δp) Gauge = NoUpdate graduate_truncation = :graduate_truncate diff --git a/test/search_squarecross_double_node_basic.jl b/test/search_squarecross_double_node_basic.jl index efef11f0..17458996 100644 --- a/test/search_squarecross_double_node_basic.jl +++ b/test/search_squarecross_double_node_basic.jl @@ -20,7 +20,7 @@ function run_test_squarecross_double_node(instance, m, n, t) cluster_assignment_rule = super_square_lattice((m, n, 8)), ) - params = MpsParameters{Float64}(; bd = bond_dim, ϵ = 1E-8, sw = 4) + params = MpsParameters{Float64}(; bond_dim = bond_dim, var_tol = 1E-8, num_sweeps = 4) search_params = SearchParameters(; max_states = num_states, cut_off_prob = δp) energies = [] Gauge = NoUpdate From ac7def56d7001da9bb55570285bab48faf4d0824 Mon Sep 17 00:00:00 2001 From: annamariadziubyna Date: Wed, 31 Jul 2024 09:45:28 +0200 Subject: [PATCH 03/12] rm MPSAnnealing, ctr.beta is now a scalar instead of a vector --- benchmarks/bench.jl | 9 +- docs/src/params.md | 5 - examples/pegasus.jl | 3 +- examples/truncation_BP.jl | 3 +- publication/bench.jl | 2 +- src/contractor.jl | 241 ++++-------------- src/king_single_node.jl | 8 +- src/search.jl | 10 +- src/square_cross_double_node.jl | 12 +- src/square_double_node.jl | 10 +- src/square_single_node.jl | 8 +- src/util.jl | 4 +- test/chimera_overlap_python.jl | 12 +- test/experimental/gauges.jl | 33 +-- test/experimental/gauges_cuda.jl | 5 +- test/experimental/mpo_size.jl | 6 +- test/experimental/sampling.jl | 2 +- test/experimental/search_chimera_gauge.jl | 5 +- .../squarestar_double_node_pegasus.jl | 4 +- .../squarestar_double_node_zephyr.jl | 2 +- test/experimental/truncate.jl | 5 +- test/experimental/truncate_small.jl | 4 +- test/experimental/zipper.jl | 13 +- test/mwe.jl | 2 +- test/random_markov_field.jl | 2 +- test/runtests.jl | 2 +- test/search_chimera_droplets.jl | 3 +- test/search_chimera_full.jl | 3 +- test/search_chimera_pathological.jl | 4 +- test/search_chimera_pathological_Z2.jl | 4 +- test/search_chimera_pathological_droplets.jl | 4 +- test/search_chimera_pathological_hamming.jl | 2 +- test/search_chimera_smallest.jl | 2 +- test/search_chimera_smallest_droplets.jl | 2 +- test/search_cross_square_star.jl | 4 +- test/search_full_chimera.jl | 2 +- test/search_pegasus_droplets.jl | 3 +- test/search_pegasus_nodiag_square_cross.jl | 4 +- test/search_pegasus_square_cross.jl | 4 +- test/search_smallest_cross_square_cross.jl | 4 +- test/search_square_double_node_basic.jl | 17 +- test/search_square_lattice.jl | 4 +- test/search_squarecross_double_node_basic.jl | 17 +- 43 files changed, 167 insertions(+), 328 deletions(-) diff --git a/benchmarks/bench.jl b/benchmarks/bench.jl index 62dee3f3..b2bf76f9 100644 --- a/benchmarks/bench.jl +++ b/benchmarks/bench.jl @@ -33,7 +33,6 @@ STRATEGY = Zipper #SVDTruncate SPARSITY = Sparse graduate_truncation = :graduate_truncate -INDβ = [3,] #[1, 2, 3] MAX_STATES = 1024 BOND_DIM = 8 DE = 16.0 @@ -56,11 +55,13 @@ function pegasus_sim(inst, trans, β, Layout) spectrum=full_spectrum, cluster_assignment_rule=pegasus_lattice((M, N, T)) ) - params = MpsParameters{TT}(;bond_dim=BOND_DIM, var_tol=TT(VAR_TOL), num_sweeps=MAX_SWEEPS, tol_SVD=TT(TOL_SVD), iters_SVD=ITERS_SVD, iters_var=ITERS_VAR, Dtemp_multiplier=DTEMP_MULT, method=METHOD) - search_params = SearchParameters(;max_states=MAX_STATES, cut_off_prob=δp) + # params = MpsParameters{TT}(;bond_dim=BOND_DIM, var_tol=TT(VAR_TOL), num_sweeps=MAX_SWEEPS, tol_SVD=TT(TOL_SVD), iters_SVD=ITERS_SVD, iters_var=ITERS_VAR, Dtemp_multiplier=DTEMP_MULT, method=METHOD) + params = MpsParameters{TT}(; bond_dim=BOND_DIM, var_tol=TT(VAR_TOL), num_sweeps=MAX_SWEEPS) + + search_params = SearchParameters(; max_states=MAX_STATES, cut_off_prob=δp) net = PEPSNetwork{SquareCrossDoubleNode{Layout}, SPARSITY, TT}(M, N, potts_h, trans) - ctr = MpsContractor{STRATEGY, GAUGE, TT}(net, params; onGPU = true, βs = TT[β/6, β/3, β/2, β], graduate_truncation = graduate_truncation) + ctr = MpsContractor{STRATEGY, GAUGE, TT}(net, params; onGPU = true, beta = TT(β), graduate_truncation = graduate_truncation) sol, s = low_energy_spectrum(ctr, search_params, merge_branches(ctr; merge_type=:nofit)) # cRAM = round(Base.summarysize(Memoization.caches) * 1E-9; sigdigits=2) diff --git a/docs/src/params.md b/docs/src/params.md index cc67e234..5b9adc8b 100644 --- a/docs/src/params.md +++ b/docs/src/params.md @@ -15,7 +15,6 @@ SearchParameters In the boundary MPS-MPO approach we apply Matrix Product Operator (MPO) to appropriate sites of Matrix Product State (MPS). In this context, the absorption of a MPO into a MPS leads to an exponential growth of the bond dimension. Hence, a truncation scheme is necessary to mitigate this issue and to keep the bond dimension in a reasonable size. Our package offers users the flexibility to choose between three distinct methods for optimizing the boundary MPS used in contracting the tensor network: * `Zipper` -* `MPSAnnealing` * `SVDTruncate`. `Zipper` method combines randomized truncated Singular Value Decomposition (SVD) and a variational scheme. ```@raw html @@ -25,10 +24,6 @@ With the `SVDTruncate` method, the Matrix Product State (MPS) is systematically ```@raw html ``` -On the other hand, the `MPSAnnealing` method tailors the construction of MPS based on variational compression. -```@raw html - -``` # Sparsity Our software package acknowledges the importance of two fundamental methodologies in tensor processing diff --git a/examples/pegasus.jl b/examples/pegasus.jl index 5eaa62a8..9abec06e 100644 --- a/examples/pegasus.jl +++ b/examples/pegasus.jl @@ -17,7 +17,6 @@ function bench(instance::String, β::Real, bond_dim::Integer, num_states::Intege dE = 3.0 δp = exp(-β * dE) - all_betas = [β / 8, β / 4, β / 2, β] potts_h = potts_hamiltonian( ising_graph(instance), @@ -36,7 +35,7 @@ function bench(instance::String, β::Real, bond_dim::Integer, num_states::Intege ctr = MpsContractor{Strategy,Gauge,Float64}( net, params; - βs = all_betas, + beta = β, graduate_truncation = :graduate_truncate, onGPU = onGPU, ) diff --git a/examples/truncation_BP.jl b/examples/truncation_BP.jl index 751b0a6a..cfb7ae13 100644 --- a/examples/truncation_BP.jl +++ b/examples/truncation_BP.jl @@ -27,7 +27,6 @@ Dcut = 8 tolV = 1E-16 tolS = 1E-16 max_sweeps = 0 -indβ = 1 ITERS_SVD = 2 ITERS_VAR = 1 DTEMP_MULT = 2 @@ -43,7 +42,7 @@ params = MpsParameters(Dcut, tolV, max_sweeps, tolS, ITERS_SVD, ITERS_VAR, DTEMP_MULT, METHOD) search_params = SearchParameters(MAX_STATES, δp) -Strategy = Zipper # MPSAnnealing SVDTruncate +Strategy = Zipper # SVDTruncate Layout = GaugesEnergy Gauge = NoUpdate cl_states = [2^10] diff --git a/publication/bench.jl b/publication/bench.jl index 351cf982..7fb6bc32 100644 --- a/publication/bench.jl +++ b/publication/bench.jl @@ -31,7 +31,7 @@ function run_square_diag_bench(::Type{T}; topology::NTuple{3, Int}) where {T} ) ctr = MpsContractor{SVDTruncate, NoUpdate, T}( - net, params; onGPU = false, βs = [T(2)], graduate_truncation = :graduate_truncate + net, params; onGPU = false, beta = T(2), graduate_truncation = :graduate_truncate ) merge_strategy = merge_branches( diff --git a/src/contractor.jl b/src/contractor.jl index 0aa3f79c..8ce397c3 100644 --- a/src/contractor.jl +++ b/src/contractor.jl @@ -1,5 +1,4 @@ export SVDTruncate, - MPSAnnealing, Zipper, MpoLayers, MpsParameters, @@ -35,7 +34,6 @@ abstract type AbstractStrategy end abstract type AbstractGauge end struct SVDTruncate <: AbstractStrategy end -struct MPSAnnealing <: AbstractStrategy end struct Zipper <: AbstractStrategy end struct GaugeStrategyWithBalancing <: AbstractGauge end struct GaugeStrategy <: AbstractGauge end @@ -146,7 +144,7 @@ It encapsulates various components and settings required for the contraction pro mutable struct MpsContractor{T<:AbstractStrategy,R<:AbstractGauge,S<:Real} <: AbstractContractor peps::PEPSNetwork{T} where {T} - betas::Vector{S} + beta::S graduate_truncation::Symbol depth::Int params::MpsParameters{S} @@ -161,7 +159,7 @@ mutable struct MpsContractor{T<:AbstractStrategy,R<:AbstractGauge,S<:Real} <: function MpsContractor{T,R,S}( net, params; - βs::Vector{S}, + beta::S, graduate_truncation::Symbol, onGPU = true, depth::Int = 0, @@ -173,7 +171,7 @@ mutable struct MpsContractor{T<:AbstractStrategy,R<:AbstractGauge,S<:Real} <: node = ord[begin] new( net, - βs, + beta, graduate_truncation, depth, params, @@ -208,7 +206,6 @@ Construct and memoize a Matrix Product Operator (MPO) for a given set of layers. - `ctr::MpsContractor{T}`: The MpsContractor object representing the PEPS network contraction. - `layers::Dict{Site, Sites}`: A dictionary mapping sites to their corresponding layers. - `r::Int`: The current row index. -- `indβ::Int`: The index of the beta values. # Returns - `QMpo`: The constructed MPO for the specified layers. @@ -219,13 +216,12 @@ This function constructs an MPO by iterating through the specified layers and as ctr::MpsContractor{T,R,S}, layers::Dict{Site,Sites}, r::Int, - indβ::Int, ) where {T<:AbstractStrategy,R,S} mpo = Dict{Site,MpoTensor{S}}() for (site, coordinates) ∈ layers lmpo = TensorMap{S}() for dr ∈ coordinates - ten = tensor(ctr.peps, PEPSNode(r + dr, site), ctr.betas[indβ]) + ten = tensor(ctr.peps, PEPSNode(r + dr, site), ctr.beta) push!(lmpo, dr => ten) end push!(mpo, site => MpoTensor(lmpo)) @@ -241,7 +237,6 @@ Construct and memoize the top Matrix Product State (MPS) using Singular Value De # Arguments - `ctr::MpsContractor{SVDTruncate}`: The MpsContractor object representing the PEPS network contraction with SVD truncation. - `i::Int`: The current row index. -- `indβ::Int`: The index of the beta values. # Returns - `QMps`: The constructed top MPS for the specified row. @@ -251,7 +246,6 @@ This function constructs the top MPS using SVD for a given row in the PEPS netwo @memoize Dict function mps_top( ctr::MpsContractor{SVDTruncate,R,S}, i::Int, - indβ::Int, ) where {R,S} Dcut = ctr.params.bond_dimension tolV = ctr.params.variational_tol @@ -259,12 +253,12 @@ This function constructs the top MPS using SVD for a given row in the PEPS netwo max_sweeps = ctr.params.max_num_sweeps if i < 1 - W = mpo(ctr, ctr.layers.main, 1, indβ) + W = mpo(ctr, ctr.layers.main, 1) return IdentityQMps(S, local_dims(W, :up); onGPU = ctr.onGPU) end - ψ = mps_top(ctr, i - 1, indβ) - W = transpose(mpo(ctr, ctr.layers.main, i, indβ)) + ψ = mps_top(ctr, i - 1) + W = transpose(mpo(ctr, ctr.layers.main, i)) ψ0 = dot(W, ψ) canonise!(ψ0, :right) @@ -285,7 +279,6 @@ Construct and memoize the (bottom) Matrix Product State (MPS) using Singular Val # Arguments - `ctr::MpsContractor{SVDTruncate}`: The MpsContractor object representing the PEPS network contraction with SVD truncation. - `i::Int`: The current row index. -- `indβ::Int`: The index of the beta values. # Returns - `QMps`: The constructed (bottom) MPS for the specified row. @@ -295,7 +288,6 @@ This function constructs the (bottom) MPS using SVD for a given row in the PEPS @memoize Dict function mps( ctr::MpsContractor{SVDTruncate,R,S}, i::Int, - indβ::Int, ) where {R,S} Dcut = ctr.params.bond_dimension tolV = ctr.params.variational_tol @@ -303,12 +295,12 @@ This function constructs the (bottom) MPS using SVD for a given row in the PEPS max_sweeps = ctr.params.max_num_sweeps if i > ctr.peps.nrows - W = mpo(ctr, ctr.layers.main, ctr.peps.nrows, indβ) + W = mpo(ctr, ctr.layers.main, ctr.peps.nrows) return IdentityQMps(S, local_dims(W, :down); onGPU = ctr.onGPU) end - ψ = mps(ctr, i + 1, indβ) - W = mpo(ctr, ctr.layers.main, i, indβ) + ψ = mps(ctr, i + 1) + W = mpo(ctr, ctr.layers.main, i) ψ0 = dot(W, ψ) canonise!(ψ0, :right) @@ -330,7 +322,6 @@ Construct and memoize the (bottom) Matrix Product State (MPS) approximation usin # Arguments - `ctr::MpsContractor{SVDTruncate}`: The MpsContractor object representing the PEPS network contraction with SVD truncation. - `i::Int`: The current row index. -- `indβ::Int`: The index of the beta values. # Returns - `QMps`: The constructed (bottom) MPS approximation for the specified row. @@ -340,14 +331,13 @@ This function constructs the (bottom) MPS approximation using SVD for a given ro @memoize Dict function mps_approx( ctr::MpsContractor{SVDTruncate,R,S}, i::Int, - indβ::Int, ) where {R,S} if i > ctr.peps.nrows - W = mpo(ctr, ctr.layers.main, ctr.peps.nrows, indβ) + W = mpo(ctr, ctr.layers.main, ctr.peps.nrows) return IdentityQMps(S, local_dims(W, :down); onGPU = ctr.onGPU) # F64 for now end - W = mpo(ctr, ctr.layers.main, i, indβ) + W = mpo(ctr, ctr.layers.main, i) ψ = IdentityQMps(S, local_dims(W, :down); onGPU = ctr.onGPU) # F64 for now ψ0 = dot(W, ψ) @@ -374,7 +364,6 @@ Construct and memoize the top Matrix Product State (MPS) using the Zipper (trunc # Arguments - `ctr::MpsContractor{Zipper}`: The MpsContractor object representing the PEPS network contraction with the Zipper method. - `i::Int`: The current row index. -- `indβ::Int`: The index of the beta values. # Returns - `QMps`: The constructed top MPS using the Zipper method for the specified row. @@ -384,7 +373,6 @@ This function constructs the top Matrix Product State (MPS) using the Zipper (tr @memoize Dict function mps_top( ctr::MpsContractor{Zipper,R,S}, i::Int, - indβ::Int, ) where {R,S} Dcut = ctr.params.bond_dimension tolV = ctr.params.variational_tol @@ -396,12 +384,12 @@ This function constructs the top Matrix Product State (MPS) using the Zipper (tr method = ctr.params.method depth = ctr.depth if i < 1 - W = mpo(ctr, ctr.layers.main, 1, indβ) + W = mpo(ctr, ctr.layers.main, 1) return IdentityQMps(S, local_dims(W, :up); onGPU = ctr.onGPU) # F64 for now end - ψ = mps_top(ctr, i - 1, indβ) - W = transpose(mpo(ctr, ctr.layers.main, i, indβ)) + ψ = mps_top(ctr, i - 1) + W = transpose(mpo(ctr, ctr.layers.main, i)) canonise!(ψ, :left) ψ0 = zipper( @@ -428,14 +416,13 @@ Construct and memoize the (bottom) Matrix Product State (MPS) using the Zipper ( # Arguments - `ctr::MpsContractor{Zipper}`: The MpsContractor object representing the PEPS network contraction with the Zipper method. - `i::Int`: The current row index. -- `indβ::Int`: The index of the beta values. # Returns - `QMps`: The constructed (bottom) MPS using the Zipper method for the specified row. This function constructs the (bottom) Matrix Product State (MPS) using the Zipper (truncated Singular Value Decomposition) method for a given row in the PEPS network contraction. It recursively builds the MPS row by row, performing canonicalization, and truncation steps based on the specified parameters in `ctr.params`. The resulting MPS is memoized for efficient reuse. """ -@memoize Dict function mps(ctr::MpsContractor{Zipper,R,S}, i::Int, indβ::Int) where {R,S} +@memoize Dict function mps(ctr::MpsContractor{Zipper,R,S}, i::Int) where {R,S} Dcut = ctr.params.bond_dimension tolV = ctr.params.variational_tol tolS = ctr.params.tol_SVD @@ -447,11 +434,11 @@ This function constructs the (bottom) Matrix Product State (MPS) using the Zippe depth = ctr.depth if i > ctr.peps.nrows - W = mpo(ctr, ctr.layers.main, ctr.peps.nrows, indβ) + W = mpo(ctr, ctr.layers.main, ctr.peps.nrows) ψ0 = IdentityQMps(S, local_dims(W, :down); onGPU = ctr.onGPU) else - ψ = mps(ctr, i + 1, indβ) - W = mpo(ctr, ctr.layers.main, i, indβ) + ψ = mps(ctr, i + 1) + W = mpo(ctr, ctr.layers.main, i) canonise!(ψ, :left) ψ0 = zipper( W, @@ -473,139 +460,31 @@ end """ $(TYPEDSIGNATURES) -Construct and memoize the (bottom) top Matrix Product State (MPS) using the Annealing method for a given row. - -# Arguments -- `ctr::MpsContractor{MPSAnnealing}`: The MpsContractor object representing the PEPS network contraction with the Annealing method. -- `i::Int`: The current row index. -- `indβ::Int`: The index of the beta values. - -# Returns -- `QMps`: The constructed (bottom) top MPS using the Annealing method for the specified row. - -This function constructs the (bottom) top Matrix Product State (MPS) using the Annealing method for a given row in the PEPS network contraction. It recursively builds the MPS row by row, performing variational compression steps based on the specified parameters in `ctr.params`. The resulting MPS is memoized for efficient reuse. -""" -@memoize Dict function mps_top( - ctr::MpsContractor{MPSAnnealing,R,S}, - i::Int, - indβ::Int, -) where {R,S} - if i < 1 - W = mpo(ctr, ctr.layers.main, 1, indβ) - return IdentityQMps(S, local_dims(W, :up); onGPU = ctr.onGPU) - end - - ψ = mps_top(ctr, i - 1, indβ) - W = transpose(mpo(ctr, ctr.layers.main, i, indβ)) - - if indβ > 1 - ψ0 = mps_top(ctr, i, indβ - 1) - else - ψ0 = IdentityQMps( - S, - local_dims(W, :up), - ctr.params.bond_dimension; - onGPU = ctr.onGPU, - ) - # ψ0 = IdentityQMps(S, local_dims(W, :down), ctr.params.bond_dimension) # F64 for now - canonise!(ψ0, :left) - end - variational_compress!(ψ0, W, ψ, ctr.params.variational_tol, ctr.params.max_num_sweeps) - ψ0 -end - -""" -$(TYPEDSIGNATURES) - -Construct and memoize the (bottom) Matrix Product State (MPS) using the Annealing method for a given row. - -# Arguments -- `ctr::MpsContractor{MPSAnnealing}`: The MpsContractor object representing the PEPS network contraction with the Annealing method. -- `i::Int`: The current row index. -- `indβ::Int`: The index of the beta values. - -# Returns -- `QMps`: The constructed (bottom) MPS using the Annealing method for the specified row. - -This function constructs the (bottom) Matrix Product State (MPS) using the Annealing method for a given row in the PEPS network contraction. It recursively builds the MPS row by row, performing variational compression steps based on the specified parameters in `ctr.params`. The resulting MPS is memoized for efficient reuse. -""" -@memoize Dict function mps( - ctr::MpsContractor{MPSAnnealing,R,S}, - i::Int, - indβ::Int, -) where {R,S} - if i > ctr.peps.nrows - W = mpo(ctr, ctr.layers.main, ctr.peps.nrows, indβ) - return IdentityQMps(S, local_dims(W, :down); onGPU = ctr.onGPU) - end - - ψ = mps(ctr, i + 1, indβ) - W = mpo(ctr, ctr.layers.main, i, indβ) - - if indβ > 1 - ψ0 = mps(ctr, i, indβ - 1) - else - ψ0 = IdentityQMps( - S, - local_dims(W, :up), - ctr.params.bond_dimension; - onGPU = ctr.onGPU, - ) - canonise!(ψ0, :left) - end - - variational_compress!(ψ0, W, ψ, ctr.params.variational_tol, ctr.params.max_num_sweeps) - ψ0 -end - -""" -$(TYPEDSIGNATURES) - -Construct dressed Matrix Product State (MPS) for a given row and strategy. - -# Arguments -- `ctr::MpsContractor{T}`: The MpsContractor object representing the PEPS network contraction. -- `i::Int`: The current row index. - -# Returns -- `QMps`: The constructed dressed MPS for the specified row. - -This function constructs the dressed Matrix Product State (MPS) for a given row in the PEPS network contraction using the specified strategy. It internally calculates the length of the `ctr.betas` vector and then calls `dressed_mps(ctr, i, length(ctr.betas))` to construct the dressed MPS with the given parameters. -""" -function dressed_mps(ctr::MpsContractor{T}, i::Int) where {T<:AbstractStrategy} - dressed_mps(ctr, i, length(ctr.betas)) -end - -""" -$(TYPEDSIGNATURES) - Construct (and memoize) dressed Matrix Product State (MPS) for a given row and strategy. # Arguments - `ctr::MpsContractor{T}`: The MpsContractor object representing the PEPS network contraction. - `i::Int`: The current row index. -- `indβ::Int`: The index of the beta parameter vector used for construction. # Returns - `QMps`: The constructed dressed MPS for the specified row and strategy. -This function constructs the dressed Matrix Product State (MPS) for a given row in the PEPS network contraction using the specified strategy and memoizes the result for future use. It takes into account the beta parameter index `indβ` and internally calls other functions such as `mps` and `mpo` to construct the dressed MPS. Additionally, it normalizes the MPS tensors to ensure numerical stability. +This function constructs the dressed Matrix Product State (MPS) for a given row in the PEPS network contraction using the specified strategy and memoizes the result for future use. It internally calls other functions such as `mps` and `mpo` to construct the dressed MPS. Additionally, it normalizes the MPS tensors to ensure numerical stability. Note: The memoization ensures that the dressed MPS is only constructed once for each combination of arguments and is reused when needed. """ @memoize Dict function dressed_mps( ctr::MpsContractor{T}, i::Int, - indβ::Int, ) where {T<:AbstractStrategy} - ψ = mps(ctr, i + 1, indβ) + ψ = mps(ctr, i + 1) caches = Memoization.find_caches(mps) - delete!(caches[mps], ((ctr, i + 1, indβ), ())) + delete!(caches[mps], ((ctr, i + 1), ())) if ctr.onGPU ψ = move_to_CUDA!(ψ) end - W = mpo(ctr, ctr.layers.dress, i, indβ) + W = mpo(ctr, ctr.layers.dress, i) ϕ = dot(W, ψ) for j ∈ ϕ.sites nrm = maximum(abs.(ϕ[j])) @@ -625,12 +504,11 @@ Construct (and memoize) the right environment tensor for a given node in the PEP - `ctr::MpsContractor{T}`: The MpsContractor object representing the PEPS network contraction. - `i::Int`: The current row index. - `∂v::Vector{Int}`: A vector representing the partial environment configuration. -- `indβ::Int`: The index of the beta parameter vector used for construction. # Returns - `Array{S,2}`: The constructed right environment tensor for the specified node. -This function constructs the right environment tensor for a given node in the PEPS network contraction using the specified strategy and memoizes the result for future use. It takes into account the beta parameter index `indβ` and internally calls other functions such as `dressed_mps` and `mpo` to construct the right environment tensor. Additionally, it normalizes the right environment tensor to ensure numerical stability. +This function constructs the right environment tensor for a given node in the PEPS network contraction using the specified strategy and memoizes the result for future use. It internally calls other functions such as `dressed_mps` and `mpo` to construct the right environment tensor. Additionally, it normalizes the right environment tensor to ensure numerical stability. Note: The memoization ensures that the right environment tensor is only constructed once for each combination of arguments and is reused when needed. """ @@ -638,19 +516,18 @@ Note: The memoization ensures that the right environment tensor is only construc ctr::MpsContractor{T,R,S}, i::Int, ∂v::Vector{Int}, - indβ::Int, ) where {T<:AbstractStrategy,R,S} l = length(∂v) if l == 0 return ctr.onGPU ? CUDA.ones(S, 1, 1) : ones(S, 1, 1) end - R̃ = right_env(ctr, i, ∂v[2:l], indβ) + R̃ = right_env(ctr, i, ∂v[2:l]) if ctr.onGPU R̃ = CuArray(R̃) end - ϕ = dressed_mps(ctr, i, indβ) - W = mpo(ctr, ctr.layers.right, i, indβ) + ϕ = dressed_mps(ctr, i) + W = mpo(ctr, ctr.layers.right, i) k = length(ϕ.sites) site = ϕ.sites[k-l+1] M = W[site] @@ -684,12 +561,11 @@ Construct (and memoize) the left environment tensor for a given node in the PEPS - `ctr::MpsContractor{T}`: The MpsContractor object representing the PEPS network contraction. - `i::Int`: The current row index. - `∂v::Vector{Int}`: A vector representing the partial environment configuration. -- `indβ::Int`: The index of the beta parameter vector used for construction. # Returns - `Array{S,2}`: The constructed left environment tensor for the specified node. -This function constructs the left environment tensor for a given node in the PEPS network contraction using the specified strategy and memoizes the result for future use. It takes into account the beta parameter index `indβ` and internally calls other functions such as `dressed_mps` to construct the left environment tensor. Additionally, it normalizes the left environment tensor to ensure numerical stability. +This function constructs the left environment tensor for a given node in the PEPS network contraction using the specified strategy and memoizes the result for future use. It internally calls other functions such as `dressed_mps` to construct the left environment tensor. Additionally, it normalizes the left environment tensor to ensure numerical stability. Note: The memoization ensures that the left environment tensor is only constructed once for each combination of arguments and is reused when needed. @@ -698,15 +574,14 @@ Note: The memoization ensures that the left environment tensor is only construct ctr::MpsContractor{T,R,S}, i::Int, ∂v::Vector{Int}, - indβ::Int, ) where {T,R,S} l = length(∂v) if l == 0 return ctr.onGPU ? CUDA.ones(S, 1) : ones(S, 1) end - L̃ = left_env(ctr, i, ∂v[1:l-1], indβ) - ϕ = dressed_mps(ctr, i, indβ) + L̃ = left_env(ctr, i, ∂v[1:l-1]) + ϕ = dressed_mps(ctr, i) m = ∂v[l] site = ϕ.sites[l] M = ϕ[site] @@ -744,7 +619,7 @@ end $(TYPEDSIGNATURES) Clear memoization cache for specific operations for a given row and index beta. -This function clears the memoization cache for specific operations used in the PEPS network contraction for a given row and index beta (indβ). +This function clears the memoization cache for specific operations used in the PEPS network contraction for a given row. The cleared operations include `mps_top`, `mps`, `mpo`, `dressed_mps`, and related operations. Memoization is used to optimize the contraction process by avoiding redundant computations. Calling this function allows you to clear the cache for these specific operations for a particular row and index beta, which can be useful when you want to free up memory or ensure that the cache is refreshed with updated data for a specific computation. @@ -752,38 +627,34 @@ Calling this function allows you to clear the cache for these specific operation # Arguments - `ctr::MpsContractor{T, S}`: The PEPS network contractor object. - `row::Site`: The row for which the cache should be cleared. -- `indβ::Int`: The index beta for which the cache should be cleared. """ -function clear_memoize_cache(ctr::MpsContractor{T,S}, row::Site, indβ::Int) where {T,S} - for ind ∈ 1:indβ # indbeta a vector? - for i ∈ row:ctr.peps.nrows - delete!(Memoization.caches[mps_top], ((ctr, i, ind), ())) - end - for i ∈ 1:row+1 - delete!(Memoization.caches[mps], ((ctr, i, ind), ())) - end - for i ∈ row:row+2 - cmpo = Memoization.caches[mpo] - delete!(cmpo, ((ctr, ctr.layers.main, i, ind), ())) - delete!(cmpo, ((ctr, ctr.layers.dress, i, ind), ())) - delete!(cmpo, ((ctr, ctr.layers.right, i, ind), ())) - end - +function clear_memoize_cache(ctr::MpsContractor{T,S}, row::Site) where {T,S} + for i ∈ row:ctr.peps.nrows + delete!(Memoization.caches[mps_top], ((ctr, i), ())) + end + for i ∈ 1:row+1 + delete!(Memoization.caches[mps], ((ctr, i), ())) end + for i ∈ row:row+2 + cmpo = Memoization.caches[mpo] + delete!(cmpo, ((ctr, ctr.layers.main, i), ())) + delete!(cmpo, ((ctr, ctr.layers.dress, i), ())) + delete!(cmpo, ((ctr, ctr.layers.right, i), ())) + end + end function sweep_gauges!( ctr::MpsContractor{T,GaugeStrategy}, row::Site, - indβ::Int, tol::Real = 1E-4, max_sweeps::Int = 10, ) where {T} clm = ctr.layers.main - ψ_top = mps_top(ctr, row, indβ) - ψ_bot = mps(ctr, row + 1, indβ) + ψ_top = mps_top(ctr, row) + ψ_bot = mps(ctr, row + 1) ψ_top = deepcopy(ψ_top) ψ_bot = deepcopy(ψ_bot) @@ -805,18 +676,17 @@ function sweep_gauges!( g_bot = bot .* g_inv push!(ctr.peps.gauges.data, n_top => g_top, n_bot => g_bot) end - clear_memoize_cache(ctr, row, indβ) + clear_memoize_cache(ctr, row) end function sweep_gauges!( ctr::MpsContractor{T,GaugeStrategyWithBalancing}, row::Site, - indβ::Int, ) where {T} clm = ctr.layers.main - ψ_top = mps_top(ctr, row, indβ) - ψ_bot = mps(ctr, row + 1, indβ) + ψ_top = mps_top(ctr, row) + ψ_bot = mps(ctr, row + 1) ψ_top = deepcopy(ψ_top) ψ_bot = deepcopy(ψ_bot) for i ∈ ψ_top.sites @@ -826,7 +696,7 @@ function sweep_gauges!( _, _, scale = LinearAlgebra.LAPACK.gebal!('S', ρ) push!(ctr.peps.gauges.data, n_top => 1.0 ./ scale, n_bot => scale) end - clear_memoize_cache(ctr, row, indβ) + clear_memoize_cache(ctr, row) ψ_top * ψ_bot end @@ -834,7 +704,6 @@ end function sweep_gauges!( ctr::MpsContractor{T,NoUpdate}, row::Site, - indβ::Int, tol::Real = 1E-4, max_sweeps::Int = 10, ) where {T} @@ -845,11 +714,10 @@ end function update_gauges!( ctr::MpsContractor{T,S}, row::Site, - indβ::Vector{Int}, ::Val{:down}, ) where {T,S} - for j ∈ indβ, i ∈ 1:row-1 - sweep_gauges!(ctr, i, j) + for i ∈ 1:row-1 + sweep_gauges!(ctr, i) end end @@ -857,11 +725,10 @@ end function update_gauges!( ctr::MpsContractor{T,S}, row::Site, - indβ::Vector{Int}, ::Val{:up}, ) where {T,S} - for j ∈ indβ, i ∈ row-1:-1:1 - sweep_gauges!(ctr, i, j) + for i ∈ row-1:-1:1 + sweep_gauges!(ctr, i) end end diff --git a/src/king_single_node.jl b/src/king_single_node.jl index 2a4351cb..fda82653 100644 --- a/src/king_single_node.jl +++ b/src/king_single_node.jl @@ -188,16 +188,16 @@ function conditional_probability( ctr::MpsContractor{S}, ∂v::Vector{Int}, ) where {T<:KingSingleNode,S} - indβ, β = length(ctr.betas), last(ctr.betas) + β = ctr.beta i, j = ctr.current_node - L = left_env(ctr, i, ∂v[1:2*j-2], indβ) - R = right_env(ctr, i, ∂v[(2*j+3):2*ctr.peps.ncols+2], indβ) + L = left_env(ctr, i, ∂v[1:2*j-2]) + R = right_env(ctr, i, ∂v[(2*j+3):2*ctr.peps.ncols+2]) if ctr.onGPU R = CuArray(R) end - ψ = dressed_mps(ctr, i, indβ) + ψ = dressed_mps(ctr, i) MX, M = ψ[j-1//2], ψ[j] @tensor LMX[y, z] := L[x] * MX[x, y, z] diff --git a/src/search.jl b/src/search.jl index 521e97a2..b19c5178 100644 --- a/src/search.jl +++ b/src/search.jl @@ -346,10 +346,10 @@ function merge_branches( if merge_type == :fit c = Statistics.median( - ctr.betas[end] .* nsol.energies[start:stop] .+ + ctr.beta .* nsol.energies[start:stop] .+ nsol.probabilities[start:stop], ) - new_prob = -ctr.betas[end] .* nsol.energies[best_idx] .+ c + new_prob = -ctr.beta .* nsol.energies[best_idx] .+ c push!(probs, new_prob) elseif merge_type == :nofit push!(probs, nsol.probabilities[best_idx]) @@ -562,13 +562,13 @@ function low_energy_spectrum( schmidts = Dict() @showprogress "Preprocessing: " for i ∈ ctr.peps.nrows+1:-1:2 - ψ0 = mps(ctr, i, length(ctr.betas)) + ψ0 = mps(ctr, i) push!(schmidts, i => measure_spectrum(ψ0)) clear_memoize_cache_after_row() Memoization.empty_cache!(SpinGlassTensors.sparse) empty!(ctr.peps.lp, :GPU) if i <= ctr.peps.nrows - ψ0 = mps(ctr, i + 1, length(ctr.betas)) + ψ0 = mps(ctr, i + 1) move_to_CPU!(ψ0) end end @@ -584,7 +584,7 @@ function low_energy_spectrum( push!(s, k => v) end - ψ0 = mps(ctr, 2, length(ctr.betas)) + ψ0 = mps(ctr, 2) move_to_CPU!(ψ0) # Start branch and bound search diff --git a/src/square_cross_double_node.jl b/src/square_cross_double_node.jl index 3a2d9206..91f2316d 100644 --- a/src/square_cross_double_node.jl +++ b/src/square_cross_double_node.jl @@ -241,7 +241,7 @@ The function is specialized for the `SquareCrossDoubleNode` tensor network type current_node, ) where {T<:SquareCrossDoubleNode,S} i, j, k = current_node - β = last(ctr.betas) + β = ctr.beta if k == 1 en12 = interaction_energy(ctr.peps, (i, j, 1), (i, j, 2)) p12 = projector(ctr.peps, (i, j, 1), (i, j, 2)) @@ -400,16 +400,16 @@ function conditional_probability( ctr::MpsContractor{S}, ∂v::Vector{Int}, ) where {T<:SquareCrossDoubleNode,S} - indβ, β = length(ctr.betas), last(ctr.betas) + β = ctr.beta i, j, k = ctr.current_node - L = left_env(ctr, i, ∂v[1:2*j-2], indβ) - ψ = dressed_mps(ctr, i, indβ) + L = left_env(ctr, i, ∂v[1:2*j-2]) + ψ = dressed_mps(ctr, i) MX, M = ψ[j-1//2], ψ[j] @tensor LMX[y, z] := L[x] * MX[x, y, z] if k == 1 # here has to avarage over s2 - R = right_env(ctr, i, ∂v[(2*j+12):end], indβ) + R = right_env(ctr, i, ∂v[(2*j+12):end]) if ctr.onGPU R = CuArray(R) end @@ -456,7 +456,7 @@ function conditional_probability( LR .*= tele probs = Array(dropdims(sum(LR, dims = 2), dims = 2)) else # k == 2 - R = right_env(ctr, i, ∂v[(2*j+10):end], indβ) + R = right_env(ctr, i, ∂v[(2*j+10):end]) if ctr.onGPU R = CuArray(R) end diff --git a/src/square_double_node.jl b/src/square_double_node.jl index 1e1266fc..9ad6aacf 100644 --- a/src/square_double_node.jl +++ b/src/square_double_node.jl @@ -156,15 +156,15 @@ function conditional_probability( ctr::MpsContractor{S}, ∂v::Vector{Int}, ) where {T<:SquareDoubleNode,S} - indβ, β = length(ctr.betas), last(ctr.betas) + β = ctr.beta i, j, k = ctr.current_node - L = left_env(ctr, i, ∂v[1:j-1], indβ) - M = dressed_mps(ctr, i, indβ)[j] + L = left_env(ctr, i, ∂v[1:j-1]) + M = dressed_mps(ctr, i)[j] @tensor LM[y, z] := L[x] * M[x, y, z] if k == 1 # here has to avarage over s2 - R = right_env(ctr, i, ∂v[(j+8):end], indβ) + R = right_env(ctr, i, ∂v[(j+8):end]) if ctr.onGPU R = CuArray(R) end @@ -201,7 +201,7 @@ function conditional_probability( probs = dropdims(sum(Array(LR) .* ele, dims = 2), dims = 2) else # k == 2 ; here s1 is fixed - R = right_env(ctr, i, ∂v[(j+7):end], indβ) + R = right_env(ctr, i, ∂v[(j+7):end]) if ctr.onGPU R = CuArray(R) end diff --git a/src/square_single_node.jl b/src/square_single_node.jl index d547e47c..a7475425 100644 --- a/src/square_single_node.jl +++ b/src/square_single_node.jl @@ -247,15 +247,15 @@ function conditional_probability( ctr::MpsContractor{S}, ∂v::Vector{Int}, ) where {T<:SquareSingleNode,S} - indβ, β = length(ctr.betas), last(ctr.betas) + β = ctr.beta i, j = ctr.current_node - L = left_env(ctr, i, ∂v[1:j-1], indβ) - R = right_env(ctr, i, ∂v[(j+2):ctr.peps.ncols+1], indβ) + L = left_env(ctr, i, ∂v[1:j-1]) + R = right_env(ctr, i, ∂v[(j+2):ctr.peps.ncols+1]) if ctr.onGPU R = CuArray(R) end - M = dressed_mps(ctr, i, indβ)[j] + M = dressed_mps(ctr, i)[j] @tensor LM[y, z] := L[x] * M[x, y, z] diff --git a/src/util.jl b/src/util.jl index 7982df18..ba336dd9 100644 --- a/src/util.jl +++ b/src/util.jl @@ -46,14 +46,14 @@ The `exact_marginal_probability` function calculates the exact marginal probabil It decodes the provided state vector `σ` using the `decode_state` function, obtains the exact spectrum and states from the Potts Hamiltonian of the associated PEPS, and computes the marginal probability of the target state using the Boltzmann distribution. The function utilizes the `exact_spectrum` function to obtain the energies and states of the Potts Hamiltonian, -exponentiates the negative energies multiplied by the inverse temperature (`ctr.betas[end]`), normalizes the probabilities, +exponentiates the negative energies multiplied by the inverse temperature (`ctr.beta`), normalizes the probabilities, and calculates the marginal probability of the target state. """ function exact_marginal_probability(ctr::MpsContractor{T}, σ::Vector{Int}) where {T} # TODO: Not going to work without PoolOfProjectors target_state = decode_state(ctr.peps, σ, true) energies, states = exact_spectrum(ctr.peps.potts_hamiltonian) - prob = exp.(-ctr.betas[end] .* energies) + prob = exp.(-ctr.beta .* energies) prob ./= sum(prob) sum(prob[findall([all(s[k] == v for (k, v) ∈ target_state) for s ∈ states])]) end diff --git a/test/chimera_overlap_python.jl b/test/chimera_overlap_python.jl index e102a4d6..03dd26c1 100644 --- a/test/chimera_overlap_python.jl +++ b/test/chimera_overlap_python.jl @@ -44,14 +44,14 @@ Gauge = NoUpdate network, params; onGPU = onGPU, - βs = [β / 8, β / 4, β / 2, β], + beta = β, graduate_truncation = :graduate_truncate, ) @testset "Compare the results with Python" begin overlap_python = [0.2637787707674837, 0.2501621729619047, 0.2951954406837012] for i = 1:n-1 - psi_top = mps_top(ctr, i, 4) - psi_bottom = mps(ctr, i + 1, 4) + psi_top = mps_top(ctr, i) + psi_bottom = mps(ctr, i + 1) overlap = psi_top * psi_bottom @test isapprox(overlap, overlap_python[i], atol = 1e-5) end @@ -75,12 +75,12 @@ end net, params; onGPU = onGPU, - βs = [β / 8, β / 4, β / 2, β], + beta = β, graduate_truncation = :graduate_truncate, ) for i = 1:n-1 - psi_top = mps_top(ctr, i, 4) - psi_bottom = mps(ctr, i + 1, 4) + psi_top = mps_top(ctr, i) + psi_bottom = mps(ctr, i + 1) overlap = psi_top * psi_bottom @test isapprox(overlap, overlap_python[i], atol = 1e-5) end diff --git a/test/experimental/gauges.jl b/test/experimental/gauges.jl index f8706bb0..fc9c106b 100644 --- a/test/experimental/gauges.jl +++ b/test/experimental/gauges.jl @@ -35,10 +35,9 @@ search_params = SearchParameters(num_states, δp) # ctr_anneal = MpsContractor{MPSAnnealing, GaugeStrategy}(net, [β/8, β/4, β/2, β], :graduate_truncate, params; onGPU=onGPU) # @testset "Overlaps calculated for different Starategies are the same." begin -# indβ = 3 # for i ∈ 1:m-1 -# ψ_top = mps_top(ctr_svd, i, indβ) -# ϕ_top = mps_top(ctr_anneal, i, indβ) +# ψ_top = mps_top(ctr_svd, i) +# ϕ_top = mps_top(ctr_anneal, i) # @test ψ_top * ψ_top ≈ 1 # @test ϕ_top * ϕ_top ≈ 1 # @test ψ_top * ϕ_top ≈ 1 @@ -51,12 +50,11 @@ search_params = SearchParameters(num_states, δp) # net = PEPSNetwork{Lattice{Layout}, Sparsity}(m, n, potts_h, transform, :id) # ctr_svd = MpsContractor{SVDTruncate, GaugeStrategy}(net, [β/8, β/4, β/2, β], :graduate_truncate, params; onGPU=onGPU) # @testset "Overlaps calculated in Python are the same as in Julia." begin -# indβ = [4, ] # overlap_python = [0.2637787707674837, 0.2501621729619047, 0.2951954406837012] # for i ∈ vcat(1:m-1)#, m-1:-1:1) -# ψ_top = mps_top(ctr_svd, i, indβ[begin]) -# ψ_bot = mps(ctr_svd, i+1, indβ[begin]) +# ψ_top = mps_top(ctr_svd, i) +# ψ_bot = mps(ctr_svd, i+1) # overlap1 = ψ_top * ψ_bot # @test isapprox(overlap1, overlap_python[i], atol=1e-5) # end @@ -68,7 +66,7 @@ search_params = SearchParameters(num_states, δp) # end @testset "Updating gauges works correctly." begin - for Strategy ∈ (SVDTruncate, MPSAnnealing), Sparsity ∈ (Dense, Sparse) + for Strategy ∈ (SVDTruncate, ), Sparsity ∈ (Dense, Sparse) for Layout ∈ (GaugesEnergy,) for Gauge ∈ (GaugeStrategy,) for Lattice ∈ (SquareSingleNode, KingSingleNode), @@ -85,19 +83,18 @@ search_params = SearchParameters(num_states, δp) net, params; onGPU = onGPU, - βs = [β / 8, β / 4, β / 2, β], + beta = β, graduate_truncation = :graduate_truncate, ) @testset "Overlaps calculated differently are the same." begin - indβ = 3 for i ∈ 1:m-1 - ψ_top = mps_top(ctr, i, indβ) - ψ_bot = mps(ctr, i + 1, indβ) + ψ_top = mps_top(ctr, i) + ψ_bot = mps(ctr, i + 1) try - overlap = tr(overlap_density_matrix(ψ_top, ψ_bot, indβ)) + overlap = tr(overlap_density_matrix(ψ_top, ψ_bot, i)) @test overlap ≈ ψ_bot * ψ_top catch println(Strategy, " ", Sparsity, " ", Lattice, " ", i) @@ -111,15 +108,14 @@ search_params = SearchParameters(num_states, δp) clear_memoize_cache() # @testset "ψ_bot and ψ_top are not updated in place though memoize!" begin - # indβ = [3,] # for aba in 1:3, i ∈ 1:m-1 # println(aba," ", i) - # ψ_top = mps_top(ctr, i, indβ[begin]) - # ψ_bot = mps(ctr, i+1, indβ[begin]) + # ψ_top = mps_top(ctr, i) + # ψ_bot = mps(ctr, i+1) # overlap_old = ψ_top * ψ_bot - # update_gauges!(ctr, i, indβ, Val(:down)) + # update_gauges!(ctr, i, Val(:down)) # # assert that ψ_bot and ψ_top are not updated in place though memoize! # overlap_old2 = ψ_bot * ψ_top @@ -133,11 +129,10 @@ search_params = SearchParameters(num_states, δp) # clear_memoize_cache() # @testset "Updating gauges from top and bottom gives the same energy." begin - # indβ = [3,] - # update_gauges!(ctr, m, indβ, Val(:down)) + # update_gauges!(ctr, m, Val(:down)) # sol_l, s = low_energy_spectrum(ctr, search_params, merge_branches(ctr)) # clear_memoize_cache() - # update_gauges!(ctr, m, indβ, Val(:up)) + # update_gauges!(ctr, m, Val(:up)) # sol_r, s = low_energy_spectrum(ctr, search_params, merge_branches(ctr)) # @test sol_l.energies[begin] ≈ sol_r.energies[begin] # end diff --git a/test/experimental/gauges_cuda.jl b/test/experimental/gauges_cuda.jl index afcf6544..c15d03bf 100644 --- a/test/experimental/gauges_cuda.jl +++ b/test/experimental/gauges_cuda.jl @@ -17,7 +17,6 @@ end DE = 16.0 δp = 1E-5 * exp(-β * DE) ig = ising_graph("$(@__DIR__)/../instances/pegasus_random/minimal.txt") - INDβ = [1, 2, 3] potts_h = potts_hamiltonian( ig, spectrum = my_brute_force, @@ -44,10 +43,10 @@ end net, params; onGPU = onGPU, - βs = [β / 6, β / 3, β / 2, β], + beta = β, graduate_truncation = :graduate_truncate, ) - update_gauges!(ctr, m, INDβ, Val(:up)) + update_gauges!(ctr, m, Val(:up)) sol, s = low_energy_spectrum(ctr, search_params) #sol = low_energy_spectrum(ctr, search_params, merge_branches(ctr)) diff --git a/test/experimental/mpo_size.jl b/test/experimental/mpo_size.jl index f865d767..5fe2665c 100644 --- a/test/experimental/mpo_size.jl +++ b/test/experimental/mpo_size.jl @@ -33,7 +33,6 @@ Dcut = 8 tolV = 1E-16 tolS = 1E-16 max_sweeps = 1 -indβ = 1 ITERS_SVD = 1 ITERS_VAR = 1 DTEMP_MULT = 2 @@ -82,17 +81,16 @@ for cl_states in cluster_states Gauge = NoUpdate i = div(m, 2) - indβ = 1 net = PEPSNetwork{SquareCrossDoubleNode{Layout},Sparse,Float64}(m, n, potts_h, tran) ctr = MpsContractor{Strategy,Gauge,Float64}( net, params; onGPU = onGPU, - βs = [β], + beta = β, graduate_truncation = :graduate_truncate, ) - Ws = SpinGlassEngine.mpo(ctr, ctr.layers.main, i, indβ) + Ws = SpinGlassEngine.mpo(ctr, ctr.layers.main, i) # println(" Ws -> ", which_device(Ws), " ", format_bytes.(measure_memory(Ws))) # println(ctr.layers.main) site = Ws[3].ctr diff --git a/test/experimental/sampling.jl b/test/experimental/sampling.jl index f3bdc80d..1a70f6eb 100644 --- a/test/experimental/sampling.jl +++ b/test/experimental/sampling.jl @@ -40,7 +40,7 @@ ctr = MpsContractor{Strategy,Gauge,Float64}( net, params; onGPU = onGPU, - βs = [β / 8.0, β / 4.0, β / 2.0, β], + beta = β, graduate_truncation = :graduate_truncate, ) sol = gibbs_sampling(ctr, search_params) diff --git a/test/experimental/search_chimera_gauge.jl b/test/experimental/search_chimera_gauge.jl index 74ee0d2a..613526f8 100644 --- a/test/experimental/search_chimera_gauge.jl +++ b/test/experimental/search_chimera_gauge.jl @@ -12,7 +12,6 @@ DE = 16.0 δp = 1E-5 * exp(-β * DE) instance = "$(@__DIR__)/instances/chimera_droplets/512power/001.txt" - INDβ = [1, 2, 3] ig = ising_graph(instance) potts_h = potts_hamiltonian( ig, @@ -38,10 +37,10 @@ net, params; onGPU = onGPU, - βs = [β / 6, β / 3, β / 2, β], + beta = β, graduate_truncation = :graduate_truncate, ) - update_gauges!(ctr, m, INDβ, Val(:up)) + update_gauges!(ctr, m, Val(:up)) sol, s = low_energy_spectrum(ctr, search_params) #sol = low_energy_spectrum(ctr, search_params, merge_branches(ctr)) diff --git a/test/experimental/squarestar_double_node_pegasus.jl b/test/experimental/squarestar_double_node_pegasus.jl index 0d579d08..37a73255 100644 --- a/test/experimental/squarestar_double_node_pegasus.jl +++ b/test/experimental/squarestar_double_node_pegasus.jl @@ -303,7 +303,7 @@ params = MpsParameters{Float64}(bond_dim, VAR_TOL, MS, TOL_SVD, ITERS_SVD, ITERS_VAR, DTEMP_MULT) search_params = SearchParameters(num_states, δp) energies = Vector{Float64}[] -Strategy = Zipper # MPSAnnealing # SVDTruncate +Strategy = Zipper # SVDTruncate Sparsity = Sparse #Dense Layout = GaugesEnergy Gauge = NoUpdate @@ -314,7 +314,7 @@ for tran ∈ all_lattice_transformations #[LatticeTransformation((1, 2, 3, 4), f net, params; onGPU = onGPU, - βs = [β / 6, β / 3, β / 2, β], + beta = β, graduate_truncation = :graduate_truncate, ) sol, s = low_energy_spectrum( diff --git a/test/experimental/squarestar_double_node_zephyr.jl b/test/experimental/squarestar_double_node_zephyr.jl index d891ef9a..6c55deec 100644 --- a/test/experimental/squarestar_double_node_zephyr.jl +++ b/test/experimental/squarestar_double_node_zephyr.jl @@ -50,7 +50,7 @@ ctr = MpsContractor{Strategy,Gauge,Float64}( net, params; onGPU = onGPU, - βs = [β / 6, β / 3, β / 2, β], + beta = β, graduate_truncation = :graduate_truncate, ) diff --git a/test/experimental/truncate.jl b/test/experimental/truncate.jl index 68518b73..804c36ef 100644 --- a/test/experimental/truncate.jl +++ b/test/experimental/truncate.jl @@ -27,7 +27,6 @@ Dcut = 8 tolV = 1E-16 tolS = 1E-16 max_sweeps = 0 -indβ = 1 ITERS_SVD = 2 ITERS_VAR = 1 DTEMP_MULT = 2 @@ -42,7 +41,7 @@ params = MpsParameters(Dcut, tolV, max_sweeps, tolS, ITERS_SVD, ITERS_VAR, DTEMP_MULT, METHOD) search_params = SearchParameters(MAX_STATES, δp) -Strategy = Zipper # MPSAnnealing SVDTruncate +Strategy = Zipper # SVDTruncate Layout = GaugesEnergy Gauge = NoUpdate cl_states = [2^10] @@ -83,7 +82,7 @@ for cs ∈ cl_states net, params; onGPU = onGPU, - βs = [β / 6, β / 3, β / 2, β], + beta = β, graduate_truncation = :graduate_truncate, ) sol, schmidts = low_energy_spectrum(ctr, search_params, merge_branches(ctr)) diff --git a/test/experimental/truncate_small.jl b/test/experimental/truncate_small.jl index ead4b2ce..216d1e2e 100644 --- a/test/experimental/truncate_small.jl +++ b/test/experimental/truncate_small.jl @@ -29,7 +29,6 @@ function run_test(instance, m, n, t) tolV = 1E-16 tolS = 1E-16 max_sweeps = 1 - indβ = 1 ITERS_SVD = 1 ITERS_VAR = 1 DTEMP_MULT = 2 @@ -52,7 +51,6 @@ function run_test(instance, m, n, t) search_params = SearchParameters(num_states, δp) energies = [] Gauge = NoUpdate - βs = [β / 16, β / 8, β / 4, β / 2, β] Strategy = Zipper Sparsity = Sparse Layout = GaugesEnergy @@ -86,7 +84,7 @@ function run_test(instance, m, n, t) net, params; onGPU = onGPU, - βs = βs, + beta = β, graduate_truncation = :graduate_truncate, ) diff --git a/test/experimental/zipper.jl b/test/experimental/zipper.jl index fcdf1efc..3cf81ce0 100644 --- a/test/experimental/zipper.jl +++ b/test/experimental/zipper.jl @@ -22,15 +22,11 @@ end m, n, t = 8, 8, 8 -β = 1 -Dcut = 8 - β = 1.0 Dcut = 7 tolV = 0.01 tolS = 0.0 max_sweeps = 4 -indβ = 1 ig = ising_graph("$(@__DIR__)/../instances/chimera_droplets/512power/001.txt") @@ -48,17 +44,16 @@ Layout = EnergyGauges Gauge = NoUpdate i = div(m, 2) -indβ = 1 net = PEPSNetwork{SquareSingleNode{Layout},Sparse,Float64}(m, n, potts_h, tran) ctr = MpsContractor{Strategy,Gauge,Float64}( net, params; onGPU = onGPU, - βs = [β], + beta = β, graduate_truncation = :graduate_truncate, ) -Ws = SpinGlassEngine.mpo(ctr, ctr.layers.main, i, indβ) +Ws = SpinGlassEngine.mpo(ctr, ctr.layers.main, i) println(" Ws -> ", which_device(Ws), " ", format_bytes.(measure_memory(Ws))) net = PEPSNetwork{SquareSingleNode{Layout},Dense,Float64}(m, n, potts_h, tran) @@ -66,10 +61,10 @@ ctr = MpsContractor{Strategy,Gauge,Float64}( net, params; onGPU = onGPU, - βs = [β], + beta = β, graduate_truncation = :graduate_truncate, ) -Wd = SpinGlassEngine.mpo(ctr, ctr.layers.main, i, indβ) +Wd = SpinGlassEngine.mpo(ctr, ctr.layers.main, i) println(" Wd -> ", which_device(Wd), " ", format_bytes.(measure_memory(Wd))) println( diff --git a/test/mwe.jl b/test/mwe.jl index 2e1c0a13..89ff1f09 100644 --- a/test/mwe.jl +++ b/test/mwe.jl @@ -50,7 +50,7 @@ for T in [Float64, Float32] net, params; onGPU = onGPU, - βs = [β / 8, β / 4, β / 2, β], + beta = β, graduate_truncation = :graduate_truncate, ) sol, s = low_energy_spectrum(ctr, search_params) diff --git a/test/random_markov_field.jl b/test/random_markov_field.jl index bfa432ab..bfc665a4 100644 --- a/test/random_markov_field.jl +++ b/test/random_markov_field.jl @@ -21,7 +21,7 @@ net, params; onGPU = onGPU, - βs = [β / 8, β / 4, β / 2, β], + beta = β, graduate_truncation = :graduate_truncate, mode = :RMF, ) diff --git a/test/runtests.jl b/test/runtests.jl index 0fd811fd..2d1b873b 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -18,7 +18,7 @@ my_tests = [] push!( my_tests, - # quick tests: + quick tests: "operations.jl", "branch_and_bound.jl", "search_chimera_pathological.jl", diff --git a/test/search_chimera_droplets.jl b/test/search_chimera_droplets.jl index 91f489e0..39154c0c 100644 --- a/test/search_chimera_droplets.jl +++ b/test/search_chimera_droplets.jl @@ -16,7 +16,6 @@ function bench(instance::String) dE = 3.0 δp = exp(-β * dE) num_states = 500 - all_betas = [β / 8, β / 4, β / 2, β] potts_h = potts_hamiltonian( ising_graph(instance), @@ -41,7 +40,7 @@ function bench(instance::String) net, params; onGPU = onGPU, - βs = all_betas, + beta = β, graduate_truncation = :graduate_truncate, ) sol1, s = low_energy_spectrum( diff --git a/test/search_chimera_full.jl b/test/search_chimera_full.jl index 9d3c077d..ce7f2acb 100644 --- a/test/search_chimera_full.jl +++ b/test/search_chimera_full.jl @@ -15,7 +15,6 @@ function bench(instance::String) dE = 3.0 δp = exp(-β * dE) num_states = 500 - all_betas = [β / 8, β / 4, β / 2, β] potts_h = potts_hamiltonian( ising_graph(instance), @@ -41,7 +40,7 @@ function bench(instance::String) net, params; onGPU = onGPU, - βs = all_betas, + beta = β, graduate_truncation = :graduate_truncate, ) sol, s = low_energy_spectrum( diff --git a/test/search_chimera_pathological.jl b/test/search_chimera_pathological.jl index f4bccf56..165d4c7d 100644 --- a/test/search_chimera_pathological.jl +++ b/test/search_chimera_pathological.jl @@ -5,7 +5,7 @@ Layout = $Layout Lattice = $Lattice transform = $transform " for Sparsity ∈ (Dense, Sparse), - Strategy ∈ (SVDTruncate, MPSAnnealing, Zipper), + Strategy ∈ (SVDTruncate, Zipper), Layout ∈ (EnergyGauges, GaugesEnergy, EngGaugesEng), Lattice ∈ (SquareSingleNode, KingSingleNode), transform ∈ all_lattice_transformations @@ -126,7 +126,7 @@ transform = $transform net, params; onGPU = onGPU, - βs = [β / 8.0, β / 4.0, β / 2.0, β], + beta = β, graduate_truncation = :graduate_truncate, ) sol, s = low_energy_spectrum(ctr, search_params) diff --git a/test/search_chimera_pathological_Z2.jl b/test/search_chimera_pathological_Z2.jl index 5d4c7752..bc67e54f 100644 --- a/test/search_chimera_pathological_Z2.jl +++ b/test/search_chimera_pathological_Z2.jl @@ -108,7 +108,7 @@ Gauge = NoUpdate energies = Vector{Float64}[] - for Strategy ∈ (SVDTruncate, MPSAnnealing, Zipper), Sparsity ∈ (Dense, Sparse) + for Strategy ∈ (SVDTruncate, Zipper), Sparsity ∈ (Dense, Sparse) for Layout ∈ (EnergyGauges, GaugesEnergy, EngGaugesEng) for Lattice ∈ (SquareSingleNode, KingSingleNode), transform ∈ all_lattice_transformations @@ -123,7 +123,7 @@ net, params; onGPU = onGPU, - βs = [β / 8.0, β / 4.0, β / 2.0, β], + beta = β, graduate_truncation = :graduate_truncate, ) sol1, s = low_energy_spectrum( diff --git a/test/search_chimera_pathological_droplets.jl b/test/search_chimera_pathological_droplets.jl index b0389799..f70a8984 100644 --- a/test/search_chimera_pathological_droplets.jl +++ b/test/search_chimera_pathological_droplets.jl @@ -109,7 +109,7 @@ Gauge = NoUpdate energies = Vector{Float64}[] - # for Strategy ∈ (SVDTruncate, MPSAnnealing, Zipper), Sparsity ∈ (Dense, Sparse) + # for Strategy ∈ (SVDTruncate, Zipper), Sparsity ∈ (Dense, Sparse) # for Layout ∈ (EnergyGauges, GaugesEnergy, EngGaugesEng) # for Lattice ∈ (SquareSingleNode, KingSingleNode), transform ∈ all_lattice_transformations for Strategy ∈ (Zipper,), Sparsity ∈ (Dense,) @@ -126,7 +126,7 @@ net, params; onGPU = onGPU, - βs = [β / 8.0, β / 4.0, β / 2.0, β], + beta = β, graduate_truncation = :graduate_truncate, ) sol1, s = low_energy_spectrum( diff --git a/test/search_chimera_pathological_hamming.jl b/test/search_chimera_pathological_hamming.jl index dbb4e512..f2cc6739 100644 --- a/test/search_chimera_pathological_hamming.jl +++ b/test/search_chimera_pathological_hamming.jl @@ -137,7 +137,7 @@ end net, params; onGPU = onGPU, - βs = [β / 8.0, β / 4.0, β / 2.0, β], + beta = β, graduate_truncation = :graduate_truncate, ) sol1, s = low_energy_spectrum( diff --git a/test/search_chimera_smallest.jl b/test/search_chimera_smallest.jl index d3f4da6f..9bab17a6 100644 --- a/test/search_chimera_smallest.jl +++ b/test/search_chimera_smallest.jl @@ -31,7 +31,7 @@ net, params; onGPU = onGPU, - βs = T[β/8, β/4, β/2, β], + beta = T(β), graduate_truncation = :graduate_truncate, ) sol, s = low_energy_spectrum(ctr, search_params) diff --git a/test/search_chimera_smallest_droplets.jl b/test/search_chimera_smallest_droplets.jl index b0c8c3d8..11019648 100644 --- a/test/search_chimera_smallest_droplets.jl +++ b/test/search_chimera_smallest_droplets.jl @@ -34,7 +34,7 @@ net, params; onGPU = onGPU, - βs = [β / 8, β / 4, β / 2, β], + beta = β, graduate_truncation = :graduate_truncate, ) diff --git a/test/search_cross_square_star.jl b/test/search_cross_square_star.jl index 844276a7..4eb359af 100644 --- a/test/search_cross_square_star.jl +++ b/test/search_cross_square_star.jl @@ -20,7 +20,7 @@ Gauge = NoUpdate energies = Vector{Float64}[] - for Strategy ∈ (MPSAnnealing, Zipper, SVDTruncate), Sparsity ∈ (Dense, Sparse) + for Strategy ∈ (Zipper, SVDTruncate), Sparsity ∈ (Dense, Sparse) for Layout ∈ (GaugesEnergy, EngGaugesEng, EnergyGauges) # for transform ∈ all_lattice_transformations, Lattice ∈ (KingSingleNode,) net = PEPSNetwork{Lattice{Layout},Sparsity,Float64}(m, n, potts_h, transform) @@ -28,7 +28,7 @@ net, params; onGPU = onGPU, - βs = [β / 2, β], + beta = β, graduate_truncation = :graduate_truncate, ) sol, s = low_energy_spectrum(ctr, search_params) diff --git a/test/search_full_chimera.jl b/test/search_full_chimera.jl index 0161d870..ccbd312d 100644 --- a/test/search_full_chimera.jl +++ b/test/search_full_chimera.jl @@ -24,7 +24,7 @@ function bench() #for transform ∈ all_lattice_transformations peps = PEPSNetwork(m, n, fg, rotation(0), β = β, bond_dim = 32) - kupdate_gauges!(peps, :rand) + update_gauges!(peps, :rand) @time sol = low_energy_spectrum(peps, num_states)#, merge_branches(peps, 1.0)) println(sol.energies[1:1]) end diff --git a/test/search_pegasus_droplets.jl b/test/search_pegasus_droplets.jl index 14a9daa2..8e25defe 100644 --- a/test/search_pegasus_droplets.jl +++ b/test/search_pegasus_droplets.jl @@ -16,7 +16,6 @@ function bench(instance::String) dE = 3.0 δp = exp(-β * dE) num_states = 500 - all_betas = [β / 8, β / 4, β / 2, β] potts_h = potts_hamiltonian( ising_graph(instance), @@ -41,7 +40,7 @@ function bench(instance::String) net, params; onGPU = onGPU, - βs = all_betas, + beta = β, graduate_truncation = :graduate_truncate, ) sol1, s = low_energy_spectrum( diff --git a/test/search_pegasus_nodiag_square_cross.jl b/test/search_pegasus_nodiag_square_cross.jl index 112883b7..60be7e93 100644 --- a/test/search_pegasus_nodiag_square_cross.jl +++ b/test/search_pegasus_nodiag_square_cross.jl @@ -24,7 +24,7 @@ function bench(instance::String) # Solve using PEPS search energies = Vector{Float64}[] - for Strategy ∈ (SVDTruncate, MPSAnnealing, Zipper), + for Strategy ∈ (SVDTruncate, Zipper), transform ∈ all_lattice_transformations for Layout ∈ (EnergyGauges, GaugesEnergy, EngGaugesEng), Sparsity ∈ (Dense,) @@ -38,7 +38,7 @@ function bench(instance::String) net, params; onGPU = onGPU, - βs = [β / 8, β / 4, β / 2, β], + beta = β, graduate_truncation = :graduate_truncate, ) sol_peps, s = low_energy_spectrum(ctr, search_params, merge_branches(ctr)) diff --git a/test/search_pegasus_square_cross.jl b/test/search_pegasus_square_cross.jl index 3166726d..90198466 100644 --- a/test/search_pegasus_square_cross.jl +++ b/test/search_pegasus_square_cross.jl @@ -24,7 +24,7 @@ function bench(instance::String) # Solve using PEPS search energies = Vector{Float64}[] - for Strategy ∈ (SVDTruncate, MPSAnnealing, Zipper), + for Strategy ∈ (SVDTruncate, Zipper), transform ∈ all_lattice_transformations for Layout ∈ (EnergyGauges, GaugesEnergy, EngGaugesEng), Sparsity ∈ (Dense,) @@ -38,7 +38,7 @@ function bench(instance::String) net, params; onGPU = onGPU, - βs = [β / 8, β / 4, β / 2, β], + beta = β, graduate_truncation = graduate_truncation, ) sol_peps, s = low_energy_spectrum(ctr, search_params, merge_branches(ctr)) diff --git a/test/search_smallest_cross_square_cross.jl b/test/search_smallest_cross_square_cross.jl index ec7721a5..a53cdbcf 100644 --- a/test/search_smallest_cross_square_cross.jl +++ b/test/search_smallest_cross_square_cross.jl @@ -18,7 +18,7 @@ params = MpsParameters{Float64}(; bond_dim = bond_dim, var_tol = 1E-8, num_sweeps = 4) search_params = SearchParameters(; max_states = num_states, cut_off_prob = 0.0) - for Strategy ∈ (SVDTruncate, MPSAnnealing, Zipper), Sparsity ∈ (Dense, Sparse) + for Strategy ∈ (SVDTruncate, Zipper), Sparsity ∈ (Dense, Sparse) for Layout ∈ (EnergyGauges, GaugesEnergy, EngGaugesEng) for transform ∈ all_lattice_transformations net = PEPSNetwork{KingSingleNode{Layout},Sparsity,Float64}( @@ -31,7 +31,7 @@ net, params; onGPU = onGPU, - βs = [β / 8.0, β / 4.0, β / 2.0, β], + beta = β, graduate_truncation = :graduate_truncate, ) sol, s = low_energy_spectrum(ctr, search_params) diff --git a/test/search_square_double_node_basic.jl b/test/search_square_double_node_basic.jl index dda5b5cb..29d5973d 100644 --- a/test/search_square_double_node_basic.jl +++ b/test/search_square_double_node_basic.jl @@ -1,11 +1,10 @@ using SpinGlassEngine function run_test_square_double_node(instance, m, n, t) - β = 2 + β = 2.0 bond_dim = 16 δp = 1e-10 num_states = 512 - βs = [β / 16, β / 8, β / 4, β / 2, β] ig = ising_graph(instance) @@ -25,7 +24,7 @@ function run_test_square_double_node(instance, m, n, t) energies = [] Gauge = NoUpdate - for Strategy ∈ (SVDTruncate, MPSAnnealing, Zipper), Sparsity ∈ (Dense, Sparse) + for Strategy ∈ (SVDTruncate, Zipper), Sparsity ∈ (Dense, Sparse) for Layout ∈ (EnergyGauges, GaugesEnergy) for tran ∈ all_lattice_transformations @@ -42,14 +41,14 @@ function run_test_square_double_node(instance, m, n, t) net, params; onGPU = onGPU, - βs = βs, + beta = β, graduate_truncation = :graduate_truncate, ) ctr2 = MpsContractor{Strategy,Gauge,Float64}( net2, params; onGPU = onGPU, - βs = βs, + beta = β, graduate_truncation = :graduate_truncate, ) @@ -76,13 +75,13 @@ function run_test_square_double_node(instance, m, n, t) exct_prob = exp.(-β .* (sol2.energies .- sol2.energies[1])) @test norm_prob ≈ exct_prob - for ii ∈ 1:ctr.peps.nrows+1, jj ∈ 1:length(βs) - ψ1, ψ2 = mps(ctr, ii, jj), mps(ctr2, ii, jj) + for ii ∈ 1:ctr.peps.nrows+1 + ψ1, ψ2 = mps(ctr, ii), mps(ctr2, ii) o = ψ1 * ψ2 / sqrt((ψ1 * ψ1) * (ψ2 * ψ2)) @test o ≈ 1.0 end - for ii ∈ 0:ctr.peps.nrows, jj ∈ 1:length(βs) - ψ1_top, ψ2_top = mps_top(ctr, ii, jj), mps_top(ctr2, ii, jj) + for ii ∈ 0:ctr.peps.nrows + ψ1_top, ψ2_top = mps_top(ctr, ii), mps_top(ctr2, ii) o_top = ψ1_top * ψ2_top / sqrt((ψ1_top * ψ1_top) * (ψ2_top * ψ2_top)) @test o_top ≈ 1.0 end diff --git a/test/search_square_lattice.jl b/test/search_square_lattice.jl index 66dd95d2..5d86ba1b 100644 --- a/test/search_square_lattice.jl +++ b/test/search_square_lattice.jl @@ -20,7 +20,7 @@ function bench(instance::String) Gauge = NoUpdate graduate_truncation = :graduate_truncate energies = Vector{Float64}[] - for Strategy ∈ (SVDTruncate, MPSAnnealing, Zipper), + for Strategy ∈ (SVDTruncate, Zipper), transform ∈ all_lattice_transformations for Layout ∈ (GaugesEnergy, EnergyGauges, EngGaugesEng), Sparsity ∈ (Dense, Sparse) @@ -29,7 +29,7 @@ function bench(instance::String) net, params; onGPU = onGPU, - βs = [β / 8, β / 4, β / 2, β], + beta = β, graduate_truncation = graduate_truncation, ) sol_peps, s = low_energy_spectrum(ctr, search_params, merge_branches(ctr)) diff --git a/test/search_squarecross_double_node_basic.jl b/test/search_squarecross_double_node_basic.jl index 17458996..f9705703 100644 --- a/test/search_squarecross_double_node_basic.jl +++ b/test/search_squarecross_double_node_basic.jl @@ -2,7 +2,7 @@ using SpinGlassEngine using Test function run_test_squarecross_double_node(instance, m, n, t) - β = 2 + β = 2.0 bond_dim = 16 δp = 1e-10 num_states = 512 @@ -24,9 +24,8 @@ function run_test_squarecross_double_node(instance, m, n, t) search_params = SearchParameters(; max_states = num_states, cut_off_prob = δp) energies = [] Gauge = NoUpdate - βs = [β / 16, β / 8, β / 4, β / 2, β] - for Strategy ∈ (SVDTruncate, MPSAnnealing, Zipper), Sparsity ∈ (Sparse,) + for Strategy ∈ (SVDTruncate, Zipper), Sparsity ∈ (Sparse,) for Layout ∈ (EnergyGauges, GaugesEnergy) for tran ∈ all_lattice_transformations @@ -47,14 +46,14 @@ function run_test_squarecross_double_node(instance, m, n, t) net, params; onGPU = onGPU, - βs = βs, + beta = β, graduate_truncation = :graduate_truncate, ) ctr2 = MpsContractor{Strategy,Gauge,Float64}( net2, params; onGPU = onGPU, - βs = βs, + beta = β, graduate_truncation = :graduate_truncate, ) @@ -80,13 +79,13 @@ function run_test_squarecross_double_node(instance, m, n, t) exct_prob = exp.(-β .* (sol2.energies .- sol2.energies[1])) @test norm_prob ≈ exct_prob - for ii ∈ 1:ctr.peps.nrows+1, jj ∈ 1:length(βs) - ψ1, ψ2 = mps(ctr, ii, jj), mps(ctr2, ii, jj) + for ii ∈ 1:ctr.peps.nrows+1 + ψ1, ψ2 = mps(ctr, ii), mps(ctr2, ii) o = ψ1 * ψ2 / sqrt((ψ1 * ψ1) * (ψ2 * ψ2)) @test o ≈ 1.0 end - for ii ∈ 0:ctr.peps.nrows, jj ∈ 1:length(βs) - ψ1_top, ψ2_top = mps_top(ctr, ii, jj), mps_top(ctr2, ii, jj) + for ii ∈ 0:ctr.peps.nrows + ψ1_top, ψ2_top = mps_top(ctr, ii), mps_top(ctr2, ii) o_top = ψ1_top * ψ2_top / sqrt((ψ1_top * ψ1_top) * (ψ2_top * ψ2_top)) @test o_top ≈ 1.0 end From bcac3474ef7f0f530907fe4a34363cea509f35ea Mon Sep 17 00:00:00 2001 From: Bartek Date: Wed, 31 Jul 2024 08:03:28 +0000 Subject: [PATCH 04/12] clean up --- publication/bench.jl | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/publication/bench.jl b/publication/bench.jl index 351cf982..6619b8b0 100644 --- a/publication/bench.jl +++ b/publication/bench.jl @@ -22,7 +22,12 @@ function run_square_diag_bench(::Type{T}; topology::NTuple{3, Int}) where {T} cluster_assignment_rule = lattice, ) - params = MpsParameters{T}(; bond_dim = 16, var_tol = T(1E-16), num_sweeps = 0, tol_SVD = T(1E-16)) + params = MpsParameters{T}(; + bond_dim = 16, + var_tol = 1E-16, + num_sweeps = 0, + tol_SVD = 1E-16, + ) search_params = SearchParameters(; max_states = 2^8, cut_off_prob = T(1E-4)) for transform ∈ all_lattice_transformations @@ -31,7 +36,8 @@ function run_square_diag_bench(::Type{T}; topology::NTuple{3, Int}) where {T} ) ctr = MpsContractor{SVDTruncate, NoUpdate, T}( - net, params; onGPU = false, βs = [T(2)], graduate_truncation = :graduate_truncate + net, params; + onGPU = false, βs = [T(2)], graduate_truncation = :graduate_truncate ) merge_strategy = merge_branches( From bd97cbb37f9a5c5d76e34ba3707d253e5eddb21f Mon Sep 17 00:00:00 2001 From: Bartek Date: Wed, 31 Jul 2024 08:05:03 +0000 Subject: [PATCH 05/12] clean up --- publication/bench.jl | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/publication/bench.jl b/publication/bench.jl index 6359f126..03dddd15 100644 --- a/publication/bench.jl +++ b/publication/bench.jl @@ -32,15 +32,17 @@ function run_square_diag_bench(::Type{T}; topology::NTuple{3, Int}) where {T} for transform ∈ all_lattice_transformations net = PEPSNetwork{KingSingleNode{GaugesEnergy}, Dense, T}( - m, n, potts_h, transform + m, n, potts_h, transform, ) ctr = MpsContractor{SVDTruncate, NoUpdate, T}( - net, params; onGPU = false, beta = T(2), graduate_truncation = :graduate_truncate + net, params; + onGPU = false, beta = T(2), graduate_truncation = :graduate_truncate, ) + droplets = SingleLayerDroplets(eng, hamming_dist, :hamming) merge_strategy = merge_branches( - ctr; merge_type = :nofit, update_droplets = SingleLayerDroplets(eng, hamming_dist, :hamming) + ctr; merge_type = :nofit, update_droplets = droplets, ) sol, _ = low_energy_spectrum(ctr, search_params, merge_strategy) From 08e43e7f6d7058910644da1526b98d7c27703f63 Mon Sep 17 00:00:00 2001 From: Bartek Date: Wed, 31 Jul 2024 10:27:40 +0000 Subject: [PATCH 06/12] clean up --- publication/bench.jl | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/publication/bench.jl b/publication/bench.jl index 03dddd15..3c678871 100644 --- a/publication/bench.jl +++ b/publication/bench.jl @@ -22,13 +22,8 @@ function run_square_diag_bench(::Type{T}; topology::NTuple{3, Int}) where {T} cluster_assignment_rule = lattice, ) - params = MpsParameters{T}(; - bond_dim = 16, - var_tol = 1E-16, - num_sweeps = 0, - tol_SVD = 1E-16, - ) - search_params = SearchParameters(; max_states = 2^8, cut_off_prob = T(1E-4)) + params = MpsParameters{T}(; bond_dim = 16, num_sweeps = 1) + search_params = SearchParameters(; max_states = 2^8, cut_off_prob = 1E-4) for transform ∈ all_lattice_transformations net = PEPSNetwork{KingSingleNode{GaugesEnergy}, Dense, T}( @@ -40,9 +35,9 @@ function run_square_diag_bench(::Type{T}; topology::NTuple{3, Int}) where {T} onGPU = false, beta = T(2), graduate_truncation = :graduate_truncate, ) - droplets = SingleLayerDroplets(eng, hamming_dist, :hamming) + single = SingleLayerDroplets(eng, hamming_dist, :hamming) merge_strategy = merge_branches( - ctr; merge_type = :nofit, update_droplets = droplets, + ctr; merge_type = :nofit, update_droplets = single, ) sol, _ = low_energy_spectrum(ctr, search_params, merge_strategy) From 6a94dc7fdbdbc43724517f595258bc46b9cac1dd Mon Sep 17 00:00:00 2001 From: annamariadziubyna Date: Wed, 31 Jul 2024 23:45:48 +0200 Subject: [PATCH 07/12] kwargs in SingleLayerDroplets --- benchmarks/bench.jl | 2 +- examples/pegasus.jl | 2 +- publication/bench.jl | 7 ++----- src/contractor.jl | 4 ++-- src/droplets.jl | 2 +- test/chimera_overlap_python.jl | 4 ++-- test/experimental/gauges.jl | 8 ++++---- test/experimental/gauges_cuda.jl | 2 +- test/experimental/mpo_size.jl | 2 +- test/experimental/sampling.jl | 2 +- test/experimental/search_chimera_gauge.jl | 2 +- test/experimental/squarestar_double_node_pegasus.jl | 4 ++-- test/experimental/squarestar_double_node_zephyr.jl | 2 +- test/experimental/truncate.jl | 2 +- test/experimental/truncate_small.jl | 2 +- test/experimental/zipper.jl | 4 ++-- test/mwe.jl | 2 +- test/random_markov_field.jl | 4 ++-- test/runtests.jl | 2 +- test/search_chimera_droplets.jl | 4 ++-- test/search_chimera_full.jl | 2 +- test/search_chimera_pathological.jl | 2 +- test/search_chimera_pathological_Z2.jl | 4 ++-- test/search_chimera_pathological_droplets.jl | 4 ++-- test/search_chimera_pathological_hamming.jl | 4 ++-- test/search_chimera_smallest.jl | 2 +- test/search_chimera_smallest_droplets.jl | 4 ++-- test/search_cross_square_star.jl | 2 +- test/search_pegasus_droplets.jl | 4 ++-- test/search_pegasus_nodiag_square_cross.jl | 2 +- test/search_pegasus_square_cross.jl | 2 +- test/search_smallest_cross_square_cross.jl | 2 +- test/search_square_double_node_basic.jl | 4 ++-- test/search_square_lattice.jl | 2 +- test/search_squarecross_double_node_basic.jl | 4 ++-- 35 files changed, 52 insertions(+), 55 deletions(-) diff --git a/benchmarks/bench.jl b/benchmarks/bench.jl index b2bf76f9..a06d1f76 100644 --- a/benchmarks/bench.jl +++ b/benchmarks/bench.jl @@ -31,7 +31,7 @@ TT = Float64 GAUGE = NoUpdate STRATEGY = Zipper #SVDTruncate SPARSITY = Sparse -graduate_truncation = :graduate_truncate +graduate_truncation = :graduate MAX_STATES = 1024 BOND_DIM = 8 diff --git a/examples/pegasus.jl b/examples/pegasus.jl index 9abec06e..07f770f2 100644 --- a/examples/pegasus.jl +++ b/examples/pegasus.jl @@ -36,7 +36,7 @@ function bench(instance::String, β::Real, bond_dim::Integer, num_states::Intege net, params; beta = β, - graduate_truncation = :graduate_truncate, + graduate_truncation = :graduate, onGPU = onGPU, ) diff --git a/publication/bench.jl b/publication/bench.jl index 3c678871..ac681cb8 100644 --- a/publication/bench.jl +++ b/publication/bench.jl @@ -11,9 +11,6 @@ function run_square_diag_bench(::Type{T}; topology::NTuple{3, Int}) where {T} instance = get_instance(topology) lattice = super_square_lattice(topology) - hamming_dist = 5 - eng = 10 - best_energies = T[] potts_h = potts_hamiltonian( @@ -32,10 +29,10 @@ function run_square_diag_bench(::Type{T}; topology::NTuple{3, Int}) where {T} ctr = MpsContractor{SVDTruncate, NoUpdate, T}( net, params; - onGPU = false, beta = T(2), graduate_truncation = :graduate_truncate, + onGPU = false, beta = T(2), graduate_truncation = :graduate, ) - single = SingleLayerDroplets(eng, hamming_dist, :hamming) + single = SingleLayerDroplets(; max_energy = 10, min_size = 5, metric = :hamming) merge_strategy = merge_branches( ctr; merge_type = :nofit, update_droplets = single, ) diff --git a/src/contractor.jl b/src/contractor.jl index 8ce397c3..4401cfca 100644 --- a/src/contractor.jl +++ b/src/contractor.jl @@ -262,7 +262,7 @@ This function constructs the top MPS using SVD for a given row in the PEPS netwo ψ0 = dot(W, ψ) canonise!(ψ0, :right) - if ctr.graduate_truncation == :graduate_truncate + if ctr.graduate_truncation == :graduate canonise_truncate!(ψ0, :left, Dcut * 2, tolS / 2) variational_sweep!(ψ0, W, ψ, Val(:right)) end @@ -304,7 +304,7 @@ This function constructs the (bottom) MPS using SVD for a given row in the PEPS ψ0 = dot(W, ψ) canonise!(ψ0, :right) - if ctr.graduate_truncation == :graduate_truncate + if ctr.graduate_truncation == :graduate canonise_truncate!(ψ0, :left, Dcut * 2, tolS / 2) variational_sweep!(ψ0, W, ψ, Val(:right)) end diff --git a/src/droplets.jl b/src/droplets.jl index 2fffa23d..18d05424 100644 --- a/src/droplets.jl +++ b/src/droplets.jl @@ -40,7 +40,7 @@ struct SingleLayerDroplets min_size::Int metric::Symbol mode::Symbol - SingleLayerDroplets( + SingleLayerDroplets(; max_energy = 1.0, min_size = 1, metric = :no_metric, diff --git a/test/chimera_overlap_python.jl b/test/chimera_overlap_python.jl index 03dd26c1..0b651ec3 100644 --- a/test/chimera_overlap_python.jl +++ b/test/chimera_overlap_python.jl @@ -45,7 +45,7 @@ Gauge = NoUpdate params; onGPU = onGPU, beta = β, - graduate_truncation = :graduate_truncate, + graduate_truncation = :graduate, ) @testset "Compare the results with Python" begin overlap_python = [0.2637787707674837, 0.2501621729619047, 0.2951954406837012] @@ -76,7 +76,7 @@ end params; onGPU = onGPU, beta = β, - graduate_truncation = :graduate_truncate, + graduate_truncation = :graduate, ) for i = 1:n-1 psi_top = mps_top(ctr, i) diff --git a/test/experimental/gauges.jl b/test/experimental/gauges.jl index fc9c106b..676c46ee 100644 --- a/test/experimental/gauges.jl +++ b/test/experimental/gauges.jl @@ -31,8 +31,8 @@ search_params = SearchParameters(num_states, δp) # for Sparsity ∈ (Dense, Sparse), transform ∈ all_lattice_transformations[[1]] # for Layout ∈ (GaugesEnergy, EnergyGauges, EngGaugesEng) # net = PEPSNetwork{Lattice{Layout}, Sparsity}(m, n, potts_h, transform, :id) -# ctr_svd = MpsContractor{SVDTruncate, GaugeStrategy}(net, [β/8, β/4, β/2, β], :graduate_truncate, params; onGPU=onGPU) -# ctr_anneal = MpsContractor{MPSAnnealing, GaugeStrategy}(net, [β/8, β/4, β/2, β], :graduate_truncate, params; onGPU=onGPU) +# ctr_svd = MpsContractor{SVDTruncate, GaugeStrategy}(net, [β/8, β/4, β/2, β], :graduate, params; onGPU=onGPU) +# ctr_anneal = MpsContractor{MPSAnnealing, GaugeStrategy}(net, [β/8, β/4, β/2, β], :graduate, params; onGPU=onGPU) # @testset "Overlaps calculated for different Starategies are the same." begin # for i ∈ 1:m-1 @@ -48,7 +48,7 @@ search_params = SearchParameters(num_states, δp) # for Layout ∈ (GaugesEnergy,) # net = PEPSNetwork{Lattice{Layout}, Sparsity}(m, n, potts_h, transform, :id) -# ctr_svd = MpsContractor{SVDTruncate, GaugeStrategy}(net, [β/8, β/4, β/2, β], :graduate_truncate, params; onGPU=onGPU) +# ctr_svd = MpsContractor{SVDTruncate, GaugeStrategy}(net, [β/8, β/4, β/2, β], :graduate, params; onGPU=onGPU) # @testset "Overlaps calculated in Python are the same as in Julia." begin # overlap_python = [0.2637787707674837, 0.2501621729619047, 0.2951954406837012] @@ -84,7 +84,7 @@ search_params = SearchParameters(num_states, δp) params; onGPU = onGPU, beta = β, - graduate_truncation = :graduate_truncate, + graduate_truncation = :graduate, ) @testset "Overlaps calculated differently are the same." begin diff --git a/test/experimental/gauges_cuda.jl b/test/experimental/gauges_cuda.jl index c15d03bf..e1dd6cf8 100644 --- a/test/experimental/gauges_cuda.jl +++ b/test/experimental/gauges_cuda.jl @@ -44,7 +44,7 @@ end params; onGPU = onGPU, beta = β, - graduate_truncation = :graduate_truncate, + graduate_truncation = :graduate, ) update_gauges!(ctr, m, Val(:up)) sol, s = low_energy_spectrum(ctr, search_params) diff --git a/test/experimental/mpo_size.jl b/test/experimental/mpo_size.jl index 5fe2665c..c0190815 100644 --- a/test/experimental/mpo_size.jl +++ b/test/experimental/mpo_size.jl @@ -88,7 +88,7 @@ for cl_states in cluster_states params; onGPU = onGPU, beta = β, - graduate_truncation = :graduate_truncate, + graduate_truncation = :graduate, ) Ws = SpinGlassEngine.mpo(ctr, ctr.layers.main, i) # println(" Ws -> ", which_device(Ws), " ", format_bytes.(measure_memory(Ws))) diff --git a/test/experimental/sampling.jl b/test/experimental/sampling.jl index 1a70f6eb..a1f3f904 100644 --- a/test/experimental/sampling.jl +++ b/test/experimental/sampling.jl @@ -41,7 +41,7 @@ ctr = MpsContractor{Strategy,Gauge,Float64}( params; onGPU = onGPU, beta = β, - graduate_truncation = :graduate_truncate, + graduate_truncation = :graduate, ) sol = gibbs_sampling(ctr, search_params) diff --git a/test/experimental/search_chimera_gauge.jl b/test/experimental/search_chimera_gauge.jl index 613526f8..56bcd1a0 100644 --- a/test/experimental/search_chimera_gauge.jl +++ b/test/experimental/search_chimera_gauge.jl @@ -38,7 +38,7 @@ params; onGPU = onGPU, beta = β, - graduate_truncation = :graduate_truncate, + graduate_truncation = :graduate, ) update_gauges!(ctr, m, Val(:up)) sol, s = low_energy_spectrum(ctr, search_params) diff --git a/test/experimental/squarestar_double_node_pegasus.jl b/test/experimental/squarestar_double_node_pegasus.jl index 37a73255..53137ad0 100644 --- a/test/experimental/squarestar_double_node_pegasus.jl +++ b/test/experimental/squarestar_double_node_pegasus.jl @@ -315,7 +315,7 @@ for tran ∈ all_lattice_transformations #[LatticeTransformation((1, 2, 3, 4), f params; onGPU = onGPU, beta = β, - graduate_truncation = :graduate_truncate, + graduate_truncation = :graduate, ) sol, s = low_energy_spectrum( ctr, @@ -323,7 +323,7 @@ for tran ∈ all_lattice_transformations #[LatticeTransformation((1, 2, 3, 4), f merge_branches( ctr; merge_type = :nofit, - update_droplets = SingleLayerDroplets(eng, hamming_dist, :hamming), + update_droplets = SingleLayerDroplets(; max_energy=eng, min_size=hamming_dist, metric=:hamming), ), ) println(sol.energies) diff --git a/test/experimental/squarestar_double_node_zephyr.jl b/test/experimental/squarestar_double_node_zephyr.jl index 6c55deec..77d35de6 100644 --- a/test/experimental/squarestar_double_node_zephyr.jl +++ b/test/experimental/squarestar_double_node_zephyr.jl @@ -51,7 +51,7 @@ ctr = MpsContractor{Strategy,Gauge,Float64}( params; onGPU = onGPU, beta = β, - graduate_truncation = :graduate_truncate, + graduate_truncation = :graduate, ) # for i in 1//2 : 1//2 : m diff --git a/test/experimental/truncate.jl b/test/experimental/truncate.jl index 804c36ef..3731467c 100644 --- a/test/experimental/truncate.jl +++ b/test/experimental/truncate.jl @@ -83,7 +83,7 @@ for cs ∈ cl_states params; onGPU = onGPU, beta = β, - graduate_truncation = :graduate_truncate, + graduate_truncation = :graduate, ) sol, schmidts = low_energy_spectrum(ctr, search_params, merge_branches(ctr)) println("sol ", sol) diff --git a/test/experimental/truncate_small.jl b/test/experimental/truncate_small.jl index 216d1e2e..c3268987 100644 --- a/test/experimental/truncate_small.jl +++ b/test/experimental/truncate_small.jl @@ -85,7 +85,7 @@ function run_test(instance, m, n, t) params; onGPU = onGPU, beta = β, - graduate_truncation = :graduate_truncate, + graduate_truncation = :graduate, ) sol, schmidts = low_energy_spectrum(ctr, search_params, merge_branches(ctr)) #, merge_branches(ctr)) diff --git a/test/experimental/zipper.jl b/test/experimental/zipper.jl index 3cf81ce0..9713020f 100644 --- a/test/experimental/zipper.jl +++ b/test/experimental/zipper.jl @@ -51,7 +51,7 @@ ctr = MpsContractor{Strategy,Gauge,Float64}( params; onGPU = onGPU, beta = β, - graduate_truncation = :graduate_truncate, + graduate_truncation = :graduate, ) Ws = SpinGlassEngine.mpo(ctr, ctr.layers.main, i) println(" Ws -> ", which_device(Ws), " ", format_bytes.(measure_memory(Ws))) @@ -62,7 +62,7 @@ ctr = MpsContractor{Strategy,Gauge,Float64}( params; onGPU = onGPU, beta = β, - graduate_truncation = :graduate_truncate, + graduate_truncation = :graduate, ) Wd = SpinGlassEngine.mpo(ctr, ctr.layers.main, i) println(" Wd -> ", which_device(Wd), " ", format_bytes.(measure_memory(Wd))) diff --git a/test/mwe.jl b/test/mwe.jl index 89ff1f09..cea4d6c3 100644 --- a/test/mwe.jl +++ b/test/mwe.jl @@ -51,7 +51,7 @@ for T in [Float64, Float32] params; onGPU = onGPU, beta = β, - graduate_truncation = :graduate_truncate, + graduate_truncation = :graduate, ) sol, s = low_energy_spectrum(ctr, search_params) @test eltype(sol.energies) == T diff --git a/test/random_markov_field.jl b/test/random_markov_field.jl index bfc665a4..87269bb0 100644 --- a/test/random_markov_field.jl +++ b/test/random_markov_field.jl @@ -10,7 +10,7 @@ params = MpsParameters{Float64}(; bond_dim = bond_dim, var_tol = 1E-8, num_sweeps = 4) search_params = SearchParameters(; max_states = num_states, cut_off_prob = δp) Gauge = NoUpdate - graduate_truncation = :graduate_truncate + graduate_truncation = :graduate energies = Vector{Float64}[] Strategy = Zipper Layout = GaugesEnergy @@ -22,7 +22,7 @@ params; onGPU = onGPU, beta = β, - graduate_truncation = :graduate_truncate, + graduate_truncation = :graduate, mode = :RMF, ) sol_peps, s = low_energy_spectrum(ctr, search_params, merge_branches(ctr)) diff --git a/test/runtests.jl b/test/runtests.jl index 2d1b873b..24679370 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -18,7 +18,7 @@ my_tests = [] push!( my_tests, - quick tests: + #quick tests: "operations.jl", "branch_and_bound.jl", "search_chimera_pathological.jl", diff --git a/test/search_chimera_droplets.jl b/test/search_chimera_droplets.jl index 39154c0c..12c26087 100644 --- a/test/search_chimera_droplets.jl +++ b/test/search_chimera_droplets.jl @@ -41,7 +41,7 @@ function bench(instance::String) params; onGPU = onGPU, beta = β, - graduate_truncation = :graduate_truncate, + graduate_truncation = :graduate, ) sol1, s = low_energy_spectrum( ctr, @@ -49,7 +49,7 @@ function bench(instance::String) merge_branches( ctr; merge_type = :nofit, - update_droplets = SingleLayerDroplets(1.0, 1000, :hamming), + update_droplets = SingleLayerDroplets(; max_energy=1, min_size=1000, metric=:hamming), ), ) diff --git a/test/search_chimera_full.jl b/test/search_chimera_full.jl index ce7f2acb..361ecd3f 100644 --- a/test/search_chimera_full.jl +++ b/test/search_chimera_full.jl @@ -41,7 +41,7 @@ function bench(instance::String) params; onGPU = onGPU, beta = β, - graduate_truncation = :graduate_truncate, + graduate_truncation = :graduate, ) sol, s = low_energy_spectrum( ctr, diff --git a/test/search_chimera_pathological.jl b/test/search_chimera_pathological.jl index 165d4c7d..d639cca3 100644 --- a/test/search_chimera_pathological.jl +++ b/test/search_chimera_pathological.jl @@ -127,7 +127,7 @@ transform = $transform params; onGPU = onGPU, beta = β, - graduate_truncation = :graduate_truncate, + graduate_truncation = :graduate, ) sol, s = low_energy_spectrum(ctr, search_params) diff --git a/test/search_chimera_pathological_Z2.jl b/test/search_chimera_pathological_Z2.jl index bc67e54f..0cc81b8d 100644 --- a/test/search_chimera_pathological_Z2.jl +++ b/test/search_chimera_pathological_Z2.jl @@ -124,7 +124,7 @@ params; onGPU = onGPU, beta = β, - graduate_truncation = :graduate_truncate, + graduate_truncation = :graduate, ) sol1, s = low_energy_spectrum( ctr, @@ -132,7 +132,7 @@ merge_branches( ctr; merge_type = :nofit, - update_droplets = SingleLayerDroplets(10.0, 0, :hamming), + update_droplets = SingleLayerDroplets(; max_energy=10.0, min_size=0, metric=:hamming), ), :Z2, ) diff --git a/test/search_chimera_pathological_droplets.jl b/test/search_chimera_pathological_droplets.jl index f70a8984..cbbb2800 100644 --- a/test/search_chimera_pathological_droplets.jl +++ b/test/search_chimera_pathological_droplets.jl @@ -127,7 +127,7 @@ params; onGPU = onGPU, beta = β, - graduate_truncation = :graduate_truncate, + graduate_truncation = :graduate, ) sol1, s = low_energy_spectrum( ctr, @@ -136,7 +136,7 @@ ctr, hamming_dist, :nofit, - SingleLayerDroplets(1.01, 1, :hamming), + SingleLayerDroplets(; max_energy=1.01, min_size=1, metric=:hamming), ), ) # sol1, s = low_energy_spectrum(ctr, search_params, merge_branches(ctr, :nofit, SingleLayerDroplets(1.01, 1, :hamming))) diff --git a/test/search_chimera_pathological_hamming.jl b/test/search_chimera_pathological_hamming.jl index f2cc6739..b328a9eb 100644 --- a/test/search_chimera_pathological_hamming.jl +++ b/test/search_chimera_pathological_hamming.jl @@ -138,7 +138,7 @@ end params; onGPU = onGPU, beta = β, - graduate_truncation = :graduate_truncate, + graduate_truncation = :graduate, ) sol1, s = low_energy_spectrum( ctr, @@ -147,7 +147,7 @@ end ctr, hamming_dist, :nofit, - SingleLayerDroplets(1.01, 10, :hamming), + SingleLayerDroplets(; max_energy=1.01, min_size=10, metric=:hamming), ), ) @test sol1.energies ≈ [exact_energies[1]] diff --git a/test/search_chimera_smallest.jl b/test/search_chimera_smallest.jl index 9bab17a6..1e2e6a58 100644 --- a/test/search_chimera_smallest.jl +++ b/test/search_chimera_smallest.jl @@ -32,7 +32,7 @@ params; onGPU = onGPU, beta = T(β), - graduate_truncation = :graduate_truncate, + graduate_truncation = :graduate, ) sol, s = low_energy_spectrum(ctr, search_params) @test eltype(sol.energies) == T diff --git a/test/search_chimera_smallest_droplets.jl b/test/search_chimera_smallest_droplets.jl index 11019648..4aa3f6d2 100644 --- a/test/search_chimera_smallest_droplets.jl +++ b/test/search_chimera_smallest_droplets.jl @@ -35,7 +35,7 @@ params; onGPU = onGPU, beta = β, - graduate_truncation = :graduate_truncate, + graduate_truncation = :graduate, ) sol1, s = low_energy_spectrum( @@ -44,7 +44,7 @@ merge_branches( ctr; merge_type = :nofit, - update_droplets = SingleLayerDroplets(2.2, 1, :hamming), + update_droplets = SingleLayerDroplets(; max_energy=2.2, min_size=1, metric=:hamming), ), ) diff --git a/test/search_cross_square_star.jl b/test/search_cross_square_star.jl index 4eb359af..64a43853 100644 --- a/test/search_cross_square_star.jl +++ b/test/search_cross_square_star.jl @@ -29,7 +29,7 @@ params; onGPU = onGPU, beta = β, - graduate_truncation = :graduate_truncate, + graduate_truncation = :graduate, ) sol, s = low_energy_spectrum(ctr, search_params) diff --git a/test/search_pegasus_droplets.jl b/test/search_pegasus_droplets.jl index 8e25defe..1c82ac8a 100644 --- a/test/search_pegasus_droplets.jl +++ b/test/search_pegasus_droplets.jl @@ -41,7 +41,7 @@ function bench(instance::String) params; onGPU = onGPU, beta = β, - graduate_truncation = :graduate_truncate, + graduate_truncation = :graduate, ) sol1, s = low_energy_spectrum( ctr, @@ -49,7 +49,7 @@ function bench(instance::String) merge_branches( ctr; merge_type = :nofit, - update_droplets = SingleLayerDroplets(0.01, 20, :hamming), + update_droplets = SingleLayerDroplets(; max_energy=0.01, min_size=20, metric=:hamming), ), ) diff --git a/test/search_pegasus_nodiag_square_cross.jl b/test/search_pegasus_nodiag_square_cross.jl index 60be7e93..94c8c119 100644 --- a/test/search_pegasus_nodiag_square_cross.jl +++ b/test/search_pegasus_nodiag_square_cross.jl @@ -39,7 +39,7 @@ function bench(instance::String) params; onGPU = onGPU, beta = β, - graduate_truncation = :graduate_truncate, + graduate_truncation = :graduate, ) sol_peps, s = low_energy_spectrum(ctr, search_params, merge_branches(ctr)) push!(energies, sol_peps.energies) diff --git a/test/search_pegasus_square_cross.jl b/test/search_pegasus_square_cross.jl index 90198466..758b2ad4 100644 --- a/test/search_pegasus_square_cross.jl +++ b/test/search_pegasus_square_cross.jl @@ -20,7 +20,7 @@ function bench(instance::String) params = MpsParameters{Float64}(; bond_dim = bond_dim, var_tol = 1E-8, num_sweeps = 4) search_params = SearchParameters(max_states = num_states, cut_off_prob = δp) Gauge = NoUpdate - graduate_truncation = :graduate_truncate + graduate_truncation = :graduate # Solve using PEPS search energies = Vector{Float64}[] diff --git a/test/search_smallest_cross_square_cross.jl b/test/search_smallest_cross_square_cross.jl index a53cdbcf..59e55eb7 100644 --- a/test/search_smallest_cross_square_cross.jl +++ b/test/search_smallest_cross_square_cross.jl @@ -32,7 +32,7 @@ params; onGPU = onGPU, beta = β, - graduate_truncation = :graduate_truncate, + graduate_truncation = :graduate, ) sol, s = low_energy_spectrum(ctr, search_params) diff --git a/test/search_square_double_node_basic.jl b/test/search_square_double_node_basic.jl index 29d5973d..a11aef04 100644 --- a/test/search_square_double_node_basic.jl +++ b/test/search_square_double_node_basic.jl @@ -42,14 +42,14 @@ function run_test_square_double_node(instance, m, n, t) params; onGPU = onGPU, beta = β, - graduate_truncation = :graduate_truncate, + graduate_truncation = :graduate, ) ctr2 = MpsContractor{Strategy,Gauge,Float64}( net2, params; onGPU = onGPU, beta = β, - graduate_truncation = :graduate_truncate, + graduate_truncation = :graduate, ) sol, s = low_energy_spectrum(ctr, search_params) #, merge_branches(ctr)) diff --git a/test/search_square_lattice.jl b/test/search_square_lattice.jl index 5d86ba1b..15a14ebf 100644 --- a/test/search_square_lattice.jl +++ b/test/search_square_lattice.jl @@ -18,7 +18,7 @@ function bench(instance::String) params = MpsParameters{Float64}(; bond_dim = bond_dim, var_tol = 1E-8, num_sweeps = 4) search_params = SearchParameters(; max_states = num_states, cut_off_prob = δp) Gauge = NoUpdate - graduate_truncation = :graduate_truncate + graduate_truncation = :graduate energies = Vector{Float64}[] for Strategy ∈ (SVDTruncate, Zipper), transform ∈ all_lattice_transformations diff --git a/test/search_squarecross_double_node_basic.jl b/test/search_squarecross_double_node_basic.jl index f9705703..a77b6963 100644 --- a/test/search_squarecross_double_node_basic.jl +++ b/test/search_squarecross_double_node_basic.jl @@ -47,14 +47,14 @@ function run_test_squarecross_double_node(instance, m, n, t) params; onGPU = onGPU, beta = β, - graduate_truncation = :graduate_truncate, + graduate_truncation = :graduate, ) ctr2 = MpsContractor{Strategy,Gauge,Float64}( net2, params; onGPU = onGPU, beta = β, - graduate_truncation = :graduate_truncate, + graduate_truncation = :graduate, ) sol, s = low_energy_spectrum(ctr, search_params) #, merge_branches(ctr)) From 149c2c8b48139e305c9566ef60b3ac37169c4edb Mon Sep 17 00:00:00 2001 From: annamariadziubyna Date: Thu, 1 Aug 2024 11:07:57 +0200 Subject: [PATCH 08/12] clean up --- benchmarks/bench.jl | 19 +++++++++++++------ publication/bench.jl | 4 ++-- test/mwe.jl | 21 ++++++++++----------- 3 files changed, 25 insertions(+), 19 deletions(-) diff --git a/benchmarks/bench.jl b/benchmarks/bench.jl index a06d1f76..257c8404 100644 --- a/benchmarks/bench.jl +++ b/benchmarks/bench.jl @@ -18,16 +18,16 @@ MPI.Init() size = MPI.Comm_size(MPI.COMM_WORLD) rank = MPI.Comm_rank(MPI.COMM_WORLD) -M, N, T = 7, 7, 3 -INSTANCE_DIR = "$(@__DIR__)/../test/instances/pegasus_random/P8/RCO/SpinGlass" -OUTPUT_DIR = "$(@__DIR__)/results/pegasus_random/P8/RCO/final_bench_float64_beta2" +M, N, T = 3, 3, 3 +INSTANCE_DIR = "$(@__DIR__)/../test/instances/pegasus_random/P4/RCO/SpinGlass" +OUTPUT_DIR = "$(@__DIR__)/results/pegasus_random/P4/RCO/final_bench_float32_betas_tr2^20" if !Base.Filesystem.isdir(OUTPUT_DIR) Base.Filesystem.mkpath(OUTPUT_DIR) end -BETAS = [2.0,] #collect(0.5:0.5:3) +BETAS = [0.25,0.5, 1.0, 2.0, 5.0, 10.0] #collect(0.5:0.5:3) LAYOUT = (GaugesEnergy,) -TRANSFORM = all_lattice_transformations -TT = Float64 +TRANSFORM = [all_lattice_transformations[1],] +TT = Float32 GAUGE = NoUpdate STRATEGY = Zipper #SVDTruncate SPARSITY = Sparse @@ -36,7 +36,11 @@ graduate_truncation = :graduate MAX_STATES = 1024 BOND_DIM = 8 DE = 16.0 +cs=2^20 +iter = 2 +RESULTS_FOLDER = "$(@__DIR__)/../test/instances/pegasus_random/P4/RCO/BP" +inst="001" MAX_SWEEPS = 0 VAR_TOL = 1E-16 TOL_SVD = 1E-16 @@ -55,6 +59,8 @@ function pegasus_sim(inst, trans, β, Layout) spectrum=full_spectrum, cluster_assignment_rule=pegasus_lattice((M, N, T)) ) + potts_h = truncate_potts_hamiltonian(potts_h, β, cs, RESULTS_FOLDER, inst; tol=1e-6, iter=iter) + # params = MpsParameters{TT}(;bond_dim=BOND_DIM, var_tol=TT(VAR_TOL), num_sweeps=MAX_SWEEPS, tol_SVD=TT(TOL_SVD), iters_SVD=ITERS_SVD, iters_var=ITERS_VAR, Dtemp_multiplier=DTEMP_MULT, method=METHOD) params = MpsParameters{TT}(; bond_dim=BOND_DIM, var_tol=TT(VAR_TOL), num_sweeps=MAX_SWEEPS) @@ -90,6 +96,7 @@ function run_bench(inst::String, β::Real, t, l) :statistic => minimum(values(ctr.statistics)), :max_states => MAX_STATES, :bond_dim => BOND_DIM, + :cs => cs, :de => DE, :max_sweeps => MAX_SWEEPS, :var_tol => VAR_TOL, diff --git a/publication/bench.jl b/publication/bench.jl index ac681cb8..48e01631 100644 --- a/publication/bench.jl +++ b/publication/bench.jl @@ -32,9 +32,9 @@ function run_square_diag_bench(::Type{T}; topology::NTuple{3, Int}) where {T} onGPU = false, beta = T(2), graduate_truncation = :graduate, ) - single = SingleLayerDroplets(; max_energy = 10, min_size = 5, metric = :hamming) + droplets = SingleLayerDroplets(; max_energy = 10, min_size = 5, metric = :hamming) merge_strategy = merge_branches( - ctr; merge_type = :nofit, update_droplets = single, + ctr; merge_type = :nofit, update_droplets = droplets, ) sol, _ = low_energy_spectrum(ctr, search_params, merge_strategy) diff --git a/test/mwe.jl b/test/mwe.jl index cea4d6c3..cb6ab7df 100644 --- a/test/mwe.jl +++ b/test/mwe.jl @@ -6,9 +6,11 @@ m, n, t = 3, 4, 1 bond_dim = 8 mstates = 10 instance = "$(@__DIR__)/instances/pathological/pegasus_3_4_1.txt" - +RESULTS_FOLDER="$(@__DIR__)/instances/pathological" +inst="001" iter = 2 δp = 0.0 +cs=2^0 MAX_SWEEPS = 0 VAR_TOL = 1E-16 TOL_SVD = 1E-16 @@ -27,6 +29,7 @@ potts_h = potts_hamiltonian( spectrum = full_spectrum, cluster_assignment_rule = pegasus_lattice((m, n, t)), ) +potts_h = truncate_potts_hamiltonian(potts_h, β, cs, RESULTS_FOLDER, inst; tol=1e-6, iter=iter) Gauge = NoUpdate for T in [Float64, Float32] @@ -34,23 +37,19 @@ for T in [Float64, Float32] println("type ", T) energies = Vector{T}[] params = MpsParameters{T}(; - bond_dim, - T(VAR_TOL), - MAX_SWEEPS, - T(TOL_SVD), - ITERS_SVD, - ITERS_VAR, - DTEMP_MULT, - METHOD, + bond_dim=bond_dim, + var_tol = T(VAR_TOL), + num_sweeps = MAX_SWEEPS, + tol_SVD = T(TOL_SVD), ) - search_params = SearchParameters(mstates, δp) + search_params = SearchParameters(;max_states=mstates, cut_off_prob=δp) net = PEPSNetwork{SquareCrossDoubleNode{Layout},Sparsity,T}(m, n, potts_h, transform) ctr = MpsContractor{Strategy,Gauge,T}( net, params; onGPU = onGPU, - beta = β, + beta = T(β), graduate_truncation = :graduate, ) sol, s = low_energy_spectrum(ctr, search_params) From 77fdfacee40b07743a490304bb28173f604a0464 Mon Sep 17 00:00:00 2001 From: annamariadziubyna Date: Fri, 2 Aug 2024 22:45:12 +0200 Subject: [PATCH 09/12] rename --- examples/pegasus.jl | 4 +- publication/bench.jl | 12 ++--- src/contractor.jl | 10 ++-- src/search.jl | 54 +++++++++---------- test/chimera_overlap_python.jl | 6 +-- test/experimental/gauges.jl | 8 +-- test/experimental/gauges_cuda.jl | 10 ++-- test/experimental/mpo_size.jl | 2 +- test/experimental/sampling.jl | 2 +- test/experimental/search_chimera_gauge.jl | 16 +++--- .../squarestar_double_node_pegasus.jl | 6 +-- .../squarestar_double_node_zephyr.jl | 2 +- test/experimental/truncate.jl | 2 +- test/experimental/truncate_small.jl | 2 +- test/experimental/zipper.jl | 4 +- test/mwe.jl | 4 +- test/random_markov_field.jl | 6 +-- test/runtests.jl | 1 + test/search_chimera_droplets.jl | 8 +-- test/search_chimera_full.jl | 6 +-- test/search_chimera_pathological.jl | 4 +- test/search_chimera_pathological_Z2.jl | 8 +-- test/search_chimera_pathological_droplets.jl | 8 +-- test/search_chimera_pathological_hamming.jl | 6 +-- test/search_chimera_smallest.jl | 4 +- test/search_chimera_smallest_droplets.jl | 8 +-- test/search_cross_square_star.jl | 4 +- test/search_pegasus_droplets.jl | 8 +-- test/search_pegasus_nodiag_square_cross.jl | 4 +- test/search_pegasus_square_cross.jl | 4 +- test/search_smallest_cross_square_cross.jl | 4 +- test/search_square_double_node_basic.jl | 6 +-- test/search_square_lattice.jl | 4 +- test/search_squarecross_double_node_basic.jl | 6 +-- 34 files changed, 122 insertions(+), 121 deletions(-) diff --git a/examples/pegasus.jl b/examples/pegasus.jl index 07f770f2..c38321eb 100644 --- a/examples/pegasus.jl +++ b/examples/pegasus.jl @@ -25,7 +25,7 @@ function bench(instance::String, β::Real, bond_dim::Integer, num_states::Intege ) params = MpsParameters{Float64}(; bond_dim = bond_dim, var_tol = 1E-8, num_sweeps = 4, tol_SVD = 1E-16) - search_params = SearchParameters(; max_states = num_states, cut_off_prob = δp) + search_params = SearchParameters(; max_states = num_states, cutoff_prob = δp) Strategy = Zipper Sparsity = Sparse Layout = GaugesEnergy @@ -36,7 +36,7 @@ function bench(instance::String, β::Real, bond_dim::Integer, num_states::Intege net, params; beta = β, - graduate_truncation = :graduate, + graduate_truncation = true, onGPU = onGPU, ) diff --git a/publication/bench.jl b/publication/bench.jl index 48e01631..1f1b478e 100644 --- a/publication/bench.jl +++ b/publication/bench.jl @@ -20,7 +20,7 @@ function run_square_diag_bench(::Type{T}; topology::NTuple{3, Int}) where {T} ) params = MpsParameters{T}(; bond_dim = 16, num_sweeps = 1) - search_params = SearchParameters(; max_states = 2^8, cut_off_prob = 1E-4) + search_params = SearchParameters(; max_states = 2^8, cutoff_prob = 1E-4) for transform ∈ all_lattice_transformations net = PEPSNetwork{KingSingleNode{GaugesEnergy}, Dense, T}( @@ -29,25 +29,25 @@ function run_square_diag_bench(::Type{T}; topology::NTuple{3, Int}) where {T} ctr = MpsContractor{SVDTruncate, NoUpdate, T}( net, params; - onGPU = false, beta = T(2), graduate_truncation = :graduate, + onGPU = false, beta = T(2), graduate_truncation = true, ) droplets = SingleLayerDroplets(; max_energy = 10, min_size = 5, metric = :hamming) merge_strategy = merge_branches( - ctr; merge_type = :nofit, update_droplets = droplets, + ctr; merge_prob = :none , droplets_encoding = droplets, ) - sol, _ = low_energy_spectrum(ctr, search_params, merge_strategy) + sol, info = low_energy_spectrum(ctr, search_params, merge_strategy) push!(best_energies, sol.energies[1]) clear_memoize_cache() end - ground = best_energies[1] + ground = minimum(best_energies) @assert all(ground .≈ best_energies) println("Best energy found: $(ground)") end -T = Float64 +T = Float32 @time run_square_diag_bench(T; topology = (3, 3, 2)) \ No newline at end of file diff --git a/src/contractor.jl b/src/contractor.jl index 4401cfca..65329d84 100644 --- a/src/contractor.jl +++ b/src/contractor.jl @@ -131,7 +131,7 @@ A mutable struct representing a contractor for contracting a PEPS (Projected Ent # Fields - `peps::PEPSNetwork{T, S}`: The PEPS network to be contracted. - `betas::Vector{<:Real}`: A vector of inverse temperatures (β) used during the search. The last one is the target one. This parameter plays a crucial role: a larger β enables a finer focus on low-energy states, although it may compromise the numerical stability of tensor network contraction. Determining the optimal β could be instance-dependent, and experimental exploration might be necessary for different classes of instances. -- `graduate_truncation::Symbol`: The truncation method to use for gradually truncating MPS bond dimensions. +- `graduate_truncation::Bool`: The truncation method to use for gradually truncating MPS bond dimensions. - `params::MpsParameters`: Control parameters for the MPO-MPS contraction. # Optional Arguments @@ -145,7 +145,7 @@ mutable struct MpsContractor{T<:AbstractStrategy,R<:AbstractGauge,S<:Real} <: AbstractContractor peps::PEPSNetwork{T} where {T} beta::S - graduate_truncation::Symbol + graduate_truncation::Bool depth::Int params::MpsParameters{S} layers::MpoLayers @@ -160,7 +160,7 @@ mutable struct MpsContractor{T<:AbstractStrategy,R<:AbstractGauge,S<:Real} <: net, params; beta::S, - graduate_truncation::Symbol, + graduate_truncation::Bool, onGPU = true, depth::Int = 0, ) where {T,R,S} @@ -262,7 +262,7 @@ This function constructs the top MPS using SVD for a given row in the PEPS netwo ψ0 = dot(W, ψ) canonise!(ψ0, :right) - if ctr.graduate_truncation == :graduate + if ctr.graduate_truncation canonise_truncate!(ψ0, :left, Dcut * 2, tolS / 2) variational_sweep!(ψ0, W, ψ, Val(:right)) end @@ -304,7 +304,7 @@ This function constructs the (bottom) MPS using SVD for a given row in the PEPS ψ0 = dot(W, ψ) canonise!(ψ0, :right) - if ctr.graduate_truncation == :graduate + if ctr.graduate_truncation canonise_truncate!(ψ0, :left, Dcut * 2, tolS / 2) variational_sweep!(ψ0, W, ψ, Val(:right)) end diff --git a/src/search.jl b/src/search.jl index b19c5178..266c2444 100644 --- a/src/search.jl +++ b/src/search.jl @@ -21,16 +21,16 @@ A struct representing search parameters for low-energy spectrum search. ## Fields - `max_states::Int`: The maximum number of states to be considered during the search. Default is 1, indicating a single state search. -- `cut_off_prob::Real`: The cutoff probability for terminating the search. Default is 0.0, meaning no cutoff based on probability. +- `cutoff_prob::Real`: The cutoff probability for terminating the search. Default is 0.0, meaning no cutoff based on probability. SearchParameters encapsulates parameters that control the behavior of low-energy spectrum search algorithms in the SpinGlassPEPS package. """ struct SearchParameters max_states::Int - cut_off_prob::Real + cutoff_prob::Real - function SearchParameters(; max_states::Int = 1, cut_off_prob::Real = 0.0) - new(max_states, cut_off_prob) + function SearchParameters(; max_states::Int = 1, cutoff_prob::Real = 0.0) + new(max_states, cutoff_prob) end end @@ -78,7 +78,7 @@ An empty `Solution` object with default field values, ready to store search resu fill(Vector{Int}[], n), zeros(T, n), ones(Int, n), - -Inf, + T(-Inf), repeat([NoDroplets()], n), fill(Vector{Int}[], n), ) @@ -214,20 +214,20 @@ Discards low-probability states from the given solution. ## Arguments - `psol::Solution`: The input solution containing states and their probabilities. -- `cut_off_prob::Real`: The cutoff probability below which states will be discarded. +- `cutoff_prob::Real`: The cutoff probability below which states will be discarded. ## Returns - `Solution`: A new solution with low-probability states discarded. ## Description -This function removes states from the solution `psol` whose probabilities are below the specified `cut_off_prob`. -It calculates a cutoff probability (`pcut`) based on the maximum probability in `psol` and the provided `cut_off_prob`. +This function removes states from the solution `psol` whose probabilities are below the specified `cutoff_prob`. +It calculates a cutoff probability (`pcut`) based on the maximum probability in `psol` and the provided `cutoff_prob`. States with probabilities lower than `pcut` are considered discarded. The largest discarded probability (`ldp`) in the resulting solution is updated based on the maximum discarded probability among the removed states and the existing `ldp` in `psol`. """ -function discard_probabilities!(psol::Solution, cut_off_prob::Real) - pcut = maximum(psol.probabilities) + log(cut_off_prob) +function discard_probabilities!(psol::Solution, cutoff_prob::Real) + pcut = maximum(psol.probabilities) + log(cutoff_prob) if minimum(psol.probabilities) >= pcut return psol end @@ -291,14 +291,14 @@ end $(TYPEDSIGNATURES) Merge branches of a contractor based on specified merge type and droplet update strategy. -This function merges branches of a contractor (`ctr`) based on a specified merge type (`merge_type`) -and an optional droplet update strategy (`update_droplets`). +This function merges branches of a contractor (`ctr`) based on a specified merge type (`merge_prob`) +and an optional droplet update strategy (`droplets_encoding`). It returns a function `_merge` that can be used to merge branches in a solution. ## Arguments - `ctr::MpsContractor{T}`: A contractor for which branches will be merged. -- `merge_type::Symbol=:nofit`: (Optional) The merge type to use. Defaults to `:nofit`. Possible values are `:nofit`, `:fit`, and `:python`. -- `update_droplets=NoDroplets()`: (Optional) The droplet update strategy. Defaults to `NoDroplets()`. You can provide a custom droplet update strategy if needed. +- `merge_prob::Symbol=:none `: (Optional) The merge type to use. Defaults to `:none `. Possible values are `:none `, `:median`, and `:tnac4o`. +- `droplets_encoding=NoDroplets()`: (Optional) The droplet update strategy. Defaults to `NoDroplets()`. You can provide a custom droplet update strategy if needed. ## Returns A function `_merge` that can be used to merge branches in a solution. @@ -308,8 +308,8 @@ The `_merge` function can be applied to a `Solution` object to merge its branche """ function merge_branches( ctr::MpsContractor{T}; - merge_type::Symbol = :nofit, - update_droplets = NoDroplets(), + merge_prob::Symbol = :none , + droplets_encoding = NoDroplets(), ) where {T} function _merge(psol::Solution) node = get(ctr.nodes_search_order, length(psol.states[1]) + 1, ctr.node_outside) @@ -344,22 +344,22 @@ function merge_branches( end end - if merge_type == :fit + if merge_prob == :median c = Statistics.median( ctr.beta .* nsol.energies[start:stop] .+ nsol.probabilities[start:stop], ) new_prob = -ctr.beta .* nsol.energies[best_idx] .+ c push!(probs, new_prob) - elseif merge_type == :nofit + elseif merge_prob == :none push!(probs, nsol.probabilities[best_idx]) - elseif merge_type == :python + elseif merge_prob == :tnac4o push!(probs, Statistics.mean(nsol.probabilities[ind_deg])) end ## states with unique boundary => we take the one with best energy ## treat other states with the same boundary as droplets on top of the best one - excitation = update_droplets( + excitation = droplets_encoding( ctr, best_idx_bnd, nsol.energies[start:stop], @@ -395,8 +395,8 @@ Generate a function for merging branches in a Gibbs network with a Hamming dista ## Arguments - `ctr::MpsContractor{T}`: The contractor representing the contracted Gibbs network. - `hamming_cutoff::Int`: The Hamming distance cutoff for blur. -- `merge_type::Symbol=:nofit`: The merging strategy, defaults to `:nofit`. -- `update_droplets=NoDroplets()`: Droplet update method, defaults to `NoDroplets()`. +- `merge_prob::Symbol=:none `: The merging strategy, defaults to `:none `. +- `droplets_encoding=NoDroplets()`: Droplet update method, defaults to `NoDroplets()`. ## Returns A function `_merge_blur` that can be used to merge branches with Hamming distance blur in a solution. @@ -411,12 +411,12 @@ States with Hamming distances greater than or equal to the specified cutoff are function merge_branches_blur( ctr::MpsContractor{T}, hamming_cutoff::Int, - merge_type::Symbol = :nofit, - update_droplets = NoDroplets(), + merge_prob::Symbol = :none , + droplets_encoding = NoDroplets(), ) where {T} function _merge_blur(psol::Solution) psol = - merge_branches(ctr; merge_type = merge_type, update_droplets = update_droplets)( + merge_branches(ctr; merge_prob = merge_prob, droplets_encoding = droplets_encoding)( psol, ) node = get(ctr.nodes_search_order, length(psol.states[1]) + 1, ctr.node_outside) @@ -610,7 +610,7 @@ function low_energy_spectrum( sol = Solution(sol, indices_with_even_numbers) # end end - sol = bound_solution(sol, sparams.max_states, sparams.cut_off_prob, merge_strategy) + sol = bound_solution(sol, sparams.max_states, sparams.cutoff_prob, merge_strategy) Memoization.empty_cache!(precompute_conditional) if no_cache Memoization.empty_all_caches!() @@ -692,7 +692,7 @@ function gibbs_sampling( clear_memoize_cache_after_row() end sol = branch_solution(sol, ctr) - sol = sampling(sol, sparams.max_states, sparams.cut_off_prob, merge_strategy) + sol = sampling(sol, sparams.max_states, sparams.cutoff_prob, merge_strategy) Memoization.empty_cache!(precompute_conditional) # TODO: clear memoize cache partially if no_cache diff --git a/test/chimera_overlap_python.jl b/test/chimera_overlap_python.jl index 0b651ec3..74ad530c 100644 --- a/test/chimera_overlap_python.jl +++ b/test/chimera_overlap_python.jl @@ -25,7 +25,7 @@ potts_h = potts_hamiltonian( ) params = MpsParameters{Float64}(; bond_dim = bond_dim, var_tol = 1E-8, num_sweeps = 4) -search_params = SearchParameters(; max_states = num_states, cut_off_prob = δp) +search_params = SearchParameters(; max_states = num_states, cutoff_prob = δp) Strategy = SVDTruncate Gauge = NoUpdate @@ -45,7 +45,7 @@ Gauge = NoUpdate params; onGPU = onGPU, beta = β, - graduate_truncation = :graduate, + graduate_truncation = true, ) @testset "Compare the results with Python" begin overlap_python = [0.2637787707674837, 0.2501621729619047, 0.2951954406837012] @@ -76,7 +76,7 @@ end params; onGPU = onGPU, beta = β, - graduate_truncation = :graduate, + graduate_truncation = true, ) for i = 1:n-1 psi_top = mps_top(ctr, i) diff --git a/test/experimental/gauges.jl b/test/experimental/gauges.jl index 676c46ee..54edbcf6 100644 --- a/test/experimental/gauges.jl +++ b/test/experimental/gauges.jl @@ -31,8 +31,8 @@ search_params = SearchParameters(num_states, δp) # for Sparsity ∈ (Dense, Sparse), transform ∈ all_lattice_transformations[[1]] # for Layout ∈ (GaugesEnergy, EnergyGauges, EngGaugesEng) # net = PEPSNetwork{Lattice{Layout}, Sparsity}(m, n, potts_h, transform, :id) -# ctr_svd = MpsContractor{SVDTruncate, GaugeStrategy}(net, [β/8, β/4, β/2, β], :graduate, params; onGPU=onGPU) -# ctr_anneal = MpsContractor{MPSAnnealing, GaugeStrategy}(net, [β/8, β/4, β/2, β], :graduate, params; onGPU=onGPU) +# ctr_svd = MpsContractor{SVDTruncate, GaugeStrategy}(net, [β/8, β/4, β/2, β], true, params; onGPU=onGPU) +# ctr_anneal = MpsContractor{MPSAnnealing, GaugeStrategy}(net, [β/8, β/4, β/2, β], true, params; onGPU=onGPU) # @testset "Overlaps calculated for different Starategies are the same." begin # for i ∈ 1:m-1 @@ -48,7 +48,7 @@ search_params = SearchParameters(num_states, δp) # for Layout ∈ (GaugesEnergy,) # net = PEPSNetwork{Lattice{Layout}, Sparsity}(m, n, potts_h, transform, :id) -# ctr_svd = MpsContractor{SVDTruncate, GaugeStrategy}(net, [β/8, β/4, β/2, β], :graduate, params; onGPU=onGPU) +# ctr_svd = MpsContractor{SVDTruncate, GaugeStrategy}(net, [β/8, β/4, β/2, β], true, params; onGPU=onGPU) # @testset "Overlaps calculated in Python are the same as in Julia." begin # overlap_python = [0.2637787707674837, 0.2501621729619047, 0.2951954406837012] @@ -84,7 +84,7 @@ search_params = SearchParameters(num_states, δp) params; onGPU = onGPU, beta = β, - graduate_truncation = :graduate, + graduate_truncation = true, ) @testset "Overlaps calculated differently are the same." begin diff --git a/test/experimental/gauges_cuda.jl b/test/experimental/gauges_cuda.jl index e1dd6cf8..f4bc37c1 100644 --- a/test/experimental/gauges_cuda.jl +++ b/test/experimental/gauges_cuda.jl @@ -23,8 +23,8 @@ end cluster_assignment_rule = pegasus_lattice((m, n, t)), ) - params = MpsParameters{Float64}(BOND_DIM, VAR_TOL, MAX_SWEEPS, TOL_SVD) - search_params = SearchParameters(MAX_STATES, δp) + params = MpsParameters{Float64}(;bond_dim=BOND_DIM, var_tol=VAR_TOL, num_sweeps=MAX_SWEEPS, tol_SVD=TOL_SVD) + search_params = SearchParameters(;max_states=MAX_STATES, cutoff_prob=δp) Gauge = GaugeStrategy Strategy = Zipper Sparsity = Sparse @@ -44,16 +44,16 @@ end params; onGPU = onGPU, beta = β, - graduate_truncation = :graduate, + graduate_truncation = true, ) update_gauges!(ctr, m, Val(:up)) sol, s = low_energy_spectrum(ctr, search_params) #sol = low_energy_spectrum(ctr, search_params, merge_branches(ctr)) ig_states = decode_potts_hamiltonian_state.(Ref(potts_h), sol.states) - @test sol.energies ≈ energy.(Ref(ig), ig_states) + @test sol.energies ≈ SpinGlassNetworks.energy.(Ref(ig), ig_states) potts_h_states = decode_state.(Ref(net), sol.states) - @test sol.energies ≈ energy.(Ref(potts_h), potts_h_states) + @test sol.energies ≈ SpinGlassNetworks.energy.(Ref(potts_h), potts_h_states) norm_prob = exp.(sol.probabilities .- sol.probabilities[1]) # println( maximum(abs.(norm_prob ./ exp.(-β .* (sol.energies .- sol.energies[1]))) .- 1 )) diff --git a/test/experimental/mpo_size.jl b/test/experimental/mpo_size.jl index c0190815..670fa929 100644 --- a/test/experimental/mpo_size.jl +++ b/test/experimental/mpo_size.jl @@ -88,7 +88,7 @@ for cl_states in cluster_states params; onGPU = onGPU, beta = β, - graduate_truncation = :graduate, + graduate_truncation = true, ) Ws = SpinGlassEngine.mpo(ctr, ctr.layers.main, i) # println(" Ws -> ", which_device(Ws), " ", format_bytes.(measure_memory(Ws))) diff --git a/test/experimental/sampling.jl b/test/experimental/sampling.jl index a1f3f904..44631490 100644 --- a/test/experimental/sampling.jl +++ b/test/experimental/sampling.jl @@ -41,7 +41,7 @@ ctr = MpsContractor{Strategy,Gauge,Float64}( params; onGPU = onGPU, beta = β, - graduate_truncation = :graduate, + graduate_truncation = true, ) sol = gibbs_sampling(ctr, search_params) diff --git a/test/experimental/search_chimera_gauge.jl b/test/experimental/search_chimera_gauge.jl index 56bcd1a0..8c0d6e5d 100644 --- a/test/experimental/search_chimera_gauge.jl +++ b/test/experimental/search_chimera_gauge.jl @@ -11,7 +11,7 @@ TOL_SVD = 1E-16 DE = 16.0 δp = 1E-5 * exp(-β * DE) - instance = "$(@__DIR__)/instances/chimera_droplets/512power/001.txt" + instance = "$(@__DIR__)/../instances/chimera_droplets/512power/001.txt" ig = ising_graph(instance) potts_h = potts_hamiltonian( ig, @@ -19,8 +19,8 @@ cluster_assignment_rule = super_square_lattice((m, n, t)), ) - params = MpsParameters{Float64}(BOND_DIM, VAR_TOL, MAX_SWEEPS, TOL_SVD) - search_params = SearchParameters(MAX_STATES, δp) + params = MpsParameters{Float64}(; bond_dim=BOND_DIM, var_tol=VAR_TOL, num_sweeps=MAX_SWEEPS, tol_SVD=TOL_SVD) + search_params = SearchParameters(; max_states=MAX_STATES, cutoff_prob=δp) Gauge = GaugeStrategy energies = Vector{Float64}[] @@ -38,16 +38,16 @@ params; onGPU = onGPU, beta = β, - graduate_truncation = :graduate, + graduate_truncation = true, ) update_gauges!(ctr, m, Val(:up)) - sol, s = low_energy_spectrum(ctr, search_params) - #sol = low_energy_spectrum(ctr, search_params, merge_branches(ctr)) + # sol, s = low_energy_spectrum(ctr, search_params) + sol, s = low_energy_spectrum(ctr, search_params, merge_branches(ctr)) ig_states = decode_potts_hamiltonian_state.(Ref(potts_h), sol.states) - @test sol.energies ≈ energy.(Ref(ig), ig_states) + @test sol.energies ≈ SpinGlassNetworks.energy.(Ref(ig), ig_states) potts_h_states = decode_state.(Ref(net), sol.states) - @test sol.energies ≈ energy.(Ref(potts_h), potts_h_states) + @test sol.energies ≈ SpinGlassNetworks.energy.(Ref(potts_h), potts_h_states) norm_prob = exp.(sol.probabilities .- sol.probabilities[1]) # println( maximum(abs.(norm_prob ./ exp.(-β .* (sol.energies .- sol.energies[1]))) .- 1 )) diff --git a/test/experimental/squarestar_double_node_pegasus.jl b/test/experimental/squarestar_double_node_pegasus.jl index 53137ad0..6e984920 100644 --- a/test/experimental/squarestar_double_node_pegasus.jl +++ b/test/experimental/squarestar_double_node_pegasus.jl @@ -315,15 +315,15 @@ for tran ∈ all_lattice_transformations #[LatticeTransformation((1, 2, 3, 4), f params; onGPU = onGPU, beta = β, - graduate_truncation = :graduate, + graduate_truncation = true, ) sol, s = low_energy_spectrum( ctr, search_params, merge_branches( ctr; - merge_type = :nofit, - update_droplets = SingleLayerDroplets(; max_energy=eng, min_size=hamming_dist, metric=:hamming), + merge_prob = :none , + droplets_encoding = SingleLayerDroplets(; max_energy=eng, min_size=hamming_dist, metric=:hamming), ), ) println(sol.energies) diff --git a/test/experimental/squarestar_double_node_zephyr.jl b/test/experimental/squarestar_double_node_zephyr.jl index 77d35de6..d0c54807 100644 --- a/test/experimental/squarestar_double_node_zephyr.jl +++ b/test/experimental/squarestar_double_node_zephyr.jl @@ -51,7 +51,7 @@ ctr = MpsContractor{Strategy,Gauge,Float64}( params; onGPU = onGPU, beta = β, - graduate_truncation = :graduate, + graduate_truncation = true, ) # for i in 1//2 : 1//2 : m diff --git a/test/experimental/truncate.jl b/test/experimental/truncate.jl index 3731467c..69436e84 100644 --- a/test/experimental/truncate.jl +++ b/test/experimental/truncate.jl @@ -83,7 +83,7 @@ for cs ∈ cl_states params; onGPU = onGPU, beta = β, - graduate_truncation = :graduate, + graduate_truncation = true, ) sol, schmidts = low_energy_spectrum(ctr, search_params, merge_branches(ctr)) println("sol ", sol) diff --git a/test/experimental/truncate_small.jl b/test/experimental/truncate_small.jl index c3268987..10a48178 100644 --- a/test/experimental/truncate_small.jl +++ b/test/experimental/truncate_small.jl @@ -85,7 +85,7 @@ function run_test(instance, m, n, t) params; onGPU = onGPU, beta = β, - graduate_truncation = :graduate, + graduate_truncation = true, ) sol, schmidts = low_energy_spectrum(ctr, search_params, merge_branches(ctr)) #, merge_branches(ctr)) diff --git a/test/experimental/zipper.jl b/test/experimental/zipper.jl index 9713020f..39067f76 100644 --- a/test/experimental/zipper.jl +++ b/test/experimental/zipper.jl @@ -51,7 +51,7 @@ ctr = MpsContractor{Strategy,Gauge,Float64}( params; onGPU = onGPU, beta = β, - graduate_truncation = :graduate, + graduate_truncation = true, ) Ws = SpinGlassEngine.mpo(ctr, ctr.layers.main, i) println(" Ws -> ", which_device(Ws), " ", format_bytes.(measure_memory(Ws))) @@ -62,7 +62,7 @@ ctr = MpsContractor{Strategy,Gauge,Float64}( params; onGPU = onGPU, beta = β, - graduate_truncation = :graduate, + graduate_truncation = true, ) Wd = SpinGlassEngine.mpo(ctr, ctr.layers.main, i) println(" Wd -> ", which_device(Wd), " ", format_bytes.(measure_memory(Wd))) diff --git a/test/mwe.jl b/test/mwe.jl index cb6ab7df..b7ab8f27 100644 --- a/test/mwe.jl +++ b/test/mwe.jl @@ -42,7 +42,7 @@ for T in [Float64, Float32] num_sweeps = MAX_SWEEPS, tol_SVD = T(TOL_SVD), ) - search_params = SearchParameters(;max_states=mstates, cut_off_prob=δp) + search_params = SearchParameters(;max_states=mstates, cutoff_prob=δp) net = PEPSNetwork{SquareCrossDoubleNode{Layout},Sparsity,T}(m, n, potts_h, transform) ctr = MpsContractor{Strategy,Gauge,T}( @@ -50,7 +50,7 @@ for T in [Float64, Float32] params; onGPU = onGPU, beta = T(β), - graduate_truncation = :graduate, + graduate_truncation = true, ) sol, s = low_energy_spectrum(ctr, search_params) @test eltype(sol.energies) == T diff --git a/test/random_markov_field.jl b/test/random_markov_field.jl index 87269bb0..97c40eb8 100644 --- a/test/random_markov_field.jl +++ b/test/random_markov_field.jl @@ -8,9 +8,9 @@ potts_h = potts_hamiltonian(instance_dir) Nx, Ny = get_prop(potts_h, :Nx), get_prop(potts_h, :Ny) params = MpsParameters{Float64}(; bond_dim = bond_dim, var_tol = 1E-8, num_sweeps = 4) - search_params = SearchParameters(; max_states = num_states, cut_off_prob = δp) + search_params = SearchParameters(; max_states = num_states, cutoff_prob = δp) Gauge = NoUpdate - graduate_truncation = :graduate + graduate_truncation = true energies = Vector{Float64}[] Strategy = Zipper Layout = GaugesEnergy @@ -22,7 +22,7 @@ params; onGPU = onGPU, beta = β, - graduate_truncation = :graduate, + graduate_truncation = true, mode = :RMF, ) sol_peps, s = low_energy_spectrum(ctr, search_params, merge_branches(ctr)) diff --git a/test/runtests.jl b/test/runtests.jl index 24679370..e6f8ab26 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -37,6 +37,7 @@ push!( "search_chimera_droplets.jl", "search_pegasus_droplets.jl", "search_chimera_pathological_Z2.jl", + "mwe.jl", # time consuming tests: # "search_chimera_full.jl", diff --git a/test/search_chimera_droplets.jl b/test/search_chimera_droplets.jl index 12c26087..9b9a9739 100644 --- a/test/search_chimera_droplets.jl +++ b/test/search_chimera_droplets.jl @@ -24,7 +24,7 @@ function bench(instance::String) cluster_assignment_rule = super_square_lattice((m, n, t)), ) params = MpsParameters{Float64}(; bond_dim = bond_dim, var_tol = 1E-8, num_sweeps = 4, tol_SVD = 1E-16) - search_params = SearchParameters(; max_states = num_states, cut_off_prob = δp) + search_params = SearchParameters(; max_states = num_states, cutoff_prob = δp) energies = Vector{Float64}[] for Strategy ∈ (Zipper,), Sparsity ∈ (Dense,) @@ -41,15 +41,15 @@ function bench(instance::String) params; onGPU = onGPU, beta = β, - graduate_truncation = :graduate, + graduate_truncation = true, ) sol1, s = low_energy_spectrum( ctr, search_params, merge_branches( ctr; - merge_type = :nofit, - update_droplets = SingleLayerDroplets(; max_energy=1, min_size=1000, metric=:hamming), + merge_prob = :none , + droplets_encoding = SingleLayerDroplets(; max_energy=1, min_size=1000, metric=:hamming), ), ) diff --git a/test/search_chimera_full.jl b/test/search_chimera_full.jl index 361ecd3f..f983ab13 100644 --- a/test/search_chimera_full.jl +++ b/test/search_chimera_full.jl @@ -23,7 +23,7 @@ function bench(instance::String) cluster_assignment_rule = super_square_lattice((m, n, t)), ) params = MpsParameters{Float64}(; bond_dim = bond_dim, var_tol = 1E-8, num_sweeps = 4, tol_SVD = 1E-16) - search_params = SearchParameters(; max_states = num_states, cut_off_prob = δp) + search_params = SearchParameters(; max_states = num_states, cutoff_prob = δp) energies = Vector{Float64}[] for Strategy ∈ (SVDTruncate, Zipper), Sparsity ∈ (Dense, Sparse) @@ -41,12 +41,12 @@ function bench(instance::String) params; onGPU = onGPU, beta = β, - graduate_truncation = :graduate, + graduate_truncation = true, ) sol, s = low_energy_spectrum( ctr, search_params, - merge_branches(ctr; merge_type = :nofit), + merge_branches(ctr; merge_prob = :none ), ) @test sol.energies[begin] ≈ ground_energy diff --git a/test/search_chimera_pathological.jl b/test/search_chimera_pathological.jl index d639cca3..9bd343ed 100644 --- a/test/search_chimera_pathological.jl +++ b/test/search_chimera_pathological.jl @@ -115,7 +115,7 @@ transform = $transform cluster_assignment_rule = super_square_lattice((m, n, t)), ) params = MpsParameters{Float64}(; bond_dim = bond_dim, var_tol = 1E-8, num_sweeps = 4) - search_params = SearchParameters(; max_states = num_states, cut_off_prob = 0.0) + search_params = SearchParameters(; max_states = num_states, cutoff_prob = 0.0) Gauge = NoUpdate energies = Vector{Float64}[] @@ -127,7 +127,7 @@ transform = $transform params; onGPU = onGPU, beta = β, - graduate_truncation = :graduate, + graduate_truncation = true, ) sol, s = low_energy_spectrum(ctr, search_params) diff --git a/test/search_chimera_pathological_Z2.jl b/test/search_chimera_pathological_Z2.jl index 0cc81b8d..ec904f1b 100644 --- a/test/search_chimera_pathological_Z2.jl +++ b/test/search_chimera_pathological_Z2.jl @@ -104,7 +104,7 @@ cluster_assignment_rule = super_square_lattice((m, n, t)), ) params = MpsParameters{Float64}(; bond_dim = bond_dim, var_tol = 1E-8, num_sweeps = 4) - search_params = SearchParameters(; max_states = num_states, cut_off_prob = 0.0) + search_params = SearchParameters(; max_states = num_states, cutoff_prob = 0.0) Gauge = NoUpdate energies = Vector{Float64}[] @@ -124,15 +124,15 @@ params; onGPU = onGPU, beta = β, - graduate_truncation = :graduate, + graduate_truncation = true, ) sol1, s = low_energy_spectrum( ctr, search_params, merge_branches( ctr; - merge_type = :nofit, - update_droplets = SingleLayerDroplets(; max_energy=10.0, min_size=0, metric=:hamming), + merge_prob = :none , + droplets_encoding = SingleLayerDroplets(; max_energy=10.0, min_size=0, metric=:hamming), ), :Z2, ) diff --git a/test/search_chimera_pathological_droplets.jl b/test/search_chimera_pathological_droplets.jl index cbbb2800..1d3092bc 100644 --- a/test/search_chimera_pathological_droplets.jl +++ b/test/search_chimera_pathological_droplets.jl @@ -105,7 +105,7 @@ cluster_assignment_rule = super_square_lattice((m, n, t)), ) params = MpsParameters{Float64}(; bond_dim = bond_dim, var_tol = 1E-8, num_sweeps = 4) - search_params = SearchParameters(; max_states = num_states, cut_off_prob = 0.0) + search_params = SearchParameters(; max_states = num_states, cutoff_prob = 0.0) Gauge = NoUpdate energies = Vector{Float64}[] @@ -127,7 +127,7 @@ params; onGPU = onGPU, beta = β, - graduate_truncation = :graduate, + graduate_truncation = true, ) sol1, s = low_energy_spectrum( ctr, @@ -135,11 +135,11 @@ merge_branches_blur( ctr, hamming_dist, - :nofit, + :none , SingleLayerDroplets(; max_energy=1.01, min_size=1, metric=:hamming), ), ) - # sol1, s = low_energy_spectrum(ctr, search_params, merge_branches(ctr, :nofit, SingleLayerDroplets(1.01, 1, :hamming))) + # sol1, s = low_energy_spectrum(ctr, search_params, merge_branches(ctr, :none , SingleLayerDroplets(1.01, 1, :hamming))) @test sol1.energies ≈ [exact_energies[1]] sol2 = unpack_droplets(sol1, β) diff --git a/test/search_chimera_pathological_hamming.jl b/test/search_chimera_pathological_hamming.jl index b328a9eb..35650d86 100644 --- a/test/search_chimera_pathological_hamming.jl +++ b/test/search_chimera_pathological_hamming.jl @@ -118,7 +118,7 @@ end ) params = MpsParameters{Float64}(; bond_dim = bond_dim, var_tol = 1E-8, num_sweeps = 4) - search_params = SearchParameters(; max_states = num_states, cut_off_prob = 0.0) + search_params = SearchParameters(; max_states = num_states, cutoff_prob = 0.0) Gauge = NoUpdate energies = Vector{Float64}[] @@ -138,7 +138,7 @@ end params; onGPU = onGPU, beta = β, - graduate_truncation = :graduate, + graduate_truncation = true, ) sol1, s = low_energy_spectrum( ctr, @@ -146,7 +146,7 @@ end merge_branches_blur( ctr, hamming_dist, - :nofit, + :none , SingleLayerDroplets(; max_energy=1.01, min_size=10, metric=:hamming), ), ) diff --git a/test/search_chimera_smallest.jl b/test/search_chimera_smallest.jl index 1e2e6a58..f322474a 100644 --- a/test/search_chimera_smallest.jl +++ b/test/search_chimera_smallest.jl @@ -16,7 +16,7 @@ cluster_assignment_rule = super_square_lattice((m, n, t)), ) - search_params = SearchParameters(; max_states = num_states, cut_off_prob = 0.0) + search_params = SearchParameters(; max_states = num_states, cutoff_prob = 0.0) Gauge = NoUpdate for T in [Float32, Float64] energies = Vector{T}[] @@ -32,7 +32,7 @@ params; onGPU = onGPU, beta = T(β), - graduate_truncation = :graduate, + graduate_truncation = true, ) sol, s = low_energy_spectrum(ctr, search_params) @test eltype(sol.energies) == T diff --git a/test/search_chimera_smallest_droplets.jl b/test/search_chimera_smallest_droplets.jl index 4aa3f6d2..8ca2fe45 100644 --- a/test/search_chimera_smallest_droplets.jl +++ b/test/search_chimera_smallest_droplets.jl @@ -17,7 +17,7 @@ ) params = MpsParameters{Float64}(; bond_dim = bond_dim, var_tol = 1E-8, num_sweeps = 4) - search_params = SearchParameters(; max_states = num_states, cut_off_prob = 0.0) + search_params = SearchParameters(; max_states = num_states, cutoff_prob = 0.0) Gauge = NoUpdate energies = Vector{Float64}[] @@ -35,7 +35,7 @@ params; onGPU = onGPU, beta = β, - graduate_truncation = :graduate, + graduate_truncation = true, ) sol1, s = low_energy_spectrum( @@ -43,8 +43,8 @@ search_params, merge_branches( ctr; - merge_type = :nofit, - update_droplets = SingleLayerDroplets(; max_energy=2.2, min_size=1, metric=:hamming), + merge_prob = :none , + droplets_encoding = SingleLayerDroplets(; max_energy=2.2, min_size=1, metric=:hamming), ), ) diff --git a/test/search_cross_square_star.jl b/test/search_cross_square_star.jl index 64a43853..d7fa5ea5 100644 --- a/test/search_cross_square_star.jl +++ b/test/search_cross_square_star.jl @@ -16,7 +16,7 @@ cluster_assignment_rule = super_square_lattice((m, n, t)), ) params = MpsParameters{Float64}(; bond_dim = bond_dim, var_tol = 1E-8, num_sweeps = 4) - search_params = SearchParameters(; max_states = num_states, cut_off_prob = 0.0) + search_params = SearchParameters(; max_states = num_states, cutoff_prob = 0.0) Gauge = NoUpdate energies = Vector{Float64}[] @@ -29,7 +29,7 @@ params; onGPU = onGPU, beta = β, - graduate_truncation = :graduate, + graduate_truncation = true, ) sol, s = low_energy_spectrum(ctr, search_params) diff --git a/test/search_pegasus_droplets.jl b/test/search_pegasus_droplets.jl index 1c82ac8a..38dcd855 100644 --- a/test/search_pegasus_droplets.jl +++ b/test/search_pegasus_droplets.jl @@ -24,7 +24,7 @@ function bench(instance::String) cluster_assignment_rule = pegasus_lattice((m, n, t)), ) params = MpsParameters{Float64}(; bond_dim = bond_dim, var_tol = 1E-8, num_sweeps = 4, tol_SVD = 1E-16) - search_params = SearchParameters(; max_states = num_states, cut_off_prob = δp) + search_params = SearchParameters(; max_states = num_states, cutoff_prob = δp) energies = Vector{Float64}[] for Strategy ∈ (Zipper,), Sparsity ∈ (Sparse,) @@ -41,15 +41,15 @@ function bench(instance::String) params; onGPU = onGPU, beta = β, - graduate_truncation = :graduate, + graduate_truncation = true, ) sol1, s = low_energy_spectrum( ctr, search_params, merge_branches( ctr; - merge_type = :nofit, - update_droplets = SingleLayerDroplets(; max_energy=0.01, min_size=20, metric=:hamming), + merge_prob = :none , + droplets_encoding = SingleLayerDroplets(; max_energy=0.01, min_size=20, metric=:hamming), ), ) diff --git a/test/search_pegasus_nodiag_square_cross.jl b/test/search_pegasus_nodiag_square_cross.jl index 94c8c119..7e9df3c0 100644 --- a/test/search_pegasus_nodiag_square_cross.jl +++ b/test/search_pegasus_nodiag_square_cross.jl @@ -20,7 +20,7 @@ function bench(instance::String) cluster_assignment_rule = super_square_lattice((m, n, t)), ) params = MpsParameters{Float64}(; bond_dim = bond_dim, var_tol = 1E-8, num_sweeps = 4) - search_params = SearchParameters(; max_states = num_states, cut_off_prob = δp) + search_params = SearchParameters(; max_states = num_states, cutoff_prob = δp) # Solve using PEPS search energies = Vector{Float64}[] @@ -39,7 +39,7 @@ function bench(instance::String) params; onGPU = onGPU, beta = β, - graduate_truncation = :graduate, + graduate_truncation = true, ) sol_peps, s = low_energy_spectrum(ctr, search_params, merge_branches(ctr)) push!(energies, sol_peps.energies) diff --git a/test/search_pegasus_square_cross.jl b/test/search_pegasus_square_cross.jl index 758b2ad4..9aec4903 100644 --- a/test/search_pegasus_square_cross.jl +++ b/test/search_pegasus_square_cross.jl @@ -18,9 +18,9 @@ function bench(instance::String) cluster_assignment_rule = super_square_lattice((m, n, t)), ) params = MpsParameters{Float64}(; bond_dim = bond_dim, var_tol = 1E-8, num_sweeps = 4) - search_params = SearchParameters(max_states = num_states, cut_off_prob = δp) + search_params = SearchParameters(max_states = num_states, cutoff_prob = δp) Gauge = NoUpdate - graduate_truncation = :graduate + graduate_truncation = true # Solve using PEPS search energies = Vector{Float64}[] diff --git a/test/search_smallest_cross_square_cross.jl b/test/search_smallest_cross_square_cross.jl index 59e55eb7..3790e2c1 100644 --- a/test/search_smallest_cross_square_cross.jl +++ b/test/search_smallest_cross_square_cross.jl @@ -16,7 +16,7 @@ cluster_assignment_rule = super_square_lattice((m, n, t)), ) params = MpsParameters{Float64}(; bond_dim = bond_dim, var_tol = 1E-8, num_sweeps = 4) - search_params = SearchParameters(; max_states = num_states, cut_off_prob = 0.0) + search_params = SearchParameters(; max_states = num_states, cutoff_prob = 0.0) for Strategy ∈ (SVDTruncate, Zipper), Sparsity ∈ (Dense, Sparse) for Layout ∈ (EnergyGauges, GaugesEnergy, EngGaugesEng) @@ -32,7 +32,7 @@ params; onGPU = onGPU, beta = β, - graduate_truncation = :graduate, + graduate_truncation = true, ) sol, s = low_energy_spectrum(ctr, search_params) diff --git a/test/search_square_double_node_basic.jl b/test/search_square_double_node_basic.jl index a11aef04..f4e763c7 100644 --- a/test/search_square_double_node_basic.jl +++ b/test/search_square_double_node_basic.jl @@ -20,7 +20,7 @@ function run_test_square_double_node(instance, m, n, t) ) params = MpsParameters{Float64}(; bond_dim = bond_dim, var_tol = 1E-8, num_sweeps = 4) - search_params = SearchParameters(; max_states = num_states, cut_off_prob = δp) + search_params = SearchParameters(; max_states = num_states, cutoff_prob = δp) energies = [] Gauge = NoUpdate @@ -42,14 +42,14 @@ function run_test_square_double_node(instance, m, n, t) params; onGPU = onGPU, beta = β, - graduate_truncation = :graduate, + graduate_truncation = true, ) ctr2 = MpsContractor{Strategy,Gauge,Float64}( net2, params; onGPU = onGPU, beta = β, - graduate_truncation = :graduate, + graduate_truncation = true, ) sol, s = low_energy_spectrum(ctr, search_params) #, merge_branches(ctr)) diff --git a/test/search_square_lattice.jl b/test/search_square_lattice.jl index 15a14ebf..4e410058 100644 --- a/test/search_square_lattice.jl +++ b/test/search_square_lattice.jl @@ -16,9 +16,9 @@ function bench(instance::String) cluster_assignment_rule = super_square_lattice((m, n, t)), ) params = MpsParameters{Float64}(; bond_dim = bond_dim, var_tol = 1E-8, num_sweeps = 4) - search_params = SearchParameters(; max_states = num_states, cut_off_prob = δp) + search_params = SearchParameters(; max_states = num_states, cutoff_prob = δp) Gauge = NoUpdate - graduate_truncation = :graduate + graduate_truncation = true energies = Vector{Float64}[] for Strategy ∈ (SVDTruncate, Zipper), transform ∈ all_lattice_transformations diff --git a/test/search_squarecross_double_node_basic.jl b/test/search_squarecross_double_node_basic.jl index a77b6963..bd782ab1 100644 --- a/test/search_squarecross_double_node_basic.jl +++ b/test/search_squarecross_double_node_basic.jl @@ -21,7 +21,7 @@ function run_test_squarecross_double_node(instance, m, n, t) ) params = MpsParameters{Float64}(; bond_dim = bond_dim, var_tol = 1E-8, num_sweeps = 4) - search_params = SearchParameters(; max_states = num_states, cut_off_prob = δp) + search_params = SearchParameters(; max_states = num_states, cutoff_prob = δp) energies = [] Gauge = NoUpdate @@ -47,14 +47,14 @@ function run_test_squarecross_double_node(instance, m, n, t) params; onGPU = onGPU, beta = β, - graduate_truncation = :graduate, + graduate_truncation = true, ) ctr2 = MpsContractor{Strategy,Gauge,Float64}( net2, params; onGPU = onGPU, beta = β, - graduate_truncation = :graduate, + graduate_truncation = true, ) sol, s = low_energy_spectrum(ctr, search_params) #, merge_branches(ctr)) From 1893c19cddfdcf10430e90be9ba5ce011715d077 Mon Sep 17 00:00:00 2001 From: annamariadziubyna Date: Sun, 4 Aug 2024 14:05:33 +0200 Subject: [PATCH 10/12] new branch from paper --- benchmarks/bench.jl | 134 ------------------ publication/bench.jl | 53 ------- .../instances/square_diagonal/3x3x2.txt | 89 ------------ test/runtests.jl | 1 - 4 files changed, 277 deletions(-) delete mode 100644 benchmarks/bench.jl delete mode 100644 publication/bench.jl delete mode 100644 publication/instances/square_diagonal/3x3x2.txt diff --git a/benchmarks/bench.jl b/benchmarks/bench.jl deleted file mode 100644 index 257c8404..00000000 --- a/benchmarks/bench.jl +++ /dev/null @@ -1,134 +0,0 @@ -using MPI -using LinearAlgebra -using MKL -using SpinGlassEngine -using SpinGlassNetworks -using SpinGlassTensors -using SpinGlassExhaustive -using Logging -using CSV -using DataFrames -using Memoization - -function brute_force_gpu(ig::IsingGraph; num_states::Int) - brute_force(ig, :GPU, num_states=num_states) -end - -MPI.Init() -size = MPI.Comm_size(MPI.COMM_WORLD) -rank = MPI.Comm_rank(MPI.COMM_WORLD) - -M, N, T = 3, 3, 3 -INSTANCE_DIR = "$(@__DIR__)/../test/instances/pegasus_random/P4/RCO/SpinGlass" -OUTPUT_DIR = "$(@__DIR__)/results/pegasus_random/P4/RCO/final_bench_float32_betas_tr2^20" -if !Base.Filesystem.isdir(OUTPUT_DIR) - Base.Filesystem.mkpath(OUTPUT_DIR) -end -BETAS = [0.25,0.5, 1.0, 2.0, 5.0, 10.0] #collect(0.5:0.5:3) -LAYOUT = (GaugesEnergy,) -TRANSFORM = [all_lattice_transformations[1],] -TT = Float32 -GAUGE = NoUpdate -STRATEGY = Zipper #SVDTruncate -SPARSITY = Sparse -graduate_truncation = :graduate - -MAX_STATES = 1024 -BOND_DIM = 8 -DE = 16.0 -cs=2^20 -iter = 2 - -RESULTS_FOLDER = "$(@__DIR__)/../test/instances/pegasus_random/P4/RCO/BP" -inst="001" -MAX_SWEEPS = 0 -VAR_TOL = 1E-16 -TOL_SVD = 1E-16 -ITERS_SVD = 2 -ITERS_VAR = 1 -DTEMP_MULT = 2 -METHOD = :psvd_sparse -disable_logging(LogLevel(1)) -BLAS.set_num_threads(1) - -function pegasus_sim(inst, trans, β, Layout) - δp = 0.0 - - potts_h = potts_hamiltonian( - ising_graph(INSTANCE_DIR * "/" * inst), - spectrum=full_spectrum, - cluster_assignment_rule=pegasus_lattice((M, N, T)) - ) - potts_h = truncate_potts_hamiltonian(potts_h, β, cs, RESULTS_FOLDER, inst; tol=1e-6, iter=iter) - - # params = MpsParameters{TT}(;bond_dim=BOND_DIM, var_tol=TT(VAR_TOL), num_sweeps=MAX_SWEEPS, tol_SVD=TT(TOL_SVD), iters_SVD=ITERS_SVD, iters_var=ITERS_VAR, Dtemp_multiplier=DTEMP_MULT, method=METHOD) - params = MpsParameters{TT}(; bond_dim=BOND_DIM, var_tol=TT(VAR_TOL), num_sweeps=MAX_SWEEPS) - - search_params = SearchParameters(; max_states=MAX_STATES, cut_off_prob=δp) - - net = PEPSNetwork{SquareCrossDoubleNode{Layout}, SPARSITY, TT}(M, N, potts_h, trans) - ctr = MpsContractor{STRATEGY, GAUGE, TT}(net, params; onGPU = true, beta = TT(β), graduate_truncation = graduate_truncation) - sol, s = low_energy_spectrum(ctr, search_params, merge_branches(ctr; merge_type=:nofit)) - - # cRAM = round(Base.summarysize(Memoization.caches) * 1E-9; sigdigits=2) - clear_memoize_cache() - sol, ctr -end - -function run_bench(inst::String, β::Real, t, l) - hash_name = hash(string(inst, β, t, l)) - out_path = string(OUTPUT_DIR, "/", hash_name, ".csv") - - if isfile(out_path) - println("Skipping for $β, $t, $l.") - else - data = try - tic_toc = @elapsed sol, ctr = pegasus_sim(inst, t, β, l) - - data = DataFrame( - :instance => inst, - :β => β, - :Layout => l, - :transform => t, - :energy => sol.energies[begin], - :probabilities => sol.probabilities, - :discarded_probability => sol.largest_discarded_probability, - :statistic => minimum(values(ctr.statistics)), - :max_states => MAX_STATES, - :bond_dim => BOND_DIM, - :cs => cs, - :de => DE, - :max_sweeps => MAX_SWEEPS, - :var_tol => VAR_TOL, - :time => tic_toc - # :cRAM => cRAM - ) - catch err - data = DataFrame( - :instance => inst, - :β => β, - :Layout => l, - :transform => t, - :max_states => MAX_STATES, - :bond_dim => BOND_DIM, - :de => DE, - :max_sweeps => MAX_SWEEPS, - :var_tol => VAR_TOL, - :error => err - ) - end - println(data) - CSV.write(out_path, data, delim = ';', append = false) - end #if -end - -all_params = collect( - Iterators.product( - readdir(INSTANCE_DIR, join=false), BETAS, TRANSFORM, LAYOUT) -) - -for i ∈ (1+rank):size:length(all_params) - run_bench(all_params[i]...) - GC.gc() -end -# run_bench(all_params[1]...) \ No newline at end of file diff --git a/publication/bench.jl b/publication/bench.jl deleted file mode 100644 index 1f1b478e..00000000 --- a/publication/bench.jl +++ /dev/null @@ -1,53 +0,0 @@ -using SpinGlassEngine -using SpinGlassNetworks - -function get_instance(topology::NTuple{3, Int}) - m, n, t = topology - "$(@__DIR__)/instances/square_diagonal/$(m)x$(n)x$(t).txt" -end - -function run_square_diag_bench(::Type{T}; topology::NTuple{3, Int}) where {T} - m, n, _ = topology - instance = get_instance(topology) - lattice = super_square_lattice(topology) - - best_energies = T[] - - potts_h = potts_hamiltonian( - ising_graph(instance), - spectrum = full_spectrum, - cluster_assignment_rule = lattice, - ) - - params = MpsParameters{T}(; bond_dim = 16, num_sweeps = 1) - search_params = SearchParameters(; max_states = 2^8, cutoff_prob = 1E-4) - - for transform ∈ all_lattice_transformations - net = PEPSNetwork{KingSingleNode{GaugesEnergy}, Dense, T}( - m, n, potts_h, transform, - ) - - ctr = MpsContractor{SVDTruncate, NoUpdate, T}( - net, params; - onGPU = false, beta = T(2), graduate_truncation = true, - ) - - droplets = SingleLayerDroplets(; max_energy = 10, min_size = 5, metric = :hamming) - merge_strategy = merge_branches( - ctr; merge_prob = :none , droplets_encoding = droplets, - ) - - sol, info = low_energy_spectrum(ctr, search_params, merge_strategy) - - push!(best_energies, sol.energies[1]) - clear_memoize_cache() - end - - ground = minimum(best_energies) - @assert all(ground .≈ best_energies) - - println("Best energy found: $(ground)") -end - -T = Float32 -@time run_square_diag_bench(T; topology = (3, 3, 2)) \ No newline at end of file diff --git a/publication/instances/square_diagonal/3x3x2.txt b/publication/instances/square_diagonal/3x3x2.txt deleted file mode 100644 index 0e603cb5..00000000 --- a/publication/instances/square_diagonal/3x3x2.txt +++ /dev/null @@ -1,89 +0,0 @@ -1 2 -0.5320600854590267 -3 4 0.38402265869664154 -3 1 -0.5436924524983267 -3 2 0.21977738991479145 -4 1 -0.5628699912291399 -4 2 0.7923812769160723 -5 6 0.38332124497444475 -5 3 -0.2766447992621366 -5 4 0.43076811014522653 -6 3 0.08210571803994982 -6 4 -0.9915874978177643 -7 8 0.6014253456011047 -7 1 0.37763583164851355 -7 2 -0.26590744578208203 -8 1 0.9690946973530548 -8 2 -0.67694551766651 -9 10 -0.14153430905690412 -9 3 0.16759090162116919 -9 4 -0.8174998097136141 -10 3 -0.40403760194281046 -10 4 -0.6356483089131602 -9 7 0.04392506131183804 -9 8 0.9829874976922899 -10 7 -0.35689548049316144 -10 8 -0.1672648223095825 -9 1 -0.5786261566035802 -9 2 -0.34406623378116596 -10 1 0.100481750570526 -10 2 0.8038842162474464 -11 12 -0.8956911493893849 -11 5 -0.8630057217020062 -11 6 0.6306623988860585 -12 5 0.7504141436046725 -12 6 -0.9352371863606841 -11 9 -0.6803222587957678 -11 10 0.689782704271011 -12 9 0.7752150591589735 -12 10 -0.8343312141855883 -11 3 -0.5559557250718317 -11 4 0.17582966006044876 -12 3 0.19181763419530173 -12 4 0.27431075715253805 -13 14 0.7478095997218 -13 7 -0.4883614012946449 -13 8 0.9576256441396791 -14 7 -0.28912688765567185 -14 8 0.1089802463072973 -15 16 0.38262916472610375 -15 9 -0.3873909056772129 -15 10 -0.25725344989877863 -16 9 0.28309439316509377 -16 10 0.2501090573988438 -15 13 -0.6485175435412747 -15 14 -0.7668063443712008 -16 13 0.8137706230969115 -16 14 -0.2661847224606624 -15 7 -0.6442936476294694 -15 8 -0.5878720857895017 -16 7 -0.2581141133504936 -16 8 0.8888574164902534 -17 18 0.041339313482924744 -17 11 0.08787406849163526 -17 12 0.3277246664347784 -18 11 0.6635244080829124 -18 12 0.895970973800222 -17 15 -0.8035789245059162 -17 16 -0.21808521717755824 -18 15 -0.08569957531620931 -18 16 -0.49482281831259667 -17 9 0.2431182105351657 -17 10 0.20271622624323782 -18 9 0.6760555244443007 -18 10 -0.9602980312054934 -3 7 -0.24974831265384578 -3 8 0.9495698025338444 -4 7 0.8113253594825927 -4 8 0.7115673096585802 -5 9 0.025972963895515067 -5 10 -0.05189668641649137 -6 9 -0.28231537364653914 -6 10 -0.6298126342821251 -9 13 -0.17065967935812698 -9 14 -0.5828355422867022 -10 13 -0.6395271429265674 -10 14 -0.6326498113627528 -11 15 -0.342645305990952 -11 16 -0.6444311859249112 -12 15 0.5023530387484465 -12 16 0.4161687742404492 \ No newline at end of file diff --git a/test/runtests.jl b/test/runtests.jl index e6f8ab26..24679370 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -37,7 +37,6 @@ push!( "search_chimera_droplets.jl", "search_pegasus_droplets.jl", "search_chimera_pathological_Z2.jl", - "mwe.jl", # time consuming tests: # "search_chimera_full.jl", From 8888ed859bc0cb215ff252f3f48ffe60c2cc97d7 Mon Sep 17 00:00:00 2001 From: annamariadziubyna Date: Sun, 4 Aug 2024 14:06:40 +0200 Subject: [PATCH 11/12] change version --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 4a32df05..93ff23c0 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "SpinGlassEngine" uuid = "0563570f-ea1b-4080-8a64-041ac6565a4e" authors = ["Anna Maria Dziubyna ", "Tomasz Śmierzchalski ", "Bartłomiej Gardas ", "Konrad Jałowiecki ", "Łukasz Pawela ", "Marek M. Rams "] -version = "1.3.0" +version = "1.3.1" [deps] CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba" From 1a24533a88e209968f79fd8bb8427a8a5a9f5083 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Pawela?= Date: Tue, 3 Sep 2024 15:03:29 +0200 Subject: [PATCH 12/12] bump version --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 93ff23c0..cb913c83 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "SpinGlassEngine" uuid = "0563570f-ea1b-4080-8a64-041ac6565a4e" authors = ["Anna Maria Dziubyna ", "Tomasz Śmierzchalski ", "Bartłomiej Gardas ", "Konrad Jałowiecki ", "Łukasz Pawela ", "Marek M. Rams "] -version = "1.3.1" +version = "1.4.0" [deps] CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba"