@@ -100,20 +100,20 @@ function labels(code::EinTypes)
100100end
101101
102102"""
103- optimize_code(code; optmethod=:kahypar, sc_target=17, max_group_size=40, nrepeat=10, imbalances=0.0:0.001:0.8, βs=0.01:0.05:10.0, ntrials=50, niters=1000)
103+ optimize_code(code; optmethod=:kahypar, sc_target=17, max_group_size=40, nrepeat=10, imbalances=0.0:0.001:0.8, βs=0.01:0.05:10.0, ntrials=50, niters=1000, sc_weight=2.0, rw_weight=1.0 )
104104
105105Optimize the contraction order.
106106
107107* `optmethod` can be one of
108- * `:kahypar`, the kahypar + greedy approach, takes kwargs [`sc_target`, `max_group_size`, `imbalances`].
108+ * `:kahypar`, the kahypar + greedy approach, takes kwargs [`sc_target`, `max_group_size`, `imbalances`, `nrepeat` ].
109109 Check `optimize_kahypar` method in package `OMEinsumContractionOrders`.
110110 * `:auto`, also the kahypar + greedy approach, but determines `sc_target` automatically. It is slower!
111111 * `:greedy`, the greedy approach. Check `optimize_greedy` in package `OMEinsum`.
112- * `:tree`, the approach of running simulated annealing on expression tree. Check `optimize_tree` in package `OMEinsumContractionOrders`.
113- * `:sa`, the simulated annealing approach. Check `optimize_sa` in package `OMEinsumContractionOrders`.
112+ * `:tree`, the approach of running simulated annealing on expression tree, takes kwargs [`sc_target`, `sc_weight`, `rw_weight`, `βs`, `ntrials`, `niters`] . Check `optimize_tree` in package `OMEinsumContractionOrders`.
113+ * `:sa`, the simulated annealing approach, takes kwargs [`rw_weight`, `βs`, `ntrials`, `niters`] . Check `optimize_sa` in package `OMEinsumContractionOrders`.
114114 * `:raw`, do nothing and return the raw EinCode.
115115"""
116- function optimize_code (code:: EinTypes ; optmethod= :auto , sc_target= 17 , max_group_size= 40 , nrepeat= 10 , imbalances= 0.0 : 0.001 : 0.8 , initializer= :random , βs= 0.01 : 0.05 : 10.0 , ntrials= 50 , niters= 1000 , sc_weight= 5 .0 )
116+ function optimize_code (code:: EinTypes ; optmethod= :auto , sc_target= 17 , max_group_size= 40 , nrepeat= 10 , imbalances= 0.0 : 0.001 : 0.8 , initializer= :random , βs= 0.01 : 0.05 : 10.0 , ntrials= 50 , niters= 1000 , sc_weight= 2.0 , rw_weight = 1 .0 )
117117 size_dict = Dict ([s=> 2 for s in labels (code)])
118118 optcode = if optmethod == :kahypar
119119 optimize_kahypar (code, size_dict; sc_target= sc_target, max_group_size= max_group_size, imbalances= imbalances, greedy_nrepeat= nrepeat)
@@ -122,7 +122,7 @@ function optimize_code(code::EinTypes; optmethod=:auto, sc_target=17, max_group_
122122 elseif optmethod == :greedy
123123 optimize_greedy (code, size_dict; nrepeat= nrepeat)
124124 elseif optmethod == :tree
125- optimize_tree (code, size_dict; sc_target= sc_target, βs= βs, niters= niters, ntrials= ntrials, sc_weight= sc_weight, initializer= initializer)
125+ optimize_tree (code, size_dict; sc_target= sc_target, βs= βs, niters= niters, ntrials= ntrials, sc_weight= sc_weight, initializer= initializer, rw_weight = rw_weight )
126126 elseif optmethod == :auto
127127 optimize_kahypar_auto (code, size_dict; max_group_size= max_group_size, effort= 500 , greedy_nrepeat= nrepeat)
128128 elseif optmethod == :raw
0 commit comments