-
Notifications
You must be signed in to change notification settings - Fork 1
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
speedup greedy method #47
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
|
One test on mock problem didn't pass. |
Benchmarks Before Using Priority Queue@btime result = OptimalBranchingMIS.OptimalBranchingCore.greedymerge(candidates, MISProblem(graph), vs, m)
3.804 ms (172 allocations: 183.97 KiB)
OptimalBranchingResult{LongLongUInt{1}, Int64}:
optimal_rule: DNF{LongLongUInt{1}}: (#1 ∧ ¬#2 ∧ ¬#3 ∧ ¬#4 ∧ #6 ∧ #8 ∧ #10 ∧ ¬#13 ∧ ¬#14 ∧ ¬#17 ∧ ¬#18 ∧ ¬#21 ∧ ¬#22) ∨ (#1 ∧ ¬#2 ∧ ¬#3 ∧ ¬#4 ∧ #5 ∧ ¬#6 ∧ #8 ∧ #10 ∧ ¬#11 ∧ ¬#12 ∧ #13 ∧ #14 ∧ ¬#17 ∧ ¬#18 ∧ ¬#21 ∧ ¬#22) ∨ (¬#1 ∧ #2 ∧ #3 ∧ ¬#5 ∧ ¬#6 ∧ ¬#7 ∧ ¬#8) ∨ (#1 ∧ ¬#2 ∧ ¬#3 ∧ ¬#4 ∧ #6 ∧ #7 ∧ ¬#8 ∧ #10 ∧ ¬#13 ∧ ¬#14 ∧ ¬#15 ∧ ¬#16 ∧ #17 ∧ #18 ∧ ¬#21 ∧ ¬#22) ∨ (#1 ∧ ¬#2 ∧ ¬#3 ∧ ¬#4 ∧ #5 ∧ ¬#6 ∧ #7 ∧ ¬#8 ∧ #10 ∧ ¬#11 ∧ ¬#12 ∧ #13 ∧ #14 ∧ ¬#15 ∧ ¬#16 ∧ #17 ∧ #18 ∧ ¬#21 ∧ ¬#22) ∨ (¬#1 ∧ #2 ∧ ¬#3 ∧ #4 ∧ ¬#5 ∧ ¬#6 ∧ #8 ∧ ¬#9 ∧ ¬#10 ∧ ¬#17 ∧ ¬#18) ∨ (¬#1 ∧ ¬#2 ∧ #3 ∧ #4 ∧ #6 ∧ ¬#7 ∧ ¬#8 ∧ ¬#9 ∧ ¬#10 ∧ ¬#13 ∧ ¬#14) ∨ (#1 ∧ ¬#2 ∧ ¬#3 ∧ ¬#4 ∧ #6 ∧ #8 ∧ #9 ∧ ¬#10 ∧ ¬#13 ∧ ¬#14 ∧ ¬#17 ∧ ¬#18 ∧ ¬#19 ∧ ¬#20 ∧ #21 ∧ #22) ∨ (#1 ∧ ¬#2 ∧ ¬#3 ∧ ¬#4 ∧ #5 ∧ ¬#6 ∧ #8 ∧ #9 ∧ ¬#10 ∧ ¬#11 ∧ ¬#12 ∧ #13 ∧ #14 ∧ ¬#17 ∧ ¬#18 ∧ ¬#19 ∧ ¬#20 ∧ #21 ∧ #22) ∨ (#1 ∧ ¬#2 ∧ ¬#3 ∧ ¬#4 ∧ #6 ∧ #7 ∧ ¬#8 ∧ #9 ∧ ¬#10 ∧ ¬#13 ∧ ¬#14 ∧ ¬#15 ∧ ¬#16 ∧ #17 ∧ #18 ∧ ¬#19 ∧ ¬#20 ∧ #21 ∧ #22) ∨ (#1 ∧ ¬#2 ∧ ¬#3 ∧ ¬#4 ∧ #5 ∧ ¬#6 ∧ #7 ∧ ¬#8 ∧ #9 ∧ ¬#10 ∧ ¬#11 ∧ ¬#12 ∧ #13 ∧ #14 ∧ ¬#15 ∧ ¬#16 ∧ #17 ∧ #18 ∧ ¬#19 ∧ ¬#20 ∧ #21 ∧ #22)
branching_vector: [28, 34, 16, 34, 40, 24, 24, 34, 40, 40, 46]
γ: 1.0842073740067577 Benchmarks Now@btime result = OptimalBranchingMIS.OptimalBranchingCore.greedymerge(candidates, MISProblem(graph), vs, m)
6.005 ms (193 allocations: 27.47 KiB)
OptimalBranchingResult{LongLongUInt{1}, Float64}:
optimal_rule: DNF{LongLongUInt{1}}: (#1 ∧ ¬#2 ∧ ¬#3 ∧ ¬#4 ∧ #6 ∧ #8 ∧ #10 ∧ ¬#13 ∧ ¬#14 ∧ ¬#17 ∧ ¬#18 ∧ ¬#21 ∧ ¬#22) ∨ (#1 ∧ ¬#2 ∧ ¬#3 ∧ ¬#4 ∧ #5 ∧ ¬#6 ∧ #8 ∧ #10 ∧ ¬#11 ∧ ¬#12 ∧ #13 ∧ #14 ∧ ¬#17 ∧ ¬#18 ∧ ¬#21 ∧ ¬#22) ∨ (¬#1 ∧ #2 ∧ #3 ∧ ¬#5 ∧ ¬#6 ∧ ¬#7 ∧ ¬#8 ∧ #15 ∧ ¬#16 ∧ #17 ∧ ¬#18 ∧ ¬#19 ∧ ¬#21) ∨ (¬#1 ∧ #2 ∧ #3 ∧ ¬#5 ∧ ¬#6 ∧ ¬#7 ∧ ¬#8 ∧ #11 ∧ ¬#12 ∧ #13 ∧ ¬#14 ∧ #16 ∧ ¬#17 ∧ ¬#22) ∨ (¬#1 ∧ #2 ∧ #3 ∧ ¬#5 ∧ ¬#6 ∧ ¬#7 ∧ ¬#8 ∧ ¬#11 ∧ #12 ∧ ¬#13 ∧ #14 ∧ ¬#15 ∧ #18 ∧ ¬#21) ∨ (#1 ∧ ¬#2 ∧ ¬#3 ∧ ¬#4 ∧ #6 ∧ #7 ∧ ¬#8 ∧ #9 ∧ ¬#13 ∧ ¬#14 ∧ ¬#15 ∧ ¬#16 ∧ #17 ∧ #18 ∧ ¬#19 ∧ ¬#20) ∨ (#1 ∧ ¬#2 ∧ ¬#3 ∧ ¬#4 ∧ #5 ∧ ¬#6 ∧ #7 ∧ ¬#8 ∧ #9 ∧ ¬#11 ∧ ¬#12 ∧ #13 ∧ #14 ∧ ¬#15 ∧ ¬#16 ∧ #17 ∧ #18 ∧ ¬#19 ∧ ¬#20) ∨ (¬#1 ∧ #3 ∧ #4 ∧ ¬#7 ∧ ¬#8 ∧ ¬#9 ∧ ¬#10 ∧ #15 ∧ ¬#16 ∧ #17 ∧ ¬#18) ∨ (#1 ∧ ¬#2 ∧ ¬#3 ∧ ¬#4 ∧ #5 ∧ #7 ∧ ¬#8 ∧ ¬#9 ∧ #10 ∧ ¬#11 ∧ ¬#12 ∧ ¬#15 ∧ ¬#16 ∧ #17 ∧ #18 ∧ #19 ∧ #20 ∧ ¬#21 ∧ ¬#22) ∨ (#1 ∧ ¬#2 ∧ ¬#3 ∧ ¬#4 ∧ ¬#5 ∧ #6 ∧ #7 ∧ ¬#8 ∧ ¬#9 ∧ #10 ∧ #11 ∧ #12 ∧ ¬#13 ∧ ¬#14 ∧ ¬#15 ∧ ¬#16 ∧ #17 ∧ #18 ∧ #19 ∧ #20 ∧ ¬#21 ∧ ¬#22) ∨ (¬#1 ∧ #2 ∧ ¬#3 ∧ #4 ∧ ¬#5 ∧ ¬#6 ∧ #7 ∧ ¬#9 ∧ ¬#10 ∧ ¬#15 ∧ ¬#16 ∧ #19 ∧ ¬#20 ∧ #21 ∧ ¬#22) ∨ (¬#1 ∧ #2 ∧ #3 ∧ #4 ∧ ¬#5 ∧ ¬#6 ∧ ¬#7 ∧ ¬#8 ∧ ¬#9 ∧ ¬#10 ∧ ¬#11 ∧ #14 ∧ #19 ∧ ¬#20 ∧ #21 ∧ ¬#22) ∨ (¬#1 ∧ ¬#2 ∧ #3 ∧ #4 ∧ #6 ∧ ¬#7 ∧ ¬#8 ∧ ¬#9 ∧ ¬#10 ∧ ¬#13 ∧ ¬#14 ∧ ¬#15 ∧ #16 ∧ ¬#17 ∧ #18 ∧ #19 ∧ ¬#20 ∧ #21 ∧ ¬#22) ∨ (¬#1 ∧ #2 ∧ #4 ∧ ¬#5 ∧ ¬#6 ∧ ¬#9 ∧ ¬#10 ∧ ¬#17 ∧ ¬#19 ∧ #22) ∨ (¬#1 ∧ ¬#2 ∧ #3 ∧ #4 ∧ #5 ∧ ¬#7 ∧ ¬#8 ∧ ¬#9 ∧ ¬#10 ∧ ¬#11 ∧ ¬#12 ∧ ¬#15 ∧ #16 ∧ ¬#17 ∧ #18 ∧ ¬#19 ∧ #20 ∧ ¬#21 ∧ #22) ∨ (¬#1 ∧ #2 ∧ ¬#3 ∧ #4 ∧ ¬#5 ∧ ¬#6 ∧ #7 ∧ ¬#8 ∧ ¬#9 ∧ ¬#10 ∧ #11 ∧ ¬#12 ∧ #13 ∧ ¬#14 ∧ ¬#15 ∧ ¬#16 ∧ #17 ∧ #18 ∧ ¬#19 ∧ #20 ∧ ¬#21 ∧ #22) ∨ (#1 ∧ ¬#2 ∧ ¬#3 ∧ ¬#4 ∧ #6 ∧ #8 ∧ #9 ∧ ¬#10 ∧ ¬#13 ∧ ¬#14 ∧ ¬#17 ∧ ¬#18 ∧ ¬#19 ∧ ¬#20 ∧ #21 ∧ #22) ∨ (#1 ∧ ¬#2 ∧ ¬#3 ∧ ¬#4 ∧ #5 ∧ ¬#6 ∧ #8 ∧ #9 ∧ ¬#10 ∧ ¬#11 ∧ ¬#12 ∧ #13 ∧ #14 ∧ ¬#17 ∧ ¬#18 ∧ ¬#19 ∧ ¬#20 ∧ #21 ∧ #22)
branching_vector: [28.0, 34.0, 32.0, 32.0, 32.0, 34.0, 40.0, 24.0, 40.0, 46.0, 32.0, 34.0, 40.0, 24.0, 40.0, 46.0, 34.0, 40.0]
γ: 1.090233540640428 |
I also noticed that. It is so wield, since the algorithm should be the same. Is it possible that this is due to randomness? Since I noticed that when picking the largest value, there may be multiple candidates. |
Maybe test in branch count is more reasonable. Also, the benchmark. Instances with 71 bit string is too small. The advantage is more clear if you use the test instance. |
Same test case with #45using Test
using OptimalBranchingMIS
using OptimalBranchingCore
using OptimalBranchingMIS.Graphs
g = random_regular_graph(200, 3; seed = 2134)
bs = BranchingStrategy(table_solver = TensorNetworkSolver(), selector = KaHyParSelector(15), measure = D3Measure(), set_cover_solver = OptimalBranchingCore.GreedyMerge())
miskg, countkg = mis_branch_count(g; branching_strategy = bs) (miskg, countkg) = (88, 13007) |
I will get it merged, you can revert it later. |
* greedymerge * size_reduction * size_reduction * spaces * sapces * add test on coverd_by * fix test * fix test * update * update-greedy-implementation * merge and fix bugs * fix doc * save * kahypar selector * add more test * rm simulated annealing * speedup greedy method (#47) * save * update * update * update * fix test * use priority queue * update * add inbounds * update * ugly fix * fix tests * update * new visualization * update * change name --------- Co-authored-by: nzy <[email protected]> --------- Co-authored-by: GiggleLiu <[email protected]> Co-authored-by: nzy <[email protected]>
Before
After