mesh-rb 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/ext/mesh/extconf.rb +22 -4
- data/ext/mesh/mesh.tar.gz +0 -0
- data/lib/mesh/version.rb +1 -1
- data/mesh.gemspec +3 -2
- metadata +4 -120
- data/ext/mesh/mesh/.bazelrc +0 -20
- data/ext/mesh/mesh/.bazelversion +0 -1
- data/ext/mesh/mesh/.clang-format +0 -15
- data/ext/mesh/mesh/.dockerignore +0 -5
- data/ext/mesh/mesh/.editorconfig +0 -16
- data/ext/mesh/mesh/.gitattributes +0 -4
- data/ext/mesh/mesh/.github/workflows/main.yml +0 -144
- data/ext/mesh/mesh/.gitignore +0 -51
- data/ext/mesh/mesh/AUTHORS +0 -5
- data/ext/mesh/mesh/CMakeLists.txt +0 -270
- data/ext/mesh/mesh/CODE_OF_CONDUCT.md +0 -77
- data/ext/mesh/mesh/Dockerfile +0 -30
- data/ext/mesh/mesh/LICENSE +0 -201
- data/ext/mesh/mesh/Makefile +0 -81
- data/ext/mesh/mesh/README.md +0 -97
- data/ext/mesh/mesh/WORKSPACE +0 -50
- data/ext/mesh/mesh/bazel +0 -350
- data/ext/mesh/mesh/mesh-pldi19-powers.pdf +0 -0
- data/ext/mesh/mesh/src/BUILD +0 -222
- data/ext/mesh/mesh/src/CMakeLists.txt +0 -85
- data/ext/mesh/mesh/src/bitmap.h +0 -590
- data/ext/mesh/mesh/src/cheap_heap.h +0 -170
- data/ext/mesh/mesh/src/common.h +0 -377
- data/ext/mesh/mesh/src/copts.bzl +0 -31
- data/ext/mesh/mesh/src/d_assert.cc +0 -75
- data/ext/mesh/mesh/src/fixed_array.h +0 -124
- data/ext/mesh/mesh/src/global_heap.cc +0 -547
- data/ext/mesh/mesh/src/global_heap.h +0 -569
- data/ext/mesh/mesh/src/gnu_wrapper.cc +0 -75
- data/ext/mesh/mesh/src/internal.h +0 -356
- data/ext/mesh/mesh/src/libmesh.cc +0 -239
- data/ext/mesh/mesh/src/mac_wrapper.cc +0 -528
- data/ext/mesh/mesh/src/measure_rss.cc +0 -44
- data/ext/mesh/mesh/src/measure_rss.h +0 -20
- data/ext/mesh/mesh/src/meshable_arena.cc +0 -776
- data/ext/mesh/mesh/src/meshable_arena.h +0 -309
- data/ext/mesh/mesh/src/meshing.h +0 -60
- data/ext/mesh/mesh/src/mini_heap.h +0 -532
- data/ext/mesh/mesh/src/mmap_heap.h +0 -104
- data/ext/mesh/mesh/src/one_way_mmap_heap.h +0 -77
- data/ext/mesh/mesh/src/partitioned_heap.h +0 -111
- data/ext/mesh/mesh/src/plasma/mesh.h +0 -33
- data/ext/mesh/mesh/src/real.cc +0 -52
- data/ext/mesh/mesh/src/real.h +0 -36
- data/ext/mesh/mesh/src/rng/mwc.h +0 -296
- data/ext/mesh/mesh/src/rng/mwc64.h +0 -58
- data/ext/mesh/mesh/src/rpl_printf.c +0 -1991
- data/ext/mesh/mesh/src/runtime.cc +0 -393
- data/ext/mesh/mesh/src/runtime.h +0 -114
- data/ext/mesh/mesh/src/shuffle_vector.h +0 -287
- data/ext/mesh/mesh/src/size_classes.def +0 -251
- data/ext/mesh/mesh/src/static/if.h +0 -36
- data/ext/mesh/mesh/src/static/log.h +0 -43
- data/ext/mesh/mesh/src/testing/benchmark/local_refill.cc +0 -103
- data/ext/mesh/mesh/src/testing/big-alloc.c +0 -28
- data/ext/mesh/mesh/src/testing/fragmenter.cc +0 -128
- data/ext/mesh/mesh/src/testing/global-large-stress.cc +0 -25
- data/ext/mesh/mesh/src/testing/local-alloc.c +0 -16
- data/ext/mesh/mesh/src/testing/meshing_benchmark.cc +0 -189
- data/ext/mesh/mesh/src/testing/thread.cc +0 -35
- data/ext/mesh/mesh/src/testing/unit/alignment.cc +0 -56
- data/ext/mesh/mesh/src/testing/unit/bitmap_test.cc +0 -274
- data/ext/mesh/mesh/src/testing/unit/concurrent_mesh_test.cc +0 -185
- data/ext/mesh/mesh/src/testing/unit/mesh_test.cc +0 -143
- data/ext/mesh/mesh/src/testing/unit/rng_test.cc +0 -22
- data/ext/mesh/mesh/src/testing/unit/size_class_test.cc +0 -66
- data/ext/mesh/mesh/src/testing/unit/triple_mesh_test.cc +0 -285
- data/ext/mesh/mesh/src/testing/userfaultfd-kernel-copy.cc +0 -164
- data/ext/mesh/mesh/src/thread_local_heap.cc +0 -163
- data/ext/mesh/mesh/src/thread_local_heap.h +0 -268
- data/ext/mesh/mesh/src/wrapper.cc +0 -433
- data/ext/mesh/mesh/support/export_mesh.cmake +0 -28
- data/ext/mesh/mesh/support/gen-size-classes +0 -57
- data/ext/mesh/mesh/support/install_all_configs +0 -33
- data/ext/mesh/mesh/support/remove_export_mesh.cmake +0 -48
- data/ext/mesh/mesh/support/update-bazelisk +0 -8
- data/ext/mesh/mesh/theory/32m80.png +0 -0
- data/ext/mesh/mesh/theory/64m80ind.png +0 -0
- data/ext/mesh/mesh/theory/bound_comparison.py +0 -67
- data/ext/mesh/mesh/theory/bounds/impdeg+1 +0 -135
- data/ext/mesh/mesh/theory/choose.py +0 -43
- data/ext/mesh/mesh/theory/common.py +0 -42
- data/ext/mesh/mesh/theory/compute_exp_Y.py +0 -134
- data/ext/mesh/mesh/theory/createRandomString.py +0 -69
- data/ext/mesh/mesh/theory/deg_bound_check.py +0 -100
- data/ext/mesh/mesh/theory/degcheck.py +0 -47
- data/ext/mesh/mesh/theory/dumps/32,1,80,dumb.txt +0 -81
- data/ext/mesh/mesh/theory/dumps/32,2,80,dumb.txt +0 -81
- data/ext/mesh/mesh/theory/dumps/32,3,80,dumb.txt +0 -81
- data/ext/mesh/mesh/theory/dumps/32,4,80,dumb.txt +0 -81
- data/ext/mesh/mesh/theory/dumps/32,5,80,dumb.txt +0 -81
- data/ext/mesh/mesh/theory/dumps/32,6,80,dumb.txt +0 -81
- data/ext/mesh/mesh/theory/dumps/32,7,80,dumb.txt +0 -81
- data/ext/mesh/mesh/theory/dumps/32,8,80,dumb.txt +0 -81
- data/ext/mesh/mesh/theory/dumps/32,9,80,dumb.txt +0 -81
- data/ext/mesh/mesh/theory/experiment.py +0 -303
- data/ext/mesh/mesh/theory/experiment_raw_results/.gitignore +0 -0
- data/ext/mesh/mesh/theory/greedy_experiment.py +0 -66
- data/ext/mesh/mesh/theory/greedy_experiment_copy.py +0 -46
- data/ext/mesh/mesh/theory/greedy_experiment_q.py +0 -75
- data/ext/mesh/mesh/theory/makeGraph.py +0 -64
- data/ext/mesh/mesh/theory/manyreps.png +0 -0
- data/ext/mesh/mesh/theory/manystrings.png +0 -0
- data/ext/mesh/mesh/theory/match_vs_color_experiment.py +0 -94
- data/ext/mesh/mesh/theory/maxmatch_vs_E[Y].py +0 -162
- data/ext/mesh/mesh/theory/maxmatch_vs_greedymatch.py +0 -96
- data/ext/mesh/mesh/theory/maxvdeg+1imp++32,80.png +0 -0
- data/ext/mesh/mesh/theory/mesh_util.py +0 -322
- data/ext/mesh/mesh/theory/meshers.py +0 -452
- data/ext/mesh/mesh/theory/meshingBenchmark.py +0 -96
- data/ext/mesh/mesh/theory/occupancyComparison.py +0 -133
- data/ext/mesh/mesh/theory/randmatch_vs_greedymatch.py +0 -97
- data/ext/mesh/mesh/theory/randmatch_vs_greedymatch_q.py +0 -103
- data/ext/mesh/mesh/theory/randmatch_vs_greedymatch_time.py +0 -117
- data/ext/mesh/mesh/theory/read_mesh_dump.py +0 -82
- data/ext/mesh/mesh/theory/test.py +0 -70
- data/ext/mesh/mesh/tools/bazel +0 -1
@@ -1,134 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
"""
|
3
|
-
Created on Wed Apr 27 22:18:12 2016
|
4
|
-
|
5
|
-
@author: devd
|
6
|
-
"""
|
7
|
-
from __future__ import division
|
8
|
-
from choose import compute_q, nCr, compute_p3
|
9
|
-
import cPickle as pickle
|
10
|
-
|
11
|
-
def prob(a,b,c, numStrings, numOnes, p1, p2, p3):
|
12
|
-
p4 = 1-p1-p2-p3
|
13
|
-
d = numStrings-2-a-b-c
|
14
|
-
return (nCr(numStrings-2,a)*(p1**a)*nCr(numStrings-2-a, b)*(p2**b)*nCr(numStrings-2-a-b, c)*(p3**c)*(p4**d))
|
15
|
-
|
16
|
-
def lookup(bound_id, length, numOnes, numStrings):
|
17
|
-
path = "bounds/{}".format(bound_id)
|
18
|
-
with open(path, "rb") as file:
|
19
|
-
bound_dict = pickle.load(file)
|
20
|
-
try:
|
21
|
-
bound = bound_dict[(length, numOnes, numStrings)]
|
22
|
-
except KeyError:
|
23
|
-
return None, bound_dict
|
24
|
-
return bound, None
|
25
|
-
|
26
|
-
def store(bound_id, bound_dict):
|
27
|
-
path = "bounds/{}".format(bound_id)
|
28
|
-
with open(path, "wb") as file:
|
29
|
-
pickle.dump(bound_dict, file)
|
30
|
-
|
31
|
-
|
32
|
-
def compute_exp_Y(length, numOnes, numStrings):
|
33
|
-
q = compute_q(length, numOnes)
|
34
|
-
p3 = compute_p3(length, numOnes)
|
35
|
-
p1 = q-p3
|
36
|
-
p2 = p1
|
37
|
-
|
38
|
-
p4 = 1-p1-p2-p3
|
39
|
-
|
40
|
-
sum = 0
|
41
|
-
for a in range(numStrings-2+1):
|
42
|
-
for b in range(numStrings-2-a+1):
|
43
|
-
for c in range(numStrings-2-a-b+1):
|
44
|
-
add = min(1/(a+c+1), 1/(b+c+1))*prob(a,b,c,numStrings, numOnes,p1,p2,p3)
|
45
|
-
# add = min(1/(a+c), 1/(b+c))*prob(a,b,c,numStrings, numOnes,p1,p2,p3)
|
46
|
-
sum += add
|
47
|
-
# sum += min(1/(a+c+1), 1/(b+c+1))*prob(a,b,c,numStrings,p1,p2,p3)
|
48
|
-
sum *= q
|
49
|
-
return sum*nCr(numStrings,2)
|
50
|
-
|
51
|
-
def compute_degree_bound(length, numOnes, numStrings):
|
52
|
-
print length
|
53
|
-
print numOnes
|
54
|
-
q = compute_q(length, numOnes)
|
55
|
-
exp_degree = (numStrings-1)*q
|
56
|
-
a = exp_degree
|
57
|
-
b = exp_degree
|
58
|
-
return numStrings/2*(a/(b+1))
|
59
|
-
|
60
|
-
def compute_isolated_edge_bound(length, numOnes, numStrings):
|
61
|
-
q = compute_q(length, numOnes)
|
62
|
-
p3 = compute_p3(length, numOnes)
|
63
|
-
m = numStrings
|
64
|
-
bound1 = (m-1)*q*(1-(2*q)+p3)**(m-2)
|
65
|
-
bound2 = 2- 2*(1-q)**(m-1) - (m-1)*q
|
66
|
-
return (m/2)*max(bound1,bound2)
|
67
|
-
# return (m/2)*bound2
|
68
|
-
|
69
|
-
def compute_degreeplusone_bound(length, numOnes, numStrings):
|
70
|
-
q = compute_q(length, numOnes)
|
71
|
-
p3 = compute_p3(length, numOnes)
|
72
|
-
p1 = q-p3
|
73
|
-
p2 = p1
|
74
|
-
|
75
|
-
p4 = 1-p1-p2-p3
|
76
|
-
|
77
|
-
sum = 0
|
78
|
-
for a in range(numStrings-2+1):
|
79
|
-
for b in range(numStrings-2-a+1):
|
80
|
-
for c in range(numStrings-2-a-b+1):
|
81
|
-
add = min(1/(a+c+2), 1/(b+c+2))*prob(a,b,c,numStrings, numOnes,p1,p2,p3)
|
82
|
-
# add = .5*(1/(a+c+2) + 1/(b+c+2))*prob(a,b,c,numStrings, numOnes,p1,p2,p3)
|
83
|
-
sum += add
|
84
|
-
sum *= q
|
85
|
-
return sum*nCr(numStrings,2)
|
86
|
-
|
87
|
-
def compute_improved_degreeplusone_bound(length, numOnes, numStrings):
|
88
|
-
bound, bound_dict = lookup("impdeg+1", length, numOnes, numStrings)
|
89
|
-
if bound:
|
90
|
-
print 'value already exists, retrieving from database'
|
91
|
-
return bound
|
92
|
-
q = compute_q(length, numOnes)
|
93
|
-
p3 = compute_p3(length, numOnes)
|
94
|
-
p1 = q-p3
|
95
|
-
p2 = p1
|
96
|
-
|
97
|
-
p4 = 1-p1-p2-p3
|
98
|
-
|
99
|
-
sum = 0
|
100
|
-
for a in range(numStrings-2+1):
|
101
|
-
for b in range(numStrings-2-a+1):
|
102
|
-
for c in range(numStrings-2-a-b+1):
|
103
|
-
if a+c+1==1 and b+c+1==1:
|
104
|
-
add = 1*prob(a,b,c,numStrings, numOnes,p1,p2,p3)
|
105
|
-
elif a+c+1==1:
|
106
|
-
add = (1/(b+c+1))*prob(a,b,c,numStrings, numOnes,p1,p2,p3)
|
107
|
-
elif b+c+1==1:
|
108
|
-
add = (1/(a+c+1))*prob(a,b,c,numStrings, numOnes,p1,p2,p3)
|
109
|
-
# elif a+c+1==2 and b+c+1==2:
|
110
|
-
## add = .5*prob(a,b,c,numStrings, numOnes,p1,p2,p3)
|
111
|
-
elif (a+c+1==2 and b+c+1==3) or (a+c+1==3 and b+c+1==2):
|
112
|
-
add = prob(a,b,c,numStrings, numOnes,p1,p2,p3)/3.0
|
113
|
-
# elif a+c+1 != b+c+1:
|
114
|
-
# add = min(1/(a+c+1), 1/(b+c+1))*prob(a,b,c,numStrings, numOnes,p1,p2,p3)
|
115
|
-
else:
|
116
|
-
add = min(1/(a+c+2), 1/(b+c+2))*prob(a,b,c,numStrings, numOnes,p1,p2,p3)
|
117
|
-
# add = .5*(1/(a+c+2) + 1/(b+c+2))*prob(a,b,c,numStrings, numOnes,p1,p2,p3)
|
118
|
-
sum += add
|
119
|
-
sum *= q
|
120
|
-
result = sum*nCr(numStrings,2)
|
121
|
-
bound_dict[(length, numOnes, numStrings)] = result
|
122
|
-
store("impdeg+1", bound_dict)
|
123
|
-
print 'value did not already exist, writing to database'
|
124
|
-
return result
|
125
|
-
|
126
|
-
def boundRetrieve(identifier):
|
127
|
-
fetcher = { "impdeg+1": (compute_improved_degreeplusone_bound)
|
128
|
-
}
|
129
|
-
return fetcher[identifier]
|
130
|
-
|
131
|
-
if __name__ == '__main__':
|
132
|
-
#print prob(18,2,12,80,0.03125,0.03125,0.9375)/31
|
133
|
-
# print compute_exp_Y(32, 13, 80)
|
134
|
-
print compute_improved_degreeplusone_bound(16, 4, 100)
|
@@ -1,69 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
"""
|
3
|
-
Created on Sat Feb 27 21:20:37 2016
|
4
|
-
|
5
|
-
@author: David Tench
|
6
|
-
"""
|
7
|
-
import random
|
8
|
-
import math
|
9
|
-
|
10
|
-
def createRandomString(length, numOnes):
|
11
|
-
"""Returns a random binary string with specified number of randomly located
|
12
|
-
ones."""
|
13
|
-
counter = numOnes
|
14
|
-
string = ''
|
15
|
-
for i in range(length):
|
16
|
-
string += '0'
|
17
|
-
while counter !=0:
|
18
|
-
loc = random.randrange(length)
|
19
|
-
while string[loc] == '1':
|
20
|
-
loc = random.randrange(length)
|
21
|
-
string = string[:loc] + '1' + string[loc+1:]
|
22
|
-
counter -= 1
|
23
|
-
return string
|
24
|
-
|
25
|
-
def createConstRandomStrings(length, numStrings, numOnes):
|
26
|
-
"""Returns a list of random binary strings, each with exactly numOnes ones."""
|
27
|
-
strings = []
|
28
|
-
for i in range(numStrings):
|
29
|
-
strings.append(createRandomString(length, numOnes))
|
30
|
-
return strings
|
31
|
-
|
32
|
-
def createIndependentRandomStrings(length, numStrings, q = -1, numOnes = -1):
|
33
|
-
"""Returns a set (size numStrings) of binary strings where each bit is
|
34
|
-
randomly 0 or 1 with probability s.t. the probability of 2 strings meshing
|
35
|
-
is q."""
|
36
|
-
if q >= 0:
|
37
|
-
# print 'q = (1-p^2)^b'
|
38
|
-
p = math.sqrt(1 - (q**(1.0/length)))
|
39
|
-
elif numOnes > 0:
|
40
|
-
# print 'p = n/b'
|
41
|
-
p = float(numOnes)/length
|
42
|
-
# print "q = {}".format(((1 - (p)**2)**length))
|
43
|
-
elif numOnes == 0:
|
44
|
-
raise Exception("numOnes should not be 0.")
|
45
|
-
else:
|
46
|
-
raise Exception('must specify q or numOnes')
|
47
|
-
# print "q = {}".format(q)
|
48
|
-
# print "p = {}".format(p)
|
49
|
-
# print "occupancy mean is {} variance is {}".format(length*p,length*p*(1-p))
|
50
|
-
all_strings = []
|
51
|
-
for i in range(numStrings):
|
52
|
-
string = ''
|
53
|
-
for i in range(length):
|
54
|
-
if random.random() < p:
|
55
|
-
string += '1'
|
56
|
-
else:
|
57
|
-
string += '0'
|
58
|
-
all_strings.append(string)
|
59
|
-
string = ''
|
60
|
-
|
61
|
-
return all_strings
|
62
|
-
|
63
|
-
def providedStrings(filename):
|
64
|
-
"""not yet implemented. will return the list of strings from some location."""
|
65
|
-
return None
|
66
|
-
|
67
|
-
|
68
|
-
#print createRandomString(32, 16)
|
69
|
-
#print createIndependentRandomStrings(32,.5,1)
|
@@ -1,100 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
"""
|
3
|
-
Created on Fri Apr 15 15:25:44 2016
|
4
|
-
|
5
|
-
@author: devd
|
6
|
-
"""
|
7
|
-
|
8
|
-
from __future__ import division
|
9
|
-
from createRandomString import *
|
10
|
-
from makeGraph import *
|
11
|
-
import matplotlib.pyplot as plt
|
12
|
-
import matplotlib.patches as mpatches
|
13
|
-
import networkx as nx
|
14
|
-
import numpy as np
|
15
|
-
import time
|
16
|
-
from compute_exp_Y import compute_exp_Y, compute_degree_bound, compute_isolated_edge_bound, compute_degreeplusone_bound, compute_improved_degreeplusone_bound
|
17
|
-
from choose import compute_q
|
18
|
-
import logging
|
19
|
-
|
20
|
-
logging.getLogger('').handlers = []
|
21
|
-
logging.basicConfig(level=logging.DEBUG, format='%(asctime)s - %(levelname)s - %(message)s')
|
22
|
-
|
23
|
-
def compute_actual_improved_deg_bound(graph):
|
24
|
-
edgeList = graph.edges()
|
25
|
-
lower_bound = 0
|
26
|
-
for edge in edgeList:
|
27
|
-
deg1 = graph.degree(edge[0])
|
28
|
-
deg2 = graph.degree(edge[1])
|
29
|
-
# if deg1 == deg2 == 1:
|
30
|
-
# lower_bound += 1
|
31
|
-
# elif deg1 == 1 and deg2 == 2:
|
32
|
-
# lower_bound+=.5
|
33
|
-
# elif deg1 == 1:
|
34
|
-
# lower_bound += (1.0/deg2)
|
35
|
-
# elif deg2 ==1:
|
36
|
-
# lower_bound += (1.0/deg1)
|
37
|
-
# elif deg1 == 2 and deg2 == 3:
|
38
|
-
# lower_bound += 1.0/3.0
|
39
|
-
if deg1 == 2 and deg2 == 2:
|
40
|
-
lower_bound += 1/3.0
|
41
|
-
else:
|
42
|
-
# lower_bound += min((1.0/(deg1+1)),(1.0/(deg2+1)))
|
43
|
-
lower_bound += min((1.0/(deg1)),(1.0/(deg2)))
|
44
|
-
return lower_bound
|
45
|
-
|
46
|
-
def experiment(length, ones_range_min, ones_range_max, reps, numStrings):
|
47
|
-
strings = []
|
48
|
-
|
49
|
-
|
50
|
-
for numOnes in range(ones_range_min, ones_range_max+1):
|
51
|
-
for iterations in range (reps):
|
52
|
-
# for i in range(numStrings):
|
53
|
-
# strings.append(createRandomString(length, numOnes))
|
54
|
-
strings = createIndependentRandomStrings(length = length, numStrings = numStrings, numOnes = numOnes)
|
55
|
-
|
56
|
-
graph = makeGraph(strings)
|
57
|
-
max_matching = len(nx.max_weight_matching(graph))/2
|
58
|
-
lower_bound = compute_actual_improved_deg_bound(graph)
|
59
|
-
if max_matching+.0001 < lower_bound:
|
60
|
-
print 'Max matching {} but lower bound {} for length {} strings, occupancy {}, {} total strings'.format(max_matching, lower_bound, length, numOnes, numStrings)
|
61
|
-
print nx.triangles(graph)
|
62
|
-
print graph.degree()
|
63
|
-
# nx.draw(graph)
|
64
|
-
strings = []
|
65
|
-
|
66
|
-
def experiment2(numNodes):
|
67
|
-
graph = nx.complete_graph(numNodes)
|
68
|
-
max_matching = len(nx.max_weight_matching(graph))/2
|
69
|
-
lower_bound = compute_actual_improved_deg_bound(graph)
|
70
|
-
if max_matching+.0001 < lower_bound:
|
71
|
-
print 'Max matching {} but lower bound {} for complete graph on {} nodes'.format(max_matching, lower_bound, numNodes)
|
72
|
-
|
73
|
-
|
74
|
-
def plot_it(length, ones_range_min, ones_range_max, reps, numStrings):
|
75
|
-
experiment(length, ones_range_min, ones_range_max, reps, numStrings)
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
if __name__ == '__main__':
|
80
|
-
# experiment2(101)
|
81
|
-
|
82
|
-
length = [32]
|
83
|
-
ones_range_min = 1
|
84
|
-
# ones_range_min = 8
|
85
|
-
ones_range_max = 32
|
86
|
-
reps = 100
|
87
|
-
numStrings= [20]
|
88
|
-
|
89
|
-
start = time.time()
|
90
|
-
t = time.localtime()
|
91
|
-
logging.info('deg bound experiment with lengths {}, num strings {} started'.format(length, numStrings))
|
92
|
-
for l in length:
|
93
|
-
for n in numStrings:
|
94
|
-
plot_it(l, ones_range_min, int(l/2), reps, n)
|
95
|
-
logging.info('completed length {} num strings {}'.format(l, n))
|
96
|
-
end = time.time()
|
97
|
-
print 'done in {} seconds'.format(end-start)
|
98
|
-
# graph = makeGraph(['0101','1100','0011','1010'])
|
99
|
-
# nx.draw(graph)
|
100
|
-
# print compute_actual_improved_deg_bound(graph)
|
@@ -1,47 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
"""
|
3
|
-
Created on Mon Jun 13 11:46:53 2016
|
4
|
-
|
5
|
-
@author: devd
|
6
|
-
"""
|
7
|
-
|
8
|
-
from createRandomString import *
|
9
|
-
from makeGraph import *
|
10
|
-
import networkx as nx
|
11
|
-
import matplotlib.pyplot as plt
|
12
|
-
|
13
|
-
def experiment(numOnes, numStrings, length, reps):
|
14
|
-
maxdeg = []
|
15
|
-
mindeg = []
|
16
|
-
for i in range(reps):
|
17
|
-
strings = []
|
18
|
-
for i in range(numStrings):
|
19
|
-
strings.append(createRandomString(length, numOnes))
|
20
|
-
graph = makeGraph(strings)
|
21
|
-
# nx.draw(graph)
|
22
|
-
max = min = graph.degree(0)
|
23
|
-
# print 'initial max/min is {}'.format(max)
|
24
|
-
for j in range(1, numStrings):
|
25
|
-
deg = graph.degree(j)
|
26
|
-
# print 'this one has degree {}'.format(deg)
|
27
|
-
if deg>max:
|
28
|
-
max = deg
|
29
|
-
if deg<min:
|
30
|
-
min = deg
|
31
|
-
maxdeg.append(max)
|
32
|
-
mindeg.append(min)
|
33
|
-
|
34
|
-
return maxdeg, mindeg
|
35
|
-
|
36
|
-
|
37
|
-
def plot_it(numOnes, numStrings, length, reps):
|
38
|
-
maxdeg, mindeg = experiment(numOnes, numStrings, length, reps)
|
39
|
-
x = range(reps)
|
40
|
-
print maxdeg
|
41
|
-
print mindeg
|
42
|
-
plt.plot(x, maxdeg)
|
43
|
-
plt.plot(x, mindeg)
|
44
|
-
# plt.show()
|
45
|
-
|
46
|
-
|
47
|
-
plot_it(5, 80, 32, 10)
|
@@ -1,81 +0,0 @@
|
|
1
|
-
00000000000000000000000000000000
|
2
|
-
01001000000000000000000000000000
|
3
|
-
00000000000000000000000000000000
|
4
|
-
00000000001000000000000000000000
|
5
|
-
00000000000000000000000000000000
|
6
|
-
00000000000010000000001000000000
|
7
|
-
00000000000000000000000000000000
|
8
|
-
00010000000000000100100000000010
|
9
|
-
00000000000000000000000000000000
|
10
|
-
10000000000000000000000000001000
|
11
|
-
00000000000010000000100000000000
|
12
|
-
00000000000000000000000000000000
|
13
|
-
00000000000000000000000000000000
|
14
|
-
00000000100000100000000000000000
|
15
|
-
00000000000010000000000000000000
|
16
|
-
00000000100000000000000000000000
|
17
|
-
00000000001010000000000000000000
|
18
|
-
00000000000000000000000000000000
|
19
|
-
00000000000000000000000000000000
|
20
|
-
00000000000000010000001000000000
|
21
|
-
00000000000000100000000000000000
|
22
|
-
00000000001000010000000000000000
|
23
|
-
00000000000000000000000000000000
|
24
|
-
00000000000000000000000000000000
|
25
|
-
00000001000000000000000000000000
|
26
|
-
00000000000000000000000000000000
|
27
|
-
00000100100000000000000000000000
|
28
|
-
00000000000000000000000000000000
|
29
|
-
00000000000000001000000000000000
|
30
|
-
00000000000000000000000100000000
|
31
|
-
00000000000000000000000000000000
|
32
|
-
00100000010000000000000000000000
|
33
|
-
00000000000000000000000000000000
|
34
|
-
00000000000000000000000000000000
|
35
|
-
00000000000000100000000000000001
|
36
|
-
00000000000000000000001000000000
|
37
|
-
00000000000000000000000000000000
|
38
|
-
00010000000000000000000000000000
|
39
|
-
00000000000000100000000000000000
|
40
|
-
00100000000000000000000000000000
|
41
|
-
01000000000000000100000000000000
|
42
|
-
00000000000000100000000000000100
|
43
|
-
00000000000000000000000000000000
|
44
|
-
00000000000000000000000000000000
|
45
|
-
00000000000000010000000000000000
|
46
|
-
00100000000000100000000000000000
|
47
|
-
00000000000000000000000000000000
|
48
|
-
00000000000000000000000000000010
|
49
|
-
00000000000000000000000000100000
|
50
|
-
00000001000001000000000000100000
|
51
|
-
00000000000000000000000000000000
|
52
|
-
00000001000000000000000000000000
|
53
|
-
00000000000100000000000000000000
|
54
|
-
00000000000000000000000000000000
|
55
|
-
00000000000000000000000000000000
|
56
|
-
00000000000000000000000000000000
|
57
|
-
00000000000000101000000000100000
|
58
|
-
00000000000000000000000000000000
|
59
|
-
00000000000100000000000100000000
|
60
|
-
00000000000000010000000000000000
|
61
|
-
00000000000000000000000000000000
|
62
|
-
00000000000000000000000000000000
|
63
|
-
00000000000000001000000000000001
|
64
|
-
00000000000000000000000000000100
|
65
|
-
00000010000000000000000000000000
|
66
|
-
00000000101000000010000000000000
|
67
|
-
00000000000000001000000000000000
|
68
|
-
00000000000000000000000000000000
|
69
|
-
00000000000000000000000010000000
|
70
|
-
00000100000000000000000000000000
|
71
|
-
00000000000000000000000000000000
|
72
|
-
00000000000000000001000000000000
|
73
|
-
00000000000000000000100000000000
|
74
|
-
00000010000010000000000000000101
|
75
|
-
00000000000000000010000000000000
|
76
|
-
00000000000000000000000000000000
|
77
|
-
00000000000000000000000000000100
|
78
|
-
00000000000000010000000000000000
|
79
|
-
00001100100000000000000000000000
|
80
|
-
00000000001000000000000000000000
|
81
|
-
-39
|
@@ -1,81 +0,0 @@
|
|
1
|
-
00010100000000000000100000000000
|
2
|
-
00000100000000000000000000000000
|
3
|
-
00000000000000000000000000000000
|
4
|
-
00000000000000000010110010000000
|
5
|
-
00100000010000000000001000000000
|
6
|
-
00000000000000000000001000000001
|
7
|
-
00000000000000000000000000001000
|
8
|
-
00000000001000100000000000000000
|
9
|
-
01000000000000000000000000000010
|
10
|
-
00000000000000000000000000010000
|
11
|
-
00000000001000000000000000000000
|
12
|
-
00000000000000000000001000000000
|
13
|
-
00010000000000000000000000000000
|
14
|
-
00000100000001000000000000000000
|
15
|
-
10000100000000000000000100000000
|
16
|
-
00000000000000010000000000100000
|
17
|
-
00000001000010000100000000000100
|
18
|
-
10000000000000000000000000000000
|
19
|
-
00000000000000000000000001000000
|
20
|
-
00010000000000000010000000100001
|
21
|
-
00000100000000000000000000000000
|
22
|
-
00000000100000010010000000000000
|
23
|
-
00000000000000000000000000000000
|
24
|
-
00000100000000000000000000000000
|
25
|
-
00000000010000000000000000000000
|
26
|
-
00000100000000000000000100000000
|
27
|
-
00000000000001000001000000000000
|
28
|
-
00000000000000000000000000000000
|
29
|
-
00000000000100001010100000000000
|
30
|
-
10000000000011000000000000101000
|
31
|
-
00000000000000000001000011000000
|
32
|
-
00101001000000000001100100000000
|
33
|
-
00000000001000000000000000000000
|
34
|
-
00000000000000000100101000000000
|
35
|
-
00000000000000000000000000000000
|
36
|
-
00000000000000000001000000000000
|
37
|
-
10001000000000000000000000000000
|
38
|
-
00000000000000001000000000000000
|
39
|
-
00000000000000000000000100000000
|
40
|
-
00000100000000010000000001000000
|
41
|
-
00000000100000000000000000000000
|
42
|
-
00000001010000000000001000000000
|
43
|
-
10000000000000000100000000000001
|
44
|
-
00001000000000000000000000000000
|
45
|
-
00000000000000000000000000000000
|
46
|
-
00000000000100000000010100000000
|
47
|
-
00001000001000000000010000000000
|
48
|
-
00100000000000000000010000000000
|
49
|
-
01000000000000000000000001000000
|
50
|
-
00000000000000000000000000000000
|
51
|
-
00000000000100001000000000000000
|
52
|
-
00000000000000000000000000000000
|
53
|
-
00000001000010000000000000101000
|
54
|
-
00000000001000010000000000000000
|
55
|
-
00000000000000000000100000100100
|
56
|
-
00000000010110000000000000000000
|
57
|
-
00000000000000000000010010000010
|
58
|
-
00000000000000000000000000000000
|
59
|
-
00000000000000000000000000001000
|
60
|
-
00001000000000000000000000000000
|
61
|
-
00000000000010000000000000000000
|
62
|
-
00100001000100000000000000011010
|
63
|
-
00100000010000000000000000000000
|
64
|
-
00000000000010000000010000001000
|
65
|
-
00010000000000000100000000000000
|
66
|
-
00000010000000000000001000000000
|
67
|
-
00000000000000010000010000000000
|
68
|
-
00000000000000000000000000001000
|
69
|
-
00000000000100001000000000000100
|
70
|
-
00000010000000000000000000000000
|
71
|
-
10000000000000000000001000001010
|
72
|
-
00000010000000000001000000000000
|
73
|
-
00000000000000000000000101000010
|
74
|
-
00000000000000000000000000010000
|
75
|
-
00000000000000000000000000000000
|
76
|
-
10000000000000100001000000000000
|
77
|
-
00010000001000001000000000100000
|
78
|
-
00000000000000000000000000000000
|
79
|
-
00000000000000000000000010000000
|
80
|
-
00001000100000000101000010001100
|
81
|
-
-35
|