-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrunner_gc
More file actions
53 lines (40 loc) · 1.31 KB
/
runner_gc
File metadata and controls
53 lines (40 loc) · 1.31 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
#!/usr/bin/env python3
import sys
sys.path.insert(0, '../secure-edit-distance')
from math import ceil, log2
from Compiler.library import print_ln
from Compiler.GC.types import sbitint
from load_sequences import *
from preprocess import equality_gc
from ukkonen_gc import *
from t_optimize import *
program.use_edabit(True)
# m, n = int(sys.argv[-2]), int(sys.argv[-1])
m, n = 2041, 2041
bitlen = ceil(log2(max(m, n)))
program.set_bit_length(bitlen)
cc0, cc1, cc2 = 0, 0, 0
minct0, minct1 = 0, 0
gc_i = sbitint.get_type(bitlen)
res = gc_i(0)
a, b = load_sequences_gc(m, n, 1)
m, n = len(a), len(b)
print("MN", m, n)
# Naive approach for phase 1
# t = ceil(max(m, n)/10) // 2 * 2 + 1
# New approach for phase 1
tt = 103 # Loose upper threshold
E, cc0 = equality_gc(a, b, tt)
modval = 48 # segment length
bitlengths = [bitlen, ceil(log2(tt))]
res_approx, cc1, minct0, mvees = find_opt_diag_gc(E, tt, modval, bitlengths)
print_ln('Approx RES: %s', res_approx.reveal())
t = 61
print("TT, T", tt, t)
# Ukkonen:
# res, cc2, minct1 = ukkonenRegular_gc_compiled(E, t, m, n, tt, [bitlen+1])
res, cc2, minct1 = ukkonenDiagonal_gc(E, t, m, n, tt, [bitlen+1])
# res, cc2, minct1 = ukkonenDiagonal_gc_with_ab(a, b, t, m, n, [bitlen+1])
print("Comparisions:", cc0+cc1+cc2)
print("Minimums:", minct0+minct1)
print_ln('RES: %s', res.reveal())