TensorBFS / OMEinsumContractionOrders.jl

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

A new method for the greedy optimizer #41

Closed ArrogantGao closed 5 months ago

ArrogantGao commented 5 months ago

The following changes have been made in this PR:

  1. Added a new optimizer "Hyper-Greedy". In each step, instead of directly selecting the contraction pair with the lowest cost, here we sampling one of them according to the cost $\exp(-L / t)$, where $L$ is the cost and $t$ is the temperature, thus it may given better results that greedy.
  2. Deps of BetterExp is removed, since it has been merge to Base since Julia@1.6, and currently exp2 provided by Base seems better:
    
    julia> @btime exp2(1.0);
    0.791 ns (0 allocations: 0 bytes)

julia> @btime BetterExp.exp2(1.0); 1.625 ns (0 allocations: 0 bytes)

(betterexp) pkg> st Status ~/temp/betterexp/Project.toml [6e4b80f9] BenchmarkTools v1.5.0 [7cffe744] BetterExp v0.1.0



3. Added multi-threads support for `tree_greedy`.
ArrogantGao commented 5 months ago

Added a new struct GreedyStrategy for method of GreedyMethod. GreedyStrategy include parameters $\alpha$ and temperature, thus MinSpaceOut and MinSpaceDiff now are special case of GreedyStrategy.

ArrogantGao commented 5 months ago

These commented parts have been removed, and the doc strings are revised.