TensorBFS / OMEinsumContractionOrders.jl

Tensor network contraction order optimizers for OMEinsum
MIT License
25 stars 3 forks source link

simulated annealing #7

Closed GiggleLiu closed 3 years ago

GiggleLiu commented 3 years ago

The simulated annealing approach for optimizing the contraction order.

The simulated annealing is used to hierachical bipartite the graph. A simple using case is

julia> using LightGraphs, Random, OMEinsum, OMEinsumContractionOrders

julia> Random.seed!(2)
TaskLocalRNG()

julia> function random_regular_eincode(n, k)
           g = LightGraphs.random_regular_graph(n, k)
           ixs = [minmax(e.src,e.dst) for e in LightGraphs.edges(g)]
           return EinCode((ixs..., [(i,) for i in LightGraphs.vertices(g)]...), ())
       end
random_regular_eincode (generic function with 1 method)

julia> code = random_regular_eincode(220, 3);

julia> res = optimize_sa(code,uniformsize(code, 2); sc_target=30);

julia> tc, sc = OMEinsum.timespace_complexity(res, uniformsize(code, 2))
(41.409997300405024, 31.0)
codecov[bot] commented 3 years ago

Codecov Report

Merging #7 (b9586d0) into master (c7be6e5) will increase coverage by 2.23%. The diff coverage is 98.14%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master       #7      +/-   ##
==========================================
+ Coverage   92.59%   94.82%   +2.23%     
==========================================
  Files           1        2       +1     
  Lines         135      232      +97     
==========================================
+ Hits          125      220      +95     
- Misses         10       12       +2     
Impacted Files Coverage Δ
src/sa.jl 97.84% <97.84%> (ø)
src/kahypar.jl 92.80% <100.00%> (+0.21%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update c7be6e5...b9586d0. Read the comment docs.