-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added a solver based on exact tree width solver #43
Conversation
Added a function Here is an example: julia> using OMEinsumContractionOrders, OMEinsum, KaHyPar
julia> using OMEinsumContractionOrders: optimize_kahypar
# given a contraction with open edges
julia> ein_open = OMEinsum.rawcode(ein"ijl, jkm, ik -> lm")
ijl, jkm, ik -> lm
# add a dummy tensor manually
julia> ein_closed = OMEinsum.rawcode(ein"ijl, jkm, ik, lm ->")
ijl, jkm, ik, lm ->
# optimize
julia> opt_ein_closed = optimize_kahypar(ein_closed, uniformsize(ein_closed, 2); max_group_size=10, sc_target=10)
lm, lm ->
├─ jlk, jkm -> lm
│ ├─ ijl, ik -> jlk
│ │ ├─ ijl
│ │ └─ ik
│ └─ jkm
└─ lm
# remove the dummy tensor manually
julia> opt_ein_open = OMEinsumContractionOrders.tree_reformulate(opt_ein_closed, 4)
jlk, jkm -> lm
├─ ijl, ik -> jlk
│ ├─ ijl
│ └─ ik
└─ jkm
julia> OMEinsum.contraction_complexity(opt_ein_closed, uniformsize(ein_closed, 2))
Time complexity: 2^5.169925001442312
Space complexity: 2^3.0
Read-write complexity: 2^5.614709844115208
julia> OMEinsum.contraction_complexity(opt_ein_open, uniformsize(ein_closed, 2))
Time complexity: 2^5.0
Space complexity: 2^3.0
Read-write complexity: 2^5.321928094887363
# the process above has been implemented in optimize_kahypar, one can directly optimize a contraction with open edges
julia> opt_ein_open_direct = optimize_kahypar(ein_open, uniformsize(ein_closed, 2); max_group_size=10, sc_target=10)
jlk, jkm -> lm
├─ ijl, ik -> jlk
│ ├─ ijl
│ └─ ik
└─ jkm
julia> opt_ein_open == opt_ein_open_direct
true |
|
name of the function has been changed as |
Ready for review? |
Sure! The new package |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #43 +/- ##
==========================================
+ Coverage 93.16% 94.47% +1.30%
==========================================
Files 13 14 +1
Lines 1097 1230 +133
==========================================
+ Hits 1022 1162 +140
+ Misses 75 68 -7 ☔ View full report in Codecov by Sentry. |
Good job! |
Thanks a lot! It is much better now. |
Added a solver named
ExactTreewidth
, which is based on the exact tree width solve provided inTreeWidthSolver.jl
.