-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBBA_runtime.py
More file actions
63 lines (52 loc) · 1.8 KB
/
Copy pathBBA_runtime.py
File metadata and controls
63 lines (52 loc) · 1.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import pandas as pd
import numpy as np
import codepub as cdp
import tqdm
import time
## BBA running time
### parameters
n_down = 20
n_up = 25
length_down = 50
length_up = 3000
step = 100
### fixed iters
iters = 4
n_down = 20
n_up = 25
results_time_fixI4 = pd.DataFrame(columns = ['m', 'n', 'Time (s)'])
for n in range(n_down, n_up):
results_time = dict()
for i in tqdm.tqdm(range(length_down, length_up, step)):
start_time = time.time()
b, lines = cdp.bba(m=n, r=iters, n=i)
end_time = time.time()
elapsed_time = end_time - start_time
results_time[i] = elapsed_time
results_time = pd.DataFrame.from_dict(results_time, orient = 'index')
results_time = results_time.reset_index()
results_time.columns = ['n', 'Time (s)']
results_time['m'] = n
results_time_fixI4 = pd.concat([results_time_fixI4, results_time])
results_time_fixI4.to_csv('bba_running_time_fixR4.tsv',
sep = "\t", index = None)
### fixed n_pools
iters_down = 4
iters_up = 7
n_pools = 20
results_time_fixN20 = pd.DataFrame(columns = ['r', 'n', 'Time (s)'])
for iters in range(iters_down, iters_up):
results_time = dict()
for i in tqdm.tqdm(range(length_down, length_up, step)):
start_time = time.time()
b, lines = cdp.bba(m=n_pools, r=iters, n=i)
end_time = time.time()
elapsed_time = end_time - start_time
results_time[i] = elapsed_time
results_time = pd.DataFrame.from_dict(results_time, orient = 'index')
results_time = results_time.reset_index()
results_time.columns = ['n', 'Time (s)']
results_time['r'] = iters
results_time_fixN20 = pd.concat([results_time_fixN20, results_time])
results_time_fixN20.to_csv('bba_running_time_fixM20.tsv',
sep = "\t", index = None)