Skip to content

Commit

Permalink
Some improvements and reogranized results
Browse files Browse the repository at this point in the history
  • Loading branch information
jah12014 committed Feb 11, 2018
1 parent a8c021c commit 4568bb8
Show file tree
Hide file tree
Showing 29 changed files with 3,759 additions and 3,485 deletions.
52 changes: 52 additions & 0 deletions IncrementalMinimization/compare_data.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import sys

file1 = sys.argv[1]
file2 = sys.argv[2]
base_index = int(sys.argv[3])
comp_index = int(sys.argv[4])

def toNum(s):
if s.isdigit():
return int(s)
else:
return float(s)

with open(file1, "r") as f:
f1 = f.read().split("\n")

with open(file2, "r") as f:
f2 = f.read().split("\n")

title_row = f1[0].split(',')
#assert(all(title1 == title2 for title1, title2 in zip(title_row, f2[0].split(','))))
f1Data = [[toNum(datum) for datum in row.split(',') if datum]
for row in f1[1:] if row]
f2Data = [[toNum(datum) for datum in row.split(',') if datum]
for row in f2[1:] if row]

f1Average = 0
f2Average = 0
count = 0.0
for row in range(0,min(len(f1Data),len(f2Data))):
if f1Data[row][:4] != f2Data[row][:4]:
if len(f1Data) > len(f2Data):
f1Data.pop(row)
elif len(f1Data) < len(f2Data):
f2Data.pop(row)
else:
raise Exception("Data tables not expressing same data")

f1Comp = f1Data[row][base_index] - f1Data[row][comp_index]
f2Comp = f2Data[row][base_index] - f2Data[row][comp_index]
if count == 0:
f1Average = f1Comp
f2Average = f2Comp
else:
count += 1.0
f1Average += (f1Comp - f1Average)/count
f2Average += (f2Comp - f2Average)/count

print(f1Average)
print(f2Average)
print((f2Average-f1Average)/float(f1Average))

Binary file added IncrementalMinimization/compare_states_old.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
71 changes: 71 additions & 0 deletions IncrementalMinimization/compare_test (copy).txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
initial states, final states, transition count, predicate count, minterm count,incremental time, standard time, Moore time, upfront incremental time25, 17, 98, 12, 6, 3487.336, 1863.561, 9470.181, 5278.052
31, 8, 103, 13, 7, 2303.35, 1937.221, 17252.978, 4947.835
10, 7, 23, 10, 5, 327.807, 318.24, 782.279, 656.084
111, 21, 531, 24, 10, 51820.696, 9952.239, 67995.546, 39291.798
36, 17, 173, 26, 11, 1445.413, 1166.227, 19221.816, 3199.084
48, 39, 167, 31, 10, 2272.373, 1480.43, 11262.559, 3461.064
917, 114, 5506, 97, 36, 1.89069080689E8, 100854.248, 1.823855449E7, 1.93661514361E8
1, 1, 1, 1, 1, 27.297, 5.431, 3.968, 5.605
47, 34, 111, 40, 19, 1053.577, 1296.679, 5123.96, 3503.503
431, 184, 2895, 76, 22, 1.2146203307E7, 43922.44, 1278459.939, 1.0487877144E7
224, 20, 3195, 72, 32, 483568.365, 26845.692, 4872224.994, 429573.604
354, 62, 2621, 78, 32, 6149100.02, 20397.399, 1395582.478, 6341641.751
33, 17, 117, 25, 13, 2316.059, 648.378, 8860.482, 3399.417
12, 8, 27, 9, 5, 141.218, 115.303, 245.932, 281.502
22, 16, 104, 10, 6, 613.152, 473.42, 2827.899, 1628.145
34, 3, 66, 34, 33, 556.749, 334.655, 610.261, 2291.58
34, 18, 110, 23, 11, 1527.101, 534.733, 1848.82, 2915.215
323, 67, 1369, 80, 32, 959538.544, 15249.773, 665568.704, 961050.856
55, 42, 187, 26, 7, 1511.862, 1040.321, 13276.774, 2715.46
14, 7, 38, 7, 4, 188.59, 188.515, 462.664, 308.993
22, 11, 56, 9, 6, 260.995, 313.671, 1556.372, 553.332
7, 5, 15, 5, 3, 80.68, 61.628, 97.613, 136.579
25, 9, 84, 14, 11, 458.796, 346.88, 2735.754, 1302.315
6, 4, 14, 7, 6, 76.274, 71.362, 89.07, 189.861
66, 26, 373, 54, 24, 15948.193, 2297.347, 21038.048, 38901.597
43, 26, 284, 47, 24, 2921.902, 1755.349, 14127.097, 14766.014
17, 13, 39, 20, 11, 179.341, 226.143, 1406.385, 375.003
22, 7, 65, 11, 6, 298.086, 271.392, 1459.536, 642.807
20, 5, 86, 8, 5, 408.165, 323.528, 1170.398, 750.194
13, 11, 40, 9, 5, 146.429, 148.37, 534.344, 294.115
23, 16, 65, 23, 12, 368.245, 323.912, 1622.434, 1371.17
56, 52, 146, 54, 23, 1052.111, 669.794, 29703.262, 3360.466
26, 3, 118, 18, 11, 538.846, 320.716, 2623.508, 1853.844
22, 18, 55, 14, 6, 206.991, 198.395, 1417.708, 564.082
21, 15, 58, 18, 8, 243.203, 223.022, 948.698, 497.46
19, 14, 50, 16, 8, 200.521, 191.884, 783.065, 410.348
1, 1, 1, 1, 1, 10.639, 6.349, 0.648, 4.191
9, 8, 18, 14, 8, 64.287, 79.247, 121.074, 167.006
5, 4, 9, 5, 3, 37.396, 34.524, 29.902, 57.745
8, 7, 19, 6, 3, 77.409, 64.9, 104.255, 123.763
90, 90, 176, 65, 33, 814.634, 901.572, 145434.84, 4939.995
3, 3, 4, 3, 2, 27.039, 39.229, 42.784, 38.167
17, 10, 41, 10, 5, 181.532, 192.978, 531.556, 411.533
41, 30, 127, 18, 8, 1062.559, 592.239, 6425.49, 1834.627
7, 5, 15, 7, 4, 82.0, 78.423, 95.882, 146.922
11, 7, 27, 7, 4, 114.427, 137.603, 318.457, 242.724
31, 19, 92, 10, 5, 756.705, 412.827, 1408.812, 1187.978
3, 3, 4, 3, 2, 50.361, 21.768, 27.899, 43.167
12, 10, 24, 7, 4, 85.878, 110.68, 114.01, 194.917
52, 13, 184, 15, 7, 2730.339, 1208.353, 14031.299, 3291.895
35, 35, 90, 20, 10, 1399.014, 460.691, 12925.164, 1913.823
18, 13, 29, 13, 10, 207.916, 106.123, 1072.073, 445.07
49, 48, 123, 9, 5, 3853.384, 672.602, 5194.74, 4260.752
19, 18, 36, 8, 4, 123.261, 128.226, 918.635, 199.075
22, 7, 71, 9, 6, 429.0, 412.489, 1368.677, 705.463
44, 8, 157, 13, 8, 1052.352, 889.606, 6073.434, 1979.535
10, 7, 23, 7, 4, 170.208, 111.117, 224.388, 197.752
31, 13, 111, 19, 9, 595.885, 446.17, 4174.534, 1441.171
18, 7, 55, 10, 6, 314.962, 248.232, 879.963, 646.963
100, 22, 381, 20, 7, 15611.104, 1640.551, 64212.608, 22634.286
53, 14, 233, 26, 11, 2558.093, 1021.784, 8487.83, 5379.171
79, 52, 278, 44, 19, 4662.781, 1408.871, 27939.191, 12385.507
43, 36, 117, 33, 12, 591.506, 468.908, 9190.977, 1777.36
18, 14, 67, 13, 7, 295.381, 253.234, 775.547, 812.867
80, 77, 312, 14, 7, 9780.399, 1894.033, 164425.803, 22433.731
87, 80, 339, 18, 8, 10113.428, 1891.177, 172719.377, 9208.509
22, 13, 66, 19, 8, 960.449, 468.193, 1122.943, 1572.927
1, 1, 1, 1, 1, 20.273, 1.26, 0.622, 2.819
85, 60, 285, 50, 21, 5958.922, 1339.378, 27464.192, 12456.092
1, 1, 1, 1, 1, 15.496, 3.248, 1.181, 3.762
43, 36, 132, 26, 9, 1270.139, 691.667, 2535.88, 1915.797
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added IncrementalMinimization/data_session.sobj
Binary file not shown.
9 changes: 2 additions & 7 deletions IncrementalMinimization/generate_graph.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import matplotlib.pyplot as pyplot
import sys

cutoff = 500
xAxis = "Number of States"
yAxis = "Average Minimization Time (ns)"
title = "Comparison of SFA Minimization Algorithms"

testsfile = sys.argv[1]
xIndex = int(sys.argv[2])
graph_indices = [int(i) for i in sys.argv[3:]]
graph_indices = [int(i) for i in sys.argv[3:-1]]
cutoff = int(sys.argv[-1])

def toNum(s):
if s.isdigit():
Expand Down Expand Up @@ -50,8 +50,3 @@ def mergeData(data, index):
pyplot.title(title)
pyplot.savefig("graph.png", dpi=600)






4 changes: 4 additions & 0 deletions IncrementalMinimization/incremental_minimization_desc.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Incremental Minimization of Symbolic Finite Automata

Symbolic finite automata (SFA) are generalizations of classical finite automata. Whereas the transitions of classical automata are defined by characters from the automata's alphabet, the transitions of symbolic automata are defined by predicates over a boolean algebra on the alphabet. This allows for SFAs to be efficiently constructed over extremely large, and possibly infinite, alphabets. In this paper, I will present an algorithm for the incremental minimization of deterministic SFAs based on an existing incremental algorithm for DFA minimization. Although more efficient algorithms exist for SFA minimization, this algorithm is designed to minimize the automata incrementally so that the minimization can be stopped at any time and computations can be run on the partially minimized SFA.

Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
initial states, final states, incremental states, upfront statesincremental percent, upfront percent25, 17, 17, 25, 1.0, 0.0
31, 8, 8, 31, 1.0, 0.0
10, 7, 7, 10, 1.0, 0.0
111, 21, 110, 111, 0.011111111111111112, 0.0
36, 17, 17, 36, 1.0, 0.0
48, 39, 45, 48, 0.3333333333333333, 0.0
917, 114, 870, 912, 0.058530510585305104, 0.0062266500622665
1, 1, 1, 1, 1.0, 1.0
47, 34, 34, 47, 1.0, 0.0
431, 184, 429, 431, 0.008097165991902834, 0.0
224, 20, 65, 224, 0.7794117647058824, 0.0
354, 62, 354, 354, 0.0, 0.0
33, 17, 17, 33, 1.0, 0.0
12, 8, 8, 10, 1.0, 0.5
22, 16, 16, 22, 1.0, 0.0
34, 3, 3, 34, 1.0, 0.0
34, 18, 29, 34, 0.3125, 0.0
323, 67, 323, 323, 0.0, 0.0
55, 42, 50, 55, 0.38461538461538464, 0.0
14, 7, 7, 9, 1.0, 0.7142857142857143
22, 11, 11, 22, 1.0, 0.0
7, 5, 5, 5, 1.0, 1.0
25, 9, 9, 25, 1.0, 0.0
6, 4, 4, 6, 1.0, 0.0
66, 26, 59, 66, 0.175, 0.0
43, 26, 32, 43, 0.6470588235294118, 0.0
17, 13, 13, 17, 1.0, 0.0
22, 7, 7, 22, 1.0, 0.0
20, 5, 5, 17, 1.0, 0.2
13, 11, 11, 13, 1.0, 0.0
140, 53, 129, 140, 0.12643678160919541, 0.0
23, 16, 16, 23, 1.0, 0.0
56, 52, 52, 56, 1.0, 0.0
26, 3, 3, 26, 1.0, 0.0
22, 18, 18, 22, 1.0, 0.0
21, 15, 15, 21, 1.0, 0.0
19, 14, 14, 19, 1.0, 0.0
1, 1, 1, 1, 1.0, 1.0
9, 8, 8, 9, 1.0, 0.0
5, 4, 4, 5, 1.0, 0.0
8, 7, 7, 7, 1.0, 1.0
90, 90, 90, 90, 1.0, 1.0
3, 3, 3, 3, 1.0, 1.0
17, 10, 10, 17, 1.0, 0.0
41, 30, 32, 41, 0.8181818181818182, 0.0
7, 5, 5, 6, 1.0, 0.5
11, 7, 7, 11, 1.0, 0.0
31, 19, 22, 31, 0.75, 0.0
3, 3, 3, 3, 1.0, 1.0
12, 10, 10, 12, 1.0, 0.0
52, 13, 30, 38, 0.5641025641025641, 0.358974358974359
35, 35, 35, 35, 1.0, 1.0
18, 13, 13, 18, 1.0, 0.0
49, 48, 49, 49, 0.0, 0.0
19, 18, 18, 18, 1.0, 1.0
22, 7, 7, 19, 1.0, 0.2
44, 8, 8, 31, 1.0, 0.3611111111111111
10, 7, 7, 7, 1.0, 1.0
31, 13, 13, 31, 1.0, 0.0
18, 7, 7, 18, 1.0, 0.0
100, 22, 72, 100, 0.358974358974359, 0.0
53, 14, 22, 53, 0.7948717948717948, 0.0
79, 52, 72, 79, 0.25925925925925924, 0.0
43, 36, 37, 43, 0.8571428571428571, 0.0
18, 14, 14, 18, 1.0, 0.0
80, 77, 80, 80, 0.0, 0.0
87, 80, 87, 87, 0.0, 0.0
22, 13, 14, 22, 0.8888888888888888, 0.0
1, 1, 1, 1, 1.0, 1.0
85, 60, 78, 85, 0.28, 0.0
1, 1, 1, 1, 1.0, 1.0
43, 36, 41, 43, 0.2857142857142857, 0.0
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ initial states, final states, transition count, predicate count, minterm count,i
22, 7, 65, 11, 6, 290.4, 248.788, 1209.445, 608.895
20, 5, 86, 8, 5, 451.081, 370.525, 1158.023, 804.976
13, 11, 40, 9, 5, 120.588, 135.959, 440.428, 255.255
140, 53, 513, 41, 15, 14665.129, 2670.433, 347777.032, 20779.615
23, 16, 65, 23, 12, 372.255, 321.95, 1593.383, 1621.046
56, 52, 146, 54, 23, 705.645, 667.824, 20512.728, 3281.178
26, 3, 118, 18, 11, 516.847, 351.52, 2337.99, 1590.179
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
initial states, final states, transition count, predicate count, minterm count,incremental time, standard time, Moore time, upfront incremental time25, 17, 98, 12, 6, 11527.241, 2482.854, 9681.472, 11068.811
31, 8, 103, 13, 7, 2905.146, 2446.434, 22103.697, 7109.453
10, 7, 23, 10, 5, 262.631, 258.768, 560.334, 399.402
111, 21, 531, 24, 10, 48690.339, 6926.586, 63055.429, 58720.065
36, 17, 173, 26, 11, 1340.039, 1385.968, 18873.392, 3144.459
48, 39, 167, 31, 10, 2111.191, 2667.712, 8675.454, 3283.419
917, 114, 5506, 97, 36, 1.88157306712E8, 276304.927, 1.4681763909E7, 1.64553514535E8
1, 1, 1, 1, 1, 17.408, 5.878, 3.768, 6.845
47, 34, 111, 40, 19, 1329.575, 1682.355, 6646.538, 2842.601
431, 184, 2895, 76, 22, 1.0364242058E7, 27538.443, 1019371.133, 8763109.874
224, 20, 3195, 72, 32, 389171.144, 20718.299, 3935439.42, 405333.825
354, 62, 2621, 78, 32, 5371547.616, 17630.943, 1139210.042, 5503696.759
33, 17, 117, 25, 13, 1786.636, 702.618, 7762.796, 3484.434
12, 8, 27, 9, 5, 179.873, 166.542, 270.602, 390.83
22, 16, 104, 10, 6, 547.278, 564.507, 2630.451, 1307.771
34, 3, 66, 34, 33, 409.159, 404.19, 600.255, 2222.468
34, 18, 110, 23, 11, 1003.05, 627.197, 1686.721, 2505.736
323, 67, 1369, 80, 32, 833361.909, 15004.134, 629259.602, 839370.132
55, 42, 187, 26, 7, 1408.301, 1442.389, 13101.482, 2222.87
14, 7, 38, 7, 4, 172.018, 166.599, 497.738, 395.53
22, 11, 56, 9, 6, 269.547, 313.398, 1425.081, 564.985
7, 5, 15, 5, 3, 106.605, 196.024, 88.796, 130.623
25, 9, 84, 14, 11, 393.482, 452.799, 2609.65, 1358.874
6, 4, 14, 7, 6, 79.012, 105.203, 127.583, 210.571
66, 26, 373, 54, 24, 16664.665, 2180.674, 19753.344, 34408.826
43, 26, 284, 47, 24, 3238.281, 1683.868, 12804.224, 13368.985
17, 13, 39, 20, 11, 156.935, 172.522, 1347.371, 381.011
22, 7, 65, 11, 6, 305.611, 231.198, 1296.936, 641.642
20, 5, 86, 8, 5, 393.469, 356.482, 1503.933, 737.808
13, 11, 40, 9, 5, 152.444, 139.949, 523.983, 280.265
140, 53, 513, 41, 15, 12600.816, 2919.118, 303433.764, 20415.843
23, 16, 65, 23, 12, 299.287, 313.717, 1525.512, 1352.136
56, 52, 146, 54, 23, 814.126, 604.82, 18290.523, 3190.27
26, 3, 118, 18, 11, 636.314, 361.241, 2551.903, 1767.317
22, 18, 55, 14, 6, 283.96, 205.655, 1160.444, 481.808
21, 15, 58, 18, 8, 256.838, 288.956, 947.505, 584.071
19, 14, 50, 16, 8, 238.475, 198.789, 829.287, 481.34
1, 1, 1, 1, 1, 20.925, 21.737, 0.622, 4.461
9, 8, 18, 14, 8, 88.289, 94.777, 122.809, 170.501
5, 4, 9, 5, 3, 54.096, 51.033, 47.231, 92.583
8, 7, 19, 6, 3, 76.295, 80.196, 121.27, 127.796
90, 90, 176, 65, 33, 778.127, 882.123, 124295.672, 4760.523
3, 3, 4, 3, 2, 25.437, 24.069, 15.107, 23.562
17, 10, 41, 10, 5, 191.606, 177.972, 370.544, 404.64
41, 30, 127, 18, 8, 1071.891, 566.636, 7087.098, 1646.084
7, 5, 15, 7, 4, 68.944, 127.67, 85.885, 135.583
11, 7, 27, 7, 4, 105.329, 133.994, 224.756, 197.333
31, 19, 92, 10, 5, 680.748, 412.418, 1367.671, 1221.669
3, 3, 4, 3, 2, 36.167, 35.269, 29.834, 28.971
12, 10, 24, 7, 4, 88.447, 84.406, 115.742, 144.683
52, 13, 184, 15, 7, 1988.206, 718.482, 12115.28, 3139.483
35, 35, 90, 20, 10, 1051.453, 380.842, 11506.051, 1084.021
18, 13, 29, 13, 10, 156.654, 89.816, 962.273, 344.419
49, 48, 123, 9, 5, 2049.024, 636.105, 5307.205, 3841.096
19, 18, 36, 8, 4, 114.541, 188.237, 785.033, 306.257
22, 7, 71, 9, 6, 392.884, 299.267, 1201.303, 843.03
44, 8, 157, 13, 8, 836.138, 742.812, 5990.097, 2053.657
10, 7, 23, 7, 4, 138.554, 97.715, 178.19, 142.5
31, 13, 111, 19, 9, 708.379, 447.803, 3588.922, 1310.55
18, 7, 55, 10, 6, 264.616, 279.824, 720.938, 808.482
100, 22, 381, 20, 7, 14789.868, 1713.39, 54487.325, 14494.789
53, 14, 233, 26, 11, 1910.711, 931.659, 8089.038, 4323.163
79, 52, 278, 44, 19, 4707.083, 1573.54, 23735.025, 10299.925
43, 36, 117, 33, 12, 764.677, 481.454, 7557.063, 1595.938
18, 14, 67, 13, 7, 341.072, 220.232, 714.65, 649.823
80, 77, 312, 14, 7, 11169.978, 1951.434, 155620.028, 22520.773
87, 80, 339, 18, 8, 9865.258, 2123.0, 155945.613, 7166.874
22, 13, 66, 19, 8, 539.182, 460.79, 725.244, 1173.034
1, 1, 1, 1, 1, 19.291, 1.17, 0.658, 3.163
85, 60, 285, 50, 21, 4710.054, 1230.953, 26450.604, 12323.701
1, 1, 1, 1, 1, 7.756, 15.906, 0.75, 15.911
43, 36, 132, 26, 9, 1073.901, 572.251, 2584.243, 2511.546
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 4568bb8

Please sign in to comment.