You can subscribe to this list here.
| 2010 |
Jan
|
Feb
|
Mar
(8) |
Apr
(95) |
May
(131) |
Jun
(19) |
Jul
(69) |
Aug
(41) |
Sep
(84) |
Oct
(49) |
Nov
(8) |
Dec
(79) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2011 |
Jan
(266) |
Feb
(82) |
Mar
(187) |
Apr
(56) |
May
(10) |
Jun
(11) |
Jul
(12) |
Aug
(32) |
Sep
(34) |
Oct
(1) |
Nov
(9) |
Dec
(23) |
| 2012 |
Jan
(26) |
Feb
(23) |
Mar
(27) |
Apr
(7) |
May
(1) |
Jun
|
Jul
(6) |
Aug
(12) |
Sep
(8) |
Oct
(34) |
Nov
(64) |
Dec
(13) |
| 2013 |
Jan
(2) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <mm...@us...> - 2013-01-05 07:42:16
|
Revision: 3316
http://dmcs.svn.sourceforge.net/dmcs/?rev=3316&view=rev
Author: mmsc
Date: 2013-01-05 07:42:09 +0000 (Sat, 05 Jan 2013)
Log Message:
-----------
Update data and scripts.
Modified Paths:
--------------
dmcs/branches/dmcs1.5/examples/test/data/ring.zip
dmcs/branches/dmcs1.5/examples/test/data/tree.zip
dmcs/branches/dmcs1.5/examples/test/tables.py
dmcs/branches/dmcs1.5/examples/test/tables.sh
Modified: dmcs/branches/dmcs1.5/examples/test/data/ring.zip
===================================================================
(Binary files differ)
Modified: dmcs/branches/dmcs1.5/examples/test/data/tree.zip
===================================================================
(Binary files differ)
Modified: dmcs/branches/dmcs1.5/examples/test/tables.py
===================================================================
--- dmcs/branches/dmcs1.5/examples/test/tables.py 2013-01-01 17:15:29 UTC (rev 3315)
+++ dmcs/branches/dmcs1.5/examples/test/tables.py 2013-01-05 07:42:09 UTC (rev 3316)
@@ -210,10 +210,20 @@
return outcomes, sorted_testcases
+def final_data_display(val):
+ if val == '1000124':
+ return '600'
+ elif val == '10001':
+ return 'E'
+ else:
+ return val
-def final_display(val):
+
+def final_table_display(val):
if val == '1000124':
return '---'
+ elif val == '1000134':
+ return 'M'
elif val == '10001':
return 'E'
else:
@@ -264,22 +274,22 @@
instance[2],
instance[3],
instance[4],
- final_display(outcome[0][0]),
- final_display(outcome[0][1]),
- final_display(outcome[1][0]),
- final_display(outcome[1][1]),
- final_display(outcome[2][0]),
- final_display(outcome[3][0]),
- final_display(outcome[4][0]),
+ final_table_display(outcome[0][0]),
+ final_table_display(outcome[0][1]),
+ final_table_display(outcome[1][0]),
+ final_table_display(outcome[1][1]),
+ final_table_display(outcome[2][0]),
+ final_table_display(outcome[3][0]),
+ final_table_display(outcome[4][0]),
outcome[4][1],
nice_display(outcome[5][0], outcome[5][1]),
- final_display(outcome[6][0]),
+ final_table_display(outcome[6][0]),
outcome[6][1],
nice_display(outcome[7][0], outcome[7][1]),
- final_display(outcome[8][0]),
+ final_table_display(outcome[8][0]),
outcome[8][1],
nice_display(outcome[9][0], outcome[9][1]),
- final_display(outcome[10][0]),
+ final_table_display(outcome[10][0]),
outcome[10][1],
nice_display(outcome[11][0], outcome[11][1])))
@@ -306,38 +316,71 @@
if not os.path.exists(path):
print "Make dir " + path
os.makedirs(path)
-
- with open(path + '/' + test_name + '.dat', 'w') as f:
- for i in range(len(outcomes)):
- outcome = outcomes[i]
- f.write(raw_row_template.format(final_display(outcome[0][0]),
- final_display(outcome[0][1]),
- final_display(outcome[1][0]),
- final_display(outcome[1][1]),
- final_display(outcome[2][0]),
- final_display(outcome[2][1]),
- final_display(outcome[3][0]),
- final_display(outcome[3][1]),
- final_display(outcome[4][0]),
- final_display(outcome[4][1]),
- final_display(outcome[5][0]),
- final_display(outcome[5][1]),
- final_display(outcome[6][0]),
- final_display(outcome[6][1]),
- final_display(outcome[7][0]),
- final_display(outcome[7][1]),
- final_display(outcome[8][0]),
- final_display(outcome[8][1]),
- final_display(outcome[9][0]),
- final_display(outcome[9][1]),
- final_display(outcome[10][0]),
- final_display(outcome[10][1]),
- final_display(outcome[11][0]),
- final_display(outcome[11][1])
- ))
- f.closed
+ cdoutput = 'condenseoutput';
+ if not os.path.exists(cdoutput):
+ print "Make dir " + cdoutput
+ os.makedirs(cdoutput)
+ with open(cdoutput + '/' + test_name + '.dat', 'w') as f1:
+ with open(path + '/' + test_name + '.dat', 'w') as f:
+ for i in range(len(outcomes)):
+ outcome = outcomes[i]
+ f.write(raw_row_template.format(final_data_display(outcome[0][0]),
+ final_data_display(outcome[0][1]),
+ final_data_display(outcome[1][0]),
+ final_data_display(outcome[1][1]),
+ final_data_display(outcome[2][0]),
+ final_data_display(outcome[2][1]),
+ final_data_display(outcome[3][0]),
+ final_data_display(outcome[3][1]),
+ final_data_display(outcome[4][0]),
+ final_data_display(outcome[4][1]),
+ final_data_display(outcome[5][0]),
+ final_data_display(outcome[5][1]),
+ final_data_display(outcome[6][0]),
+ final_data_display(outcome[6][1]),
+ final_data_display(outcome[7][0]),
+ final_data_display(outcome[7][1]),
+ final_data_display(outcome[8][0]),
+ final_data_display(outcome[8][1]),
+ final_data_display(outcome[9][0]),
+ final_data_display(outcome[9][1]),
+ final_data_display(outcome[10][0]),
+ final_data_display(outcome[10][1]),
+ final_data_display(outcome[11][0]),
+ final_data_display(outcome[11][1])
+ ))
+
+ f1.write(raw_row_template.format(final_data_display(outcome[0][0]),
+ final_data_display(outcome[0][1]),
+ final_data_display(outcome[1][0]),
+ final_data_display(outcome[1][1]),
+ final_data_display(outcome[2][0]),
+ final_data_display(outcome[2][1]),
+ final_data_display(outcome[3][0]),
+ final_data_display(outcome[3][1]),
+ final_data_display(outcome[4][0]),
+ final_data_display(outcome[4][1]),
+ final_data_display(outcome[5][0]),
+ final_data_display(outcome[5][1]),
+ final_data_display(outcome[6][0]),
+ final_data_display(outcome[6][1]),
+ final_data_display(outcome[7][0]),
+ final_data_display(outcome[7][1]),
+ final_data_display(outcome[8][0]),
+ final_data_display(outcome[8][1]),
+ final_data_display(outcome[9][0]),
+ final_data_display(outcome[9][1]),
+ final_data_display(outcome[10][0]),
+ final_data_display(outcome[10][1]),
+ final_data_display(outcome[11][0]),
+ final_data_display(outcome[11][1])
+ ))
+ f.closed
+ f1.closed
+
+
def main(argv):
parser = OptionParser()
parser.add_option("-i", "--inp", dest="inputext", help="extension of output instances", metavar="INP")
Modified: dmcs/branches/dmcs1.5/examples/test/tables.sh
===================================================================
--- dmcs/branches/dmcs1.5/examples/test/tables.sh 2013-01-01 17:15:29 UTC (rev 3315)
+++ dmcs/branches/dmcs1.5/examples/test/tables.sh 2013-01-05 07:42:09 UTC (rev 3316)
@@ -1,18 +1,21 @@
#!/bin/bash
-#TOPOLOGIES="tree diamond zigzag ring"
-TOPOLOGIES="diamond ring"
-INPUTEXT="out1 out2"
+TOPOLOGIES="tree diamond zigzag ring"
+INPUTEXT="out1 out2 out3"
echo "\begin{landscape}" > tables-all.tex
for topo in $TOPOLOGIES ; do
for inputext in $INPUTEXT ; do
- python tables.py --topo=$topo --inp=$inputext
- cat table-$topo-$inputext.tex >> tables-all.tex
- echo "" >> tables-all.tex
- echo "" >> tables-all.tex
- echo "" >> tables-all.tex
+ if [ ! -e config/$topo.$inputext ] ; then
+ echo Configuration $topo.$inputext does not exists. Going to ignore...
+ else
+ python tables.py --topo=$topo --inp=$inputext
+ cat table-$topo-$inputext.tex >> tables-all.tex
+ echo "" >> tables-all.tex
+ echo "" >> tables-all.tex
+ echo "" >> tables-all.tex
+ fi
done
done
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mm...@us...> - 2013-01-01 17:15:42
|
Revision: 3315
http://dmcs.svn.sourceforge.net/dmcs/?rev=3315&view=rev
Author: mmsc
Date: 2013-01-01 17:15:29 +0000 (Tue, 01 Jan 2013)
Log Message:
-----------
Update tree data and output configuration.
Modified Paths:
--------------
dmcs/branches/dmcs1.5/examples/test/data/tree.zip
Added Paths:
-----------
dmcs/branches/dmcs1.5/examples/test/config/tree.out1
dmcs/branches/dmcs1.5/examples/test/config/tree.out2
Added: dmcs/branches/dmcs1.5/examples/test/config/tree.out1
===================================================================
--- dmcs/branches/dmcs1.5/examples/test/config/tree.out1 (rev 0)
+++ dmcs/branches/dmcs1.5/examples/test/config/tree.out1 2013-01-01 17:15:29 UTC (rev 3315)
@@ -0,0 +1,30 @@
+6,7,10,5,5,a
+6,7,10,5,5,b
+6,7,10,5,5,c
+6,7,10,5,5,d
+6,7,10,5,5,e
+6,10,10,5,5,a
+6,10,10,5,5,b
+6,10,10,5,5,c
+6,10,10,5,5,d
+6,10,10,5,5,e
+6,25,10,5,5,a
+6,25,10,5,5,b
+6,25,10,5,5,c
+6,25,10,5,5,d
+6,25,10,5,5,e
+6,31,10,5,5,a
+6,31,10,5,5,b
+6,31,10,5,5,c
+6,31,10,5,5,d
+6,31,10,5,5,e
+6,70,10,5,5,a
+6,70,10,5,5,b
+6,70,10,5,5,c
+6,70,10,5,5,d
+6,70,10,5,5,e
+6,100,10,5,5,a
+6,100,10,5,5,b
+6,100,10,5,5,c
+6,100,10,5,5,d
+6,100,10,5,5,e
Added: dmcs/branches/dmcs1.5/examples/test/config/tree.out2
===================================================================
--- dmcs/branches/dmcs1.5/examples/test/config/tree.out2 (rev 0)
+++ dmcs/branches/dmcs1.5/examples/test/config/tree.out2 2013-01-01 17:15:29 UTC (rev 3315)
@@ -0,0 +1,30 @@
+6,7,20,10,10,a
+6,7,20,10,10,b
+6,7,20,10,10,c
+6,7,20,10,10,d
+6,7,20,10,10,e
+6,10,20,10,10,a
+6,10,20,10,10,b
+6,10,20,10,10,c
+6,10,20,10,10,d
+6,10,20,10,10,e
+6,25,20,10,10,a
+6,25,20,10,10,b
+6,25,20,10,10,c
+6,25,20,10,10,d
+6,25,20,10,10,e
+6,31,20,10,10,a
+6,31,20,10,10,b
+6,31,20,10,10,c
+6,31,20,10,10,d
+6,31,20,10,10,e
+6,70,20,10,10,a
+6,70,20,10,10,b
+6,70,20,10,10,c
+6,70,20,10,10,d
+6,70,20,10,10,e
+6,100,20,10,10,a
+6,100,20,10,10,b
+6,100,20,10,10,c
+6,100,20,10,10,d
+6,100,20,10,10,e
Modified: dmcs/branches/dmcs1.5/examples/test/data/tree.zip
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mm...@us...> - 2012-12-17 09:42:27
|
Revision: 3314
http://dmcs.svn.sourceforge.net/dmcs/?rev=3314&view=rev
Author: mmsc
Date: 2012-12-17 09:42:20 +0000 (Mon, 17 Dec 2012)
Log Message:
-----------
Add experimental data.
Added Paths:
-----------
dmcs/branches/dmcs1.5/examples/test/data/
dmcs/branches/dmcs1.5/examples/test/data/diamond.zip
dmcs/branches/dmcs1.5/examples/test/data/ring.zip
dmcs/branches/dmcs1.5/examples/test/data/tree.zip
dmcs/branches/dmcs1.5/examples/test/data/zigzag.zip
Added: dmcs/branches/dmcs1.5/examples/test/data/diamond.zip
===================================================================
(Binary files differ)
Property changes on: dmcs/branches/dmcs1.5/examples/test/data/diamond.zip
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: dmcs/branches/dmcs1.5/examples/test/data/ring.zip
===================================================================
(Binary files differ)
Property changes on: dmcs/branches/dmcs1.5/examples/test/data/ring.zip
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: dmcs/branches/dmcs1.5/examples/test/data/tree.zip
===================================================================
(Binary files differ)
Property changes on: dmcs/branches/dmcs1.5/examples/test/data/tree.zip
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: dmcs/branches/dmcs1.5/examples/test/data/zigzag.zip
===================================================================
(Binary files differ)
Property changes on: dmcs/branches/dmcs1.5/examples/test/data/zigzag.zip
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mm...@us...> - 2012-12-17 09:36:23
|
Revision: 3313
http://dmcs.svn.sourceforge.net/dmcs/?rev=3313&view=rev
Author: mmsc
Date: 2012-12-17 09:36:16 +0000 (Mon, 17 Dec 2012)
Log Message:
-----------
Add experimental results.
Added Paths:
-----------
dmcs/branches/dmcs1.5/examples/test/output/
dmcs/branches/dmcs1.5/examples/test/output/diamond.zip
dmcs/branches/dmcs1.5/examples/test/output/ring.zip
dmcs/branches/dmcs1.5/examples/test/output/tree.zip
dmcs/branches/dmcs1.5/examples/test/output/zigzag.zip
Added: dmcs/branches/dmcs1.5/examples/test/output/diamond.zip
===================================================================
(Binary files differ)
Property changes on: dmcs/branches/dmcs1.5/examples/test/output/diamond.zip
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: dmcs/branches/dmcs1.5/examples/test/output/ring.zip
===================================================================
(Binary files differ)
Property changes on: dmcs/branches/dmcs1.5/examples/test/output/ring.zip
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: dmcs/branches/dmcs1.5/examples/test/output/tree.zip
===================================================================
(Binary files differ)
Property changes on: dmcs/branches/dmcs1.5/examples/test/output/tree.zip
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: dmcs/branches/dmcs1.5/examples/test/output/zigzag.zip
===================================================================
(Binary files differ)
Property changes on: dmcs/branches/dmcs1.5/examples/test/output/zigzag.zip
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mm...@us...> - 2012-12-10 18:56:21
|
Revision: 3312
http://dmcs.svn.sourceforge.net/dmcs/?rev=3312&view=rev
Author: mmsc
Date: 2012-12-10 18:56:13 +0000 (Mon, 10 Dec 2012)
Log Message:
-----------
Start working on gnuplot scripts.
Modified Paths:
--------------
dmcs/branches/dmcs1.5/examples/test/tables.py
Added Paths:
-----------
dmcs/branches/dmcs1.5/examples/test/opt-wins-nonopt-nonstreaming.gp
Added: dmcs/branches/dmcs1.5/examples/test/opt-wins-nonopt-nonstreaming.gp
===================================================================
--- dmcs/branches/dmcs1.5/examples/test/opt-wins-nonopt-nonstreaming.gp (rev 0)
+++ dmcs/branches/dmcs1.5/examples/test/opt-wins-nonopt-nonstreaming.gp 2012-12-10 18:56:13 UTC (rev 3312)
@@ -0,0 +1,34 @@
+#TODO: decide test cases to be put in this comparison
+
+set term postscript eps enhanced font "Helvetica,16" size 18cm,6cm
+set termoption font "Helvetica,16"
+set out "opt-wins-nonopt-nonstreaming.eps"
+
+set key at 0.5,800
+
+set logscale y
+
+set style data histogram
+set style histogram gap 0
+
+unset xtics
+set xtics nomirror norotate font ",0.01"
+
+set style fill solid border 0
+set style line 1 lc rgb "blue" linewidth -1 linetype 1
+set style line 2 lc rgb "green" linewidth -1 linetype 1
+set style line 3 lc rgb "blue" linewidth -1 linetype 1
+set style line 4 lc rgb "green" linewidth -1 linetype 1
+set style line 5 lc rgb "blue" linewidth -1 linetype 1
+set style line 6 lc rgb "green" linewidth -1 linetype 1
+set style line 7 lc rgb "blue" linewidth -1 linetype 1
+set style line 8 lc rgb "green" linewidth -1 linetype 1
+set style increment user
+
+plot newhistogram "D(4,10,5,5)" lt 1, '../data/diamond-4-10-5-5.dat' using 1 title "DMCS", '' using 3 title "DMCSOPT",\
+ newhistogram "D(7,10,5,5)" lt 1, '../data/diamond-7-10-5-5.dat' using 1 notitle, '' using 3 notitle,\
+ newhistogram "D(10,10,5,5)" lt 1, '../data/diamond-10-10-5-5.dat' using 1 notitle, '' using 3 notitle,\
+ newhistogram "D(13,10,5,5)" lt 1, '../data/diamond-13-10-5-5.dat' using 1 notitle, '' using 3 notitle
+
+!epstopdf opt-wins-nonopt-nonstreaming.eps && rm opt-wins-nonopt-nonstreaming.eps
+exit
\ No newline at end of file
Modified: dmcs/branches/dmcs1.5/examples/test/tables.py
===================================================================
--- dmcs/branches/dmcs1.5/examples/test/tables.py 2012-12-10 11:32:29 UTC (rev 3311)
+++ dmcs/branches/dmcs1.5/examples/test/tables.py 2012-12-10 18:56:13 UTC (rev 3312)
@@ -300,7 +300,7 @@
# which parameter setting we are on now?
instance = current_test_case[0]
test_name = topo + '-' + instance[1] + '-' + instance[2] + '-' + instance[3] + '-' + instance[4]
- path = 'output/' + topo + '/' + test_name
+ path = 'output/' + topo
print path
if not os.path.exists(path):
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mm...@us...> - 2012-12-10 11:32:38
|
Revision: 3311
http://dmcs.svn.sourceforge.net/dmcs/?rev=3311&view=rev
Author: mmsc
Date: 2012-12-10 11:32:29 +0000 (Mon, 10 Dec 2012)
Log Message:
-----------
Also collect raw output for gnuplotting.
Modified Paths:
--------------
dmcs/branches/dmcs1.5/examples/test/tables.py
Modified: dmcs/branches/dmcs1.5/examples/test/tables.py
===================================================================
--- dmcs/branches/dmcs1.5/examples/test/tables.py 2012-12-10 10:18:53 UTC (rev 3310)
+++ dmcs/branches/dmcs1.5/examples/test/tables.py 2012-12-10 11:32:29 UTC (rev 3311)
@@ -255,7 +255,7 @@
mem = topo + '-' + instance[1] + '-' + instance[2] + '-' + instance[3] + '-' + instance[4] + '-' + instance[5]
str_i = '{' + str(i+1) + '}'
- print outcome
+ #print outcome
tex_output.write(tex_row_template.format(mem,
topo_abbr,
@@ -293,7 +293,51 @@
+def build_raw_data(outcomes, sorted_testcases,
+ topo, current_test_case,
+ raw_row_template):
+ # which parameter setting we are on now?
+ instance = current_test_case[0]
+ test_name = topo + '-' + instance[1] + '-' + instance[2] + '-' + instance[3] + '-' + instance[4]
+ path = 'output/' + topo + '/' + test_name
+
+ print path
+ if not os.path.exists(path):
+ print "Make dir " + path
+ os.makedirs(path)
+
+ with open(path + '/' + test_name + '.dat', 'w') as f:
+ for i in range(len(outcomes)):
+ outcome = outcomes[i]
+ f.write(raw_row_template.format(final_display(outcome[0][0]),
+ final_display(outcome[0][1]),
+ final_display(outcome[1][0]),
+ final_display(outcome[1][1]),
+ final_display(outcome[2][0]),
+ final_display(outcome[2][1]),
+ final_display(outcome[3][0]),
+ final_display(outcome[3][1]),
+ final_display(outcome[4][0]),
+ final_display(outcome[4][1]),
+ final_display(outcome[5][0]),
+ final_display(outcome[5][1]),
+ final_display(outcome[6][0]),
+ final_display(outcome[6][1]),
+ final_display(outcome[7][0]),
+ final_display(outcome[7][1]),
+ final_display(outcome[8][0]),
+ final_display(outcome[8][1]),
+ final_display(outcome[9][0]),
+ final_display(outcome[9][1]),
+ final_display(outcome[10][0]),
+ final_display(outcome[10][1]),
+ final_display(outcome[11][0]),
+ final_display(outcome[11][1])
+ ))
+ f.closed
+
+
def main(argv):
parser = OptionParser()
parser.add_option("-i", "--inp", dest="inputext", help="extension of output instances", metavar="INP")
@@ -313,6 +357,12 @@
tex_row_template = t.read()
t.closed
+ # read raw data row template
+ with open('templates/raw_row.tpl', 'r') as raw_row:
+ raw_row_template = raw_row.read()
+ raw_row.closed
+
+
topo_abbreviation = {'diamond' : 'D', 'ring' : 'R', 'tree' : 'T', 'zigzag' : 'Z'}
testpacks = ['all', '1', '10', '100' ]
subdirs = ['', '/all', '/opt_all', '/1', '/opt_1', '/10', '/noloop_10', '/opt_10', '/opt_noloop_10', '/100', '/noloop_100', '/opt_100', '/opt_noloop_100']
@@ -344,6 +394,10 @@
outcomes, sorted_testcases,
topo, topo_abbreviation[topo])
+ build_raw_data(outcomes, sorted_testcases,
+ topo, current_test_case,
+ raw_row_template)
+
#print outcomes
#print "\n"
#print sorted_testcases
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mm...@us...> - 2012-12-10 10:19:03
|
Revision: 3310
http://dmcs.svn.sourceforge.net/dmcs/?rev=3310&view=rev
Author: mmsc
Date: 2012-12-10 10:18:53 +0000 (Mon, 10 Dec 2012)
Log Message:
-----------
Change output ordering.
Modified Paths:
--------------
dmcs/branches/dmcs1.5/examples/test/config/diamond.out1
dmcs/branches/dmcs1.5/examples/test/config/diamond.out2
dmcs/branches/dmcs1.5/examples/test/config/ring.out1
dmcs/branches/dmcs1.5/examples/test/config/ring.out2
dmcs/branches/dmcs1.5/examples/test/listTests.py
Modified: dmcs/branches/dmcs1.5/examples/test/config/diamond.out1
===================================================================
--- dmcs/branches/dmcs1.5/examples/test/config/diamond.out1 2012-12-10 09:57:14 UTC (rev 3309)
+++ dmcs/branches/dmcs1.5/examples/test/config/diamond.out1 2012-12-10 10:18:53 UTC (rev 3310)
@@ -3,28 +3,28 @@
1,4,10,5,5,c
1,4,10,5,5,d
1,4,10,5,5,e
-1,4,20,10,10,a
-1,4,20,10,10,b
-1,4,20,10,10,c
-1,4,20,10,10,d
-1,4,20,10,10,e
1,7,10,5,5,a
1,7,10,5,5,b
1,7,10,5,5,c
1,7,10,5,5,d
1,7,10,5,5,e
-1,7,20,10,10,a
-1,7,20,10,10,b
-1,7,20,10,10,c
-1,7,20,10,10,d
-1,7,20,10,10,e
1,10,10,5,5,a
1,10,10,5,5,b
1,10,10,5,5,c
1,10,10,5,5,d
1,10,10,5,5,e
-1,10,20,10,10,a
-1,10,20,10,10,b
-1,10,20,10,10,c
-1,10,20,10,10,d
-1,10,20,10,10,e
+1,13,10,5,5,a
+1,13,10,5,5,b
+1,13,10,5,5,c
+1,13,10,5,5,d
+1,13,10,5,5,e
+1,25,10,5,5,a
+1,25,10,5,5,b
+1,25,10,5,5,c
+1,25,10,5,5,d
+1,25,10,5,5,e
+1,31,10,5,5,a
+1,31,10,5,5,b
+1,31,10,5,5,c
+1,31,10,5,5,d
+1,31,10,5,5,e
Modified: dmcs/branches/dmcs1.5/examples/test/config/diamond.out2
===================================================================
--- dmcs/branches/dmcs1.5/examples/test/config/diamond.out2 2012-12-10 09:57:14 UTC (rev 3309)
+++ dmcs/branches/dmcs1.5/examples/test/config/diamond.out2 2012-12-10 10:18:53 UTC (rev 3310)
@@ -1,28 +1,28 @@
-1,13,10,5,5,a
-1,13,10,5,5,b
-1,13,10,5,5,c
-1,13,10,5,5,d
-1,13,10,5,5,e
+1,4,20,10,10,a
+1,4,20,10,10,b
+1,4,20,10,10,c
+1,4,20,10,10,d
+1,4,20,10,10,e
+1,7,20,10,10,a
+1,7,20,10,10,b
+1,7,20,10,10,c
+1,7,20,10,10,d
+1,7,20,10,10,e
+1,10,20,10,10,a
+1,10,20,10,10,b
+1,10,20,10,10,c
+1,10,20,10,10,d
+1,10,20,10,10,e
1,13,20,10,10,a
1,13,20,10,10,b
1,13,20,10,10,c
1,13,20,10,10,d
1,13,20,10,10,e
-1,25,10,5,5,a
-1,25,10,5,5,b
-1,25,10,5,5,c
-1,25,10,5,5,d
-1,25,10,5,5,e
1,25,20,10,10,a
1,25,20,10,10,b
1,25,20,10,10,c
1,25,20,10,10,d
1,25,20,10,10,e
-1,31,10,5,5,a
-1,31,10,5,5,b
-1,31,10,5,5,c
-1,31,10,5,5,d
-1,31,10,5,5,e
1,31,20,10,10,a
1,31,20,10,10,b
1,31,20,10,10,c
Modified: dmcs/branches/dmcs1.5/examples/test/config/ring.out1
===================================================================
--- dmcs/branches/dmcs1.5/examples/test/config/ring.out1 2012-12-10 09:57:14 UTC (rev 3309)
+++ dmcs/branches/dmcs1.5/examples/test/config/ring.out1 2012-12-10 10:18:53 UTC (rev 3310)
@@ -3,29 +3,25 @@
4,4,10,5,5,c
4,4,10,5,5,d
4,4,10,5,5,e
-4,4,20,10,10,a
-4,4,20,10,10,b
-4,4,20,10,10,c
-4,4,20,10,10,d
-4,4,20,10,10,e
4,7,10,5,5,a
4,7,10,5,5,b
4,7,10,5,5,c
4,7,10,5,5,d
4,7,10,5,5,e
-4,7,20,10,10,a
-4,7,20,10,10,b
-4,7,20,10,10,c
-4,7,20,10,10,d
-4,7,20,10,10,e
4,10,10,5,5,a
4,10,10,5,5,b
4,10,10,5,5,c
4,10,10,5,5,d
4,10,10,5,5,e
-4,10,20,10,10,a
-4,10,20,10,10,b
-4,10,20,10,10,c
-4,10,20,10,10,d
-4,10,20,10,10,e
+4,13,10,5,5,a
+4,13,10,5,5,b
+4,13,10,5,5,c
+4,13,10,5,5,d
+4,13,10,5,5,e
+4,70,10,5,5,a
+4,70,10,5,5,b
+4,70,10,5,5,c
+4,70,10,5,5,d
+4,70,10,5,5,e
+
Modified: dmcs/branches/dmcs1.5/examples/test/config/ring.out2
===================================================================
--- dmcs/branches/dmcs1.5/examples/test/config/ring.out2 2012-12-10 09:57:14 UTC (rev 3309)
+++ dmcs/branches/dmcs1.5/examples/test/config/ring.out2 2012-12-10 10:18:53 UTC (rev 3310)
@@ -1,18 +1,23 @@
-4,13,10,5,5,a
-4,13,10,5,5,b
-4,13,10,5,5,c
-4,13,10,5,5,d
-4,13,10,5,5,e
+4,4,20,10,10,a
+4,4,20,10,10,b
+4,4,20,10,10,c
+4,4,20,10,10,d
+4,4,20,10,10,e
+4,7,20,10,10,a
+4,7,20,10,10,b
+4,7,20,10,10,c
+4,7,20,10,10,d
+4,7,20,10,10,e
+4,10,20,10,10,a
+4,10,20,10,10,b
+4,10,20,10,10,c
+4,10,20,10,10,d
+4,10,20,10,10,e
4,13,20,10,10,a
4,13,20,10,10,b
4,13,20,10,10,c
4,13,20,10,10,d
4,13,20,10,10,e
-4,70,10,5,5,a
-4,70,10,5,5,b
-4,70,10,5,5,c
-4,70,10,5,5,d
-4,70,10,5,5,e
4,70,20,10,10,a
4,70,20,10,10,b
4,70,20,10,10,c
Modified: dmcs/branches/dmcs1.5/examples/test/listTests.py
===================================================================
--- dmcs/branches/dmcs1.5/examples/test/listTests.py 2012-12-10 09:57:14 UTC (rev 3309)
+++ dmcs/branches/dmcs1.5/examples/test/listTests.py 2012-12-10 10:18:53 UTC (rev 3310)
@@ -3,35 +3,46 @@
import getopt, sys
import optparse
import string
+from optparse import OptionParser
def main(argv):
- toponames = ['diamond', 'tree', 'zigzag', 'ring']
- topo_ids = [ 1, 6, 3, 4 ]
- system_sizes = [[4], # diamond
- [4], # tree
- [4], # zigzag
- [4] # ring
- ]
+ parser = OptionParser()
+ parser.add_option("-e", "--ext", dest="extension",
+ help="write configuration with extension EXT", metavar="EXT")
- toponames = ['diamond']
- topo_ids = [ 1, 6, 3, 4 ]
- system_sizes = [[4], # diamond
- [4], # tree
- [4], # zigzag
- [4] # ring
- ]
+ (options, args) = parser.parse_args()
- no_atoms = [9 ]
- no_interface = [ 5 ]
- no_bridgerules = [ 5 ]
- instances = [ 'a', 'b' ]
+ extension = options.extension
+
+ #toponames = ['diamond', 'tree', 'zigzag', 'ring']
+ #topo_ids = [ 1, 6, 3, 4 ]
+ #system_sizes = [[4], # diamond
+ # [4], # tree
+ # [4], # zigzag
+ # [4] # ring
+ # ]
+
+ toponames = ['ring']
+ topo_ids = [ 4 ]
+ system_sizes = [[4, 7, 10, 13, 70]]
+
+ #toponames = ['diamond']
+ #topo_ids = [ 1 ]
+ #system_sizes = [[4, 7, 10, 13, 25, 31]]
+
+
+ no_atoms = [ 10, 20 ]
+ no_interface = [ 5, 10 ]
+ no_bridgerules = [ 5, 10 ]
#instances = [ 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j' ]
+ instances = [ 'a', 'b', 'c', 'd', 'e' ]
+
for i in range(0,len(toponames)):
- filename = 'config/' + toponames[i] + '.cfg'
+ filename = 'config/' + toponames[i] + '.' + extension
with open(filename, 'w') as f:
- for j in range(0,len(system_sizes[i])):
- for k in range(0,len(no_atoms)):
+ for k in range(0,len(no_atoms)):
+ for j in range(0,len(system_sizes[i])):
for ins in range(0,len(instances)):
tmp = str(topo_ids[i]) + ',' + str(system_sizes[i][j]) + ',' + str(no_atoms[k]) + ',' + str(no_interface[k]) + ',' + str(no_bridgerules[k]) + ',' + instances[ins] + '\n'
f.write(tmp)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mm...@us...> - 2012-12-10 09:57:20
|
Revision: 3309
http://dmcs.svn.sourceforge.net/dmcs/?rev=3309&view=rev
Author: mmsc
Date: 2012-12-10 09:57:14 +0000 (Mon, 10 Dec 2012)
Log Message:
-----------
Add script to create all tables.
Added Paths:
-----------
dmcs/branches/dmcs1.5/examples/test/tables.sh
Added: dmcs/branches/dmcs1.5/examples/test/tables.sh
===================================================================
--- dmcs/branches/dmcs1.5/examples/test/tables.sh (rev 0)
+++ dmcs/branches/dmcs1.5/examples/test/tables.sh 2012-12-10 09:57:14 UTC (rev 3309)
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+#TOPOLOGIES="tree diamond zigzag ring"
+TOPOLOGIES="diamond ring"
+INPUTEXT="out1 out2"
+
+echo "\begin{landscape}" > tables-all.tex
+
+for topo in $TOPOLOGIES ; do
+ for inputext in $INPUTEXT ; do
+ python tables.py --topo=$topo --inp=$inputext
+ cat table-$topo-$inputext.tex >> tables-all.tex
+ echo "" >> tables-all.tex
+ echo "" >> tables-all.tex
+ echo "" >> tables-all.tex
+ done
+done
+
+echo "\end{landscape}" >> tables-all.tex
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mm...@us...> - 2012-12-10 09:45:12
|
Revision: 3308
http://dmcs.svn.sourceforge.net/dmcs/?rev=3308&view=rev
Author: mmsc
Date: 2012-12-10 09:45:03 +0000 (Mon, 10 Dec 2012)
Log Message:
-----------
Update ouput collecting script.
Modified Paths:
--------------
dmcs/branches/dmcs1.5/examples/test/genTest.sh
dmcs/branches/dmcs1.5/examples/test/tables.py
dmcs/branches/dmcs1.5/examples/test/templates/tex_footer.tpl
Added Paths:
-----------
dmcs/branches/dmcs1.5/examples/test/config/
dmcs/branches/dmcs1.5/examples/test/config/diamond.cfg
dmcs/branches/dmcs1.5/examples/test/config/diamond.out1
dmcs/branches/dmcs1.5/examples/test/config/diamond.out2
dmcs/branches/dmcs1.5/examples/test/config/ring.cfg
dmcs/branches/dmcs1.5/examples/test/config/ring.out1
dmcs/branches/dmcs1.5/examples/test/config/ring.out2
dmcs/branches/dmcs1.5/examples/test/config/zigzag.cfg
Added: dmcs/branches/dmcs1.5/examples/test/config/diamond.cfg
===================================================================
--- dmcs/branches/dmcs1.5/examples/test/config/diamond.cfg (rev 0)
+++ dmcs/branches/dmcs1.5/examples/test/config/diamond.cfg 2012-12-10 09:45:03 UTC (rev 3308)
@@ -0,0 +1,60 @@
+1,4,10,5,5,a
+1,4,10,5,5,b
+1,4,10,5,5,c
+1,4,10,5,5,d
+1,4,10,5,5,e
+1,4,20,10,10,a
+1,4,20,10,10,b
+1,4,20,10,10,c
+1,4,20,10,10,d
+1,4,20,10,10,e
+1,7,10,5,5,a
+1,7,10,5,5,b
+1,7,10,5,5,c
+1,7,10,5,5,d
+1,7,10,5,5,e
+1,7,20,10,10,a
+1,7,20,10,10,b
+1,7,20,10,10,c
+1,7,20,10,10,d
+1,7,20,10,10,e
+1,10,10,5,5,a
+1,10,10,5,5,b
+1,10,10,5,5,c
+1,10,10,5,5,d
+1,10,10,5,5,e
+1,10,20,10,10,a
+1,10,20,10,10,b
+1,10,20,10,10,c
+1,10,20,10,10,d
+1,10,20,10,10,e
+1,13,10,5,5,a
+1,13,10,5,5,b
+1,13,10,5,5,c
+1,13,10,5,5,d
+1,13,10,5,5,e
+1,13,20,10,10,a
+1,13,20,10,10,b
+1,13,20,10,10,c
+1,13,20,10,10,d
+1,13,20,10,10,e
+1,25,10,5,5,a
+1,25,10,5,5,b
+1,25,10,5,5,c
+1,25,10,5,5,d
+1,25,10,5,5,e
+1,25,20,10,10,a
+1,25,20,10,10,b
+1,25,20,10,10,c
+1,25,20,10,10,d
+1,25,20,10,10,e
+1,31,10,5,5,a
+1,31,10,5,5,b
+1,31,10,5,5,c
+1,31,10,5,5,d
+1,31,10,5,5,e
+1,31,20,10,10,a
+1,31,20,10,10,b
+1,31,20,10,10,c
+1,31,20,10,10,d
+1,31,20,10,10,e
Added: dmcs/branches/dmcs1.5/examples/test/config/diamond.out1
===================================================================
--- dmcs/branches/dmcs1.5/examples/test/config/diamond.out1 (rev 0)
+++ dmcs/branches/dmcs1.5/examples/test/config/diamond.out1 2012-12-10 09:45:03 UTC (rev 3308)
@@ -0,0 +1,30 @@
+1,4,10,5,5,a
+1,4,10,5,5,b
+1,4,10,5,5,c
+1,4,10,5,5,d
+1,4,10,5,5,e
+1,4,20,10,10,a
+1,4,20,10,10,b
+1,4,20,10,10,c
+1,4,20,10,10,d
+1,4,20,10,10,e
+1,7,10,5,5,a
+1,7,10,5,5,b
+1,7,10,5,5,c
+1,7,10,5,5,d
+1,7,10,5,5,e
+1,7,20,10,10,a
+1,7,20,10,10,b
+1,7,20,10,10,c
+1,7,20,10,10,d
+1,7,20,10,10,e
+1,10,10,5,5,a
+1,10,10,5,5,b
+1,10,10,5,5,c
+1,10,10,5,5,d
+1,10,10,5,5,e
+1,10,20,10,10,a
+1,10,20,10,10,b
+1,10,20,10,10,c
+1,10,20,10,10,d
+1,10,20,10,10,e
Added: dmcs/branches/dmcs1.5/examples/test/config/diamond.out2
===================================================================
--- dmcs/branches/dmcs1.5/examples/test/config/diamond.out2 (rev 0)
+++ dmcs/branches/dmcs1.5/examples/test/config/diamond.out2 2012-12-10 09:45:03 UTC (rev 3308)
@@ -0,0 +1,30 @@
+1,13,10,5,5,a
+1,13,10,5,5,b
+1,13,10,5,5,c
+1,13,10,5,5,d
+1,13,10,5,5,e
+1,13,20,10,10,a
+1,13,20,10,10,b
+1,13,20,10,10,c
+1,13,20,10,10,d
+1,13,20,10,10,e
+1,25,10,5,5,a
+1,25,10,5,5,b
+1,25,10,5,5,c
+1,25,10,5,5,d
+1,25,10,5,5,e
+1,25,20,10,10,a
+1,25,20,10,10,b
+1,25,20,10,10,c
+1,25,20,10,10,d
+1,25,20,10,10,e
+1,31,10,5,5,a
+1,31,10,5,5,b
+1,31,10,5,5,c
+1,31,10,5,5,d
+1,31,10,5,5,e
+1,31,20,10,10,a
+1,31,20,10,10,b
+1,31,20,10,10,c
+1,31,20,10,10,d
+1,31,20,10,10,e
Added: dmcs/branches/dmcs1.5/examples/test/config/ring.cfg
===================================================================
--- dmcs/branches/dmcs1.5/examples/test/config/ring.cfg (rev 0)
+++ dmcs/branches/dmcs1.5/examples/test/config/ring.cfg 2012-12-10 09:45:03 UTC (rev 3308)
@@ -0,0 +1,50 @@
+4,4,10,5,5,a
+4,4,10,5,5,b
+4,4,10,5,5,c
+4,4,10,5,5,d
+4,4,10,5,5,e
+4,4,20,10,10,a
+4,4,20,10,10,b
+4,4,20,10,10,c
+4,4,20,10,10,d
+4,4,20,10,10,e
+4,7,10,5,5,a
+4,7,10,5,5,b
+4,7,10,5,5,c
+4,7,10,5,5,d
+4,7,10,5,5,e
+4,7,20,10,10,a
+4,7,20,10,10,b
+4,7,20,10,10,c
+4,7,20,10,10,d
+4,7,20,10,10,e
+4,10,10,5,5,a
+4,10,10,5,5,b
+4,10,10,5,5,c
+4,10,10,5,5,d
+4,10,10,5,5,e
+4,10,20,10,10,a
+4,10,20,10,10,b
+4,10,20,10,10,c
+4,10,20,10,10,d
+4,10,20,10,10,e
+4,13,10,5,5,a
+4,13,10,5,5,b
+4,13,10,5,5,c
+4,13,10,5,5,d
+4,13,10,5,5,e
+4,13,20,10,10,a
+4,13,20,10,10,b
+4,13,20,10,10,c
+4,13,20,10,10,d
+4,13,20,10,10,e
+4,70,10,5,5,a
+4,70,10,5,5,b
+4,70,10,5,5,c
+4,70,10,5,5,d
+4,70,10,5,5,e
+4,70,20,10,10,a
+4,70,20,10,10,b
+4,70,20,10,10,c
+4,70,20,10,10,d
+4,70,20,10,10,e
\ No newline at end of file
Added: dmcs/branches/dmcs1.5/examples/test/config/ring.out1
===================================================================
--- dmcs/branches/dmcs1.5/examples/test/config/ring.out1 (rev 0)
+++ dmcs/branches/dmcs1.5/examples/test/config/ring.out1 2012-12-10 09:45:03 UTC (rev 3308)
@@ -0,0 +1,31 @@
+4,4,10,5,5,a
+4,4,10,5,5,b
+4,4,10,5,5,c
+4,4,10,5,5,d
+4,4,10,5,5,e
+4,4,20,10,10,a
+4,4,20,10,10,b
+4,4,20,10,10,c
+4,4,20,10,10,d
+4,4,20,10,10,e
+4,7,10,5,5,a
+4,7,10,5,5,b
+4,7,10,5,5,c
+4,7,10,5,5,d
+4,7,10,5,5,e
+4,7,20,10,10,a
+4,7,20,10,10,b
+4,7,20,10,10,c
+4,7,20,10,10,d
+4,7,20,10,10,e
+4,10,10,5,5,a
+4,10,10,5,5,b
+4,10,10,5,5,c
+4,10,10,5,5,d
+4,10,10,5,5,e
+4,10,20,10,10,a
+4,10,20,10,10,b
+4,10,20,10,10,c
+4,10,20,10,10,d
+4,10,20,10,10,e
+
Added: dmcs/branches/dmcs1.5/examples/test/config/ring.out2
===================================================================
--- dmcs/branches/dmcs1.5/examples/test/config/ring.out2 (rev 0)
+++ dmcs/branches/dmcs1.5/examples/test/config/ring.out2 2012-12-10 09:45:03 UTC (rev 3308)
@@ -0,0 +1,20 @@
+4,13,10,5,5,a
+4,13,10,5,5,b
+4,13,10,5,5,c
+4,13,10,5,5,d
+4,13,10,5,5,e
+4,13,20,10,10,a
+4,13,20,10,10,b
+4,13,20,10,10,c
+4,13,20,10,10,d
+4,13,20,10,10,e
+4,70,10,5,5,a
+4,70,10,5,5,b
+4,70,10,5,5,c
+4,70,10,5,5,d
+4,70,10,5,5,e
+4,70,20,10,10,a
+4,70,20,10,10,b
+4,70,20,10,10,c
+4,70,20,10,10,d
+4,70,20,10,10,e
Added: dmcs/branches/dmcs1.5/examples/test/config/zigzag.cfg
===================================================================
--- dmcs/branches/dmcs1.5/examples/test/config/zigzag.cfg (rev 0)
+++ dmcs/branches/dmcs1.5/examples/test/config/zigzag.cfg 2012-12-10 09:45:03 UTC (rev 3308)
@@ -0,0 +1,70 @@
+3,4,10,5,5,a
+3,4,10,5,5,b
+3,4,10,5,5,c
+3,4,10,5,5,d
+3,4,10,5,5,e
+3,4,20,10,10,a
+3,4,20,10,10,b
+3,4,20,10,10,c
+3,4,20,10,10,d
+3,4,20,10,10,e
+3,7,10,5,5,a
+3,7,10,5,5,b
+3,7,10,5,5,c
+3,7,10,5,5,d
+3,7,10,5,5,e
+3,7,20,10,10,a
+3,7,20,10,10,b
+3,7,20,10,10,c
+3,7,20,10,10,d
+3,7,20,10,10,e
+3,10,10,5,5,a
+3,10,10,5,5,b
+3,10,10,5,5,c
+3,10,10,5,5,d
+3,10,10,5,5,e
+3,10,20,10,10,a
+3,10,20,10,10,b
+3,10,20,10,10,c
+3,10,20,10,10,d
+3,10,20,10,10,e
+3,13,10,5,5,a
+3,13,10,5,5,b
+3,13,10,5,5,c
+3,13,10,5,5,d
+3,13,10,5,5,e
+3,13,20,10,10,a
+3,13,20,10,10,b
+3,13,20,10,10,c
+3,13,20,10,10,d
+3,13,20,10,10,e
+3,25,10,5,5,a
+3,25,10,5,5,b
+3,25,10,5,5,c
+3,25,10,5,5,d
+3,25,10,5,5,e
+3,25,20,10,10,a
+3,25,20,10,10,b
+3,25,20,10,10,c
+3,25,20,10,10,d
+3,25,20,10,10,e
+3,31,10,5,5,a
+3,31,10,5,5,b
+3,31,10,5,5,c
+3,31,10,5,5,d
+3,31,10,5,5,e
+3,31,20,10,10,a
+3,31,20,10,10,b
+3,31,20,10,10,c
+3,31,20,10,10,d
+3,31,20,10,10,e
+3,70,10,5,5,a
+3,70,10,5,5,b
+3,70,10,5,5,c
+3,70,10,5,5,d
+3,70,10,5,5,e
+3,70,20,10,10,a
+3,70,20,10,10,b
+3,70,20,10,10,c
+3,70,20,10,10,d
+3,70,20,10,10,e
Modified: dmcs/branches/dmcs1.5/examples/test/genTest.sh
===================================================================
--- dmcs/branches/dmcs1.5/examples/test/genTest.sh 2012-12-04 18:15:13 UTC (rev 3307)
+++ dmcs/branches/dmcs1.5/examples/test/genTest.sh 2012-12-10 09:45:03 UTC (rev 3308)
@@ -93,7 +93,7 @@
createSubDir config
createSubDir data
-python listTests.py
+python listTests.py --ext=cfg
for topofile in `ls config/*.cfg` ; do
length=${#topofile}
Modified: dmcs/branches/dmcs1.5/examples/test/tables.py
===================================================================
--- dmcs/branches/dmcs1.5/examples/test/tables.py 2012-12-04 18:15:13 UTC (rev 3307)
+++ dmcs/branches/dmcs1.5/examples/test/tables.py 2012-12-10 09:45:03 UTC (rev 3308)
@@ -5,8 +5,8 @@
import string
import re
import os
+from optparse import OptionParser
-
def get_running_time(log_time):
# Watchout: we only expect time of the form MM:SS.SS
str_time = 'Notime'
@@ -142,22 +142,38 @@
return True
+def compare(outcome1, outcome2):
+ val1 = float(outcome1[0][0])
+ val2 = float(outcome2[0][0])
+ if (val1 > val2):
+ return 1
+ elif (val1 < val2):
+ return -1
+ else: # val1 == val2
+ val1 = float(outcome1[1][0])
+ val2 = float(outcome2[1][0])
+ if (val1 > val2):
+ return 1
+ elif (val1 < val2):
+ return -1
+
+ return 0
+
def ordered_push(outcomes, outcome, sorted_testcases, testcase):
if outcomes == []:
outcomes.append(outcome)
sorted_testcases.append(testcase)
else:
i = 0
- new_val = float(outcome[0][0])
found = False
while i < len(outcomes):
- old_val = float(outcomes[i][0][0])
- i = i + 1
- if old_val > new_val:
+ if compare(outcomes[i], outcome) == 1:
+ i = i + 1
found = True
break
+ i = i + 1
if found == True:
outcomes.insert(i-1, outcome)
@@ -252,8 +268,8 @@
final_display(outcome[0][1]),
final_display(outcome[1][0]),
final_display(outcome[1][1]),
- nice_display(outcome[2][0], outcome[2][1]),
- nice_display(outcome[3][0], outcome[3][1]),
+ final_display(outcome[2][0]),
+ final_display(outcome[3][0]),
final_display(outcome[4][0]),
outcome[4][1],
nice_display(outcome[5][0], outcome[5][1]),
@@ -268,9 +284,28 @@
nice_display(outcome[11][0], outcome[11][1])))
+
+
+def build_footer(tex_output, topo, inputext):
+ with open('templates/tex_footer.tpl') as f:
+ for line in f.readlines():
+ tex_output.write(line.format(topo + '-' + inputext))
+
+
+
+
def main(argv):
+ parser = OptionParser()
+ parser.add_option("-i", "--inp", dest="inputext", help="extension of output instances", metavar="INP")
+ parser.add_option("-t", "--topo", dest="topology", help="topology to create table", metavar="TOPO")
+
+ (options, args) = parser.parse_args()
+
+ topo = options.topology
+ inputext = options.inputext
+
# copy header
- tex_output = open('./table.tex', 'w')
+ tex_output = open('./table-' + topo + '-' + inputext + '.tex', 'w')
copy_text(tex_output, 'templates/tex_header.tpl')
# read row template
@@ -279,50 +314,48 @@
t.closed
topo_abbreviation = {'diamond' : 'D', 'ring' : 'R', 'tree' : 'T', 'zigzag' : 'Z'}
- #topologies = ['diamond', 'ring', 'tree', 'zigzag']
- topologies = ['ring']
testpacks = ['all', '1', '10', '100' ]
subdirs = ['', '/all', '/opt_all', '/1', '/opt_1', '/10', '/noloop_10', '/opt_10', '/opt_noloop_10', '/100', '/noloop_100', '/opt_100', '/opt_noloop_100']
- for topo in topologies:
- filename = 'config/' + topo + '.out'
- with open(filename, 'r') as config_file:
- line = config_file.readline()
- line = line[:len(line)-1]
- current_instance = re.split(',', line)
- current_test_case = [current_instance]
- while True:
- while True:
- line = config_file.readline()
- if line == "":
- break
- line = line[:len(line)-1]
- current_instance = re.split(',', line)
- if instance_compare(current_instance, current_test_case[0]) == 0:
- current_test_case.append(current_instance)
- else:
- break
+ filename = 'config/' + topo + '.' + inputext
+ with open(filename, 'r') as config_file:
+ line = config_file.readline()
+ line = line[:len(line)-1]
+ current_instance = re.split(',', line)
+ current_test_case = [current_instance]
+ while True:
- outcomes, sorted_testcases = process_test_cases(topo, testpacks, current_test_case)
+ while True:
+ line = config_file.readline()
+ if line == "":
+ break
+ line = line[:len(line)-1]
+ current_instance = re.split(',', line)
+ if instance_compare(current_instance, current_test_case[0]) == 0:
+ current_test_case.append(current_instance)
+ else:
+ break
- if outcomes != []:
- build_row(tex_output, tex_row_template,
- outcomes, sorted_testcases,
- topo, topo_abbreviation[topo])
+ outcomes, sorted_testcases = process_test_cases(topo, testpacks, current_test_case)
+
+ if outcomes != []:
+ build_row(tex_output, tex_row_template,
+ outcomes, sorted_testcases,
+ topo, topo_abbreviation[topo])
- #print outcomes
- #print "\n"
- #print sorted_testcases
- #print "\n"
+ #print outcomes
+ #print "\n"
+ #print sorted_testcases
+ #print "\n"
- if line == "":
- break
+ if line == "":
+ break
- current_test_case = [current_instance]
- config_file.closed
+ current_test_case = [current_instance]
+ config_file.closed
- copy_text(tex_output, 'templates/tex_footer.tpl')
+ build_footer(tex_output, topo, inputext)
tex_output.closed
if __name__ == "__main__":
Modified: dmcs/branches/dmcs1.5/examples/test/templates/tex_footer.tpl
===================================================================
--- dmcs/branches/dmcs1.5/examples/test/templates/tex_footer.tpl 2012-12-04 18:15:13 UTC (rev 3307)
+++ dmcs/branches/dmcs1.5/examples/test/templates/tex_footer.tpl 2012-12-10 09:45:03 UTC (rev 3308)
@@ -1,7 +1,7 @@
\bottomrule
-\end{tabular}
-%\vspace{-.2cm}
-\caption{Runtime in secs, timeout 600 secs (---)}
-\label{tab:simple-timings}
-\vspace{-.5cm}
-\end{table}
\ No newline at end of file
+\end{{tabular}}
+%\vspace{{-.2cm}}
+\caption{{Runtime in secs, timeout 600 secs (---)}}
+\label{{tab:{0}-timings}}
+\vspace{{-.5cm}}
+\end{{table}}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mm...@us...> - 2012-12-04 18:15:24
|
Revision: 3307
http://dmcs.svn.sourceforge.net/dmcs/?rev=3307&view=rev
Author: mmsc
Date: 2012-12-04 18:15:13 +0000 (Tue, 04 Dec 2012)
Log Message:
-----------
Remove some printing.
Modified Paths:
--------------
dmcs/branches/dmcs1.5/examples/test/tables.py
Modified: dmcs/branches/dmcs1.5/examples/test/tables.py
===================================================================
--- dmcs/branches/dmcs1.5/examples/test/tables.py 2012-12-04 18:12:29 UTC (rev 3306)
+++ dmcs/branches/dmcs1.5/examples/test/tables.py 2012-12-04 18:15:13 UTC (rev 3307)
@@ -132,14 +132,10 @@
def complete_test_case(dirname, subdirs):
- print "Check dir = " + dirname
- print "subdirs = "
- print subdirs
if os.path.exists(dirname) == False:
return False
for subdir in subdirs:
- print "Check subdir = " + subdir
if os.path.exists(dirname + subdir) == False:
return False
@@ -186,8 +182,6 @@
test_runs.append('/opt_noloop_' + p)
test_runs.append('/opt_' + p)
- print test_runs
-
for instance in current_test_case:
dirname = 'output/' + toponame + '/' + toponame + '-' + instance[1] + '-' + instance[2] + '-' + instance[3] + '-' + instance[4] + '-' + instance[5]
if complete_test_case(dirname, test_runs):
@@ -196,8 +190,6 @@
outcome.append(get_outcome(toponame, dirname + r))
ordered_push(outcomes, outcome, sorted_testcases, instance)
- else:
- print "directory not complete for toponame = " + toponame
return outcomes, sorted_testcases
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mm...@us...> - 2012-12-04 18:12:43
|
Revision: 3306
http://dmcs.svn.sourceforge.net/dmcs/?rev=3306&view=rev
Author: mmsc
Date: 2012-12-04 18:12:29 +0000 (Tue, 04 Dec 2012)
Log Message:
-----------
Update table script.
Modified Paths:
--------------
dmcs/branches/dmcs1.5/examples/test/tables.py
dmcs/branches/dmcs1.5/examples/test/templates/tex_header.tpl
dmcs/branches/dmcs1.5/examples/test/templates/tex_row.tpl
Modified: dmcs/branches/dmcs1.5/examples/test/tables.py
===================================================================
--- dmcs/branches/dmcs1.5/examples/test/tables.py 2012-12-04 15:53:28 UTC (rev 3305)
+++ dmcs/branches/dmcs1.5/examples/test/tables.py 2012-12-04 18:12:29 UTC (rev 3306)
@@ -132,10 +132,14 @@
def complete_test_case(dirname, subdirs):
+ print "Check dir = " + dirname
+ print "subdirs = "
+ print subdirs
if os.path.exists(dirname) == False:
return False
for subdir in subdirs:
+ print "Check subdir = " + subdir
if os.path.exists(dirname + subdir) == False:
return False
@@ -169,14 +173,21 @@
def process_test_cases(toponame, testpacks, current_test_case):
- outcomes = [ ]
+ outcomes = []
sorted_testcases = []
test_runs = []
for p in testpacks:
+ if (p != 'all') and (p != '1'):
+ test_runs.append('/noloop_' + p)
test_runs.append('/' + p)
+
+ if (p != 'all') and (p != '1'):
+ test_runs.append('/opt_noloop_' + p)
test_runs.append('/opt_' + p)
+ print test_runs
+
for instance in current_test_case:
dirname = 'output/' + toponame + '/' + toponame + '-' + instance[1] + '-' + instance[2] + '-' + instance[3] + '-' + instance[4] + '-' + instance[5]
if complete_test_case(dirname, test_runs):
@@ -185,6 +196,8 @@
outcome.append(get_outcome(toponame, dirname + r))
ordered_push(outcomes, outcome, sorted_testcases, instance)
+ else:
+ print "directory not complete for toponame = " + toponame
return outcomes, sorted_testcases
@@ -208,7 +221,19 @@
else:
return time
+def combined_display(time, val):
+ if time == '1000124':
+ return '(' + val + ')'
+ elif time == '10001':
+ return 'E'
+ else:
+ blank_count = 4 - len(val)
+ blanks = ''
+ for i in range(blank_count):
+ blanks = blanks + '\ '
+ return time + blanks + '(' + val + ')'
+
def build_row(tex_output, tex_row_template,
outcomes, sorted_testcases,
topo, topo_abbr):
@@ -237,10 +262,18 @@
final_display(outcome[1][1]),
nice_display(outcome[2][0], outcome[2][1]),
nice_display(outcome[3][0], outcome[3][1]),
- nice_display(outcome[4][0], outcome[4][1]),
+ final_display(outcome[4][0]),
+ outcome[4][1],
nice_display(outcome[5][0], outcome[5][1]),
- nice_display(outcome[6][0], outcome[6][1]),
- nice_display(outcome[7][0], outcome[7][1])))
+ final_display(outcome[6][0]),
+ outcome[6][1],
+ nice_display(outcome[7][0], outcome[7][1]),
+ final_display(outcome[8][0]),
+ outcome[8][1],
+ nice_display(outcome[9][0], outcome[9][1]),
+ final_display(outcome[10][0]),
+ outcome[10][1],
+ nice_display(outcome[11][0], outcome[11][1])))
def main(argv):
@@ -255,12 +288,12 @@
topo_abbreviation = {'diamond' : 'D', 'ring' : 'R', 'tree' : 'T', 'zigzag' : 'Z'}
#topologies = ['diamond', 'ring', 'tree', 'zigzag']
- topologies = ['diamond']
+ topologies = ['ring']
testpacks = ['all', '1', '10', '100' ]
- subdirs = ['', '/all', '/opt_all', '/1', '/opt_1', '/10', '/opt_10', '/100', '/opt_100']
+ subdirs = ['', '/all', '/opt_all', '/1', '/opt_1', '/10', '/noloop_10', '/opt_10', '/opt_noloop_10', '/100', '/noloop_100', '/opt_100', '/opt_noloop_100']
for topo in topologies:
- filename = 'config/' + topo + '.cfg'
+ filename = 'config/' + topo + '.out'
with open(filename, 'r') as config_file:
line = config_file.readline()
line = line[:len(line)-1]
Modified: dmcs/branches/dmcs1.5/examples/test/templates/tex_header.tpl
===================================================================
--- dmcs/branches/dmcs1.5/examples/test/templates/tex_header.tpl 2012-12-04 15:53:28 UTC (rev 3305)
+++ dmcs/branches/dmcs1.5/examples/test/templates/tex_header.tpl 2012-12-04 18:12:29 UTC (rev 3306)
@@ -1,23 +1,35 @@
\begin{table}[t]
-\footnotesize
+\scriptsize
\centering
-\begin{tabular}{@{~}lr@{~~~~~~}r@{~~~~~~}r@{~~~~~~~}r@{~~~~~~}r@{~~~~~~}r@{~~~~~~}r@{~~~~~~~}r@{~~~~~~}r@{~~~~~~}r@{~}}
+\begin{tabular}{@{~}lr@{~~~~~}r@{~~~~}r@{~~~~~}r@{~~~~}r@{~~~~}r@{~~~~}r@{~~~~}rr@{~~~~}rr@{~~~~}r@{~~~~}rr@{~~~~}r@{~~~~}rr@{~~~~}r@{~}}
\toprule %\\[-7pt]
\rule{0pt}{10pt} \\[-1.2em]
\multicolumn{1}{l}{\textbf{Topo / Parameter}~~~} &
\multicolumn{2}{c}{\textbf{$\DMCS$}} &
\multicolumn{2}{c}{\textbf{$\DMCSOPT$}} &
-\multicolumn{6}{c}{\textbf{$\DMCSSTREAMING$}}\\[0.2em]
+\multicolumn{14}{c}{\textbf{$\DMCSSTREAMING$}}\\[0.2em]
-\cline{2-11}\\[-0.8em]
+\cline{2-19}\\[-0.8em]
& time & \# & time & \# &
\multicolumn{2}{c}{$k=1$} &
-\multicolumn{2}{c}{$k=10$} &
-\multicolumn{2}{c}{$k=100$} \\
+\multicolumn{6}{c}{$k=10$} &
+\multicolumn{6}{c}{$k=100$} \\
-\cline{6-11}\\[-0.8em]
+\cline{6-19}\\[-0.8em]
-& & & & & ORIG & OPT & ORIG & OPT & ORIG & OPT \\
+& & & & & ORIG & OPT &
+\multicolumn{3}{c}{ORIG} &
+\multicolumn{3}{c}{OPT} &
+\multicolumn{3}{c}{ORIG} &
+\multicolumn{3}{c}{OPT} \\
-\midrule
\ No newline at end of file
+\cline{8-19}\\[-0.8em]
+
+& & & & & & &
+1st & \# & All &
+1st & \# & All &
+1st & \# & All &
+1st & \# & All \\
+
+\midrule\rule{0pt}{1pt} \\[-0.9em]\rule{0pt}{1pt} \\[-0.9em]
\ No newline at end of file
Modified: dmcs/branches/dmcs1.5/examples/test/templates/tex_row.tpl
===================================================================
--- dmcs/branches/dmcs1.5/examples/test/templates/tex_row.tpl 2012-12-04 15:53:28 UTC (rev 3305)
+++ dmcs/branches/dmcs1.5/examples/test/templates/tex_row.tpl 2012-12-04 18:12:29 UTC (rev 3306)
@@ -1,2 +1,2 @@
%{0}
-${1}_{2} ~/~ ({3},{4},{5},{6})$ & {7} & {8} & {9} & {10} & {11} & {12} & {13} & {14} & {15} & {16}\\
+${1}_{2} ~/~ ({3},{4},{5},{6})$ & {7} & {8} & {9} & {10} & {11} & {12} & {13} & {14} & {15} & {16} & {17} & {18} & {19} & {20} & {21} & {22} & {23} & {24}\\
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mm...@us...> - 2012-12-04 15:53:40
|
Revision: 3305
http://dmcs.svn.sourceforge.net/dmcs/?rev=3305&view=rev
Author: mmsc
Date: 2012-12-04 15:53:28 +0000 (Tue, 04 Dec 2012)
Log Message:
-----------
Add a simple caching.
Modified Paths:
--------------
dmcs/branches/dmcs1.5/include/mcs/NewContext.h
dmcs/branches/dmcs1.5/src/mcs/CycleBreaker.cpp
dmcs/branches/dmcs1.5/src/mcs/NewContext.cpp
dmcs/branches/dmcs1.5/src/mcs/NormalContext.cpp
Modified: dmcs/branches/dmcs1.5/include/mcs/NewContext.h
===================================================================
--- dmcs/branches/dmcs1.5/include/mcs/NewContext.h 2012-12-04 11:13:39 UTC (rev 3304)
+++ dmcs/branches/dmcs1.5/include/mcs/NewContext.h 2012-12-04 15:53:28 UTC (rev 3305)
@@ -34,6 +34,7 @@
#include "dmcs/Instantiator.h"
#include "mcs/BeliefTable.h"
#include "mcs/BridgeRuleEvaluator.h"
+#include "mcs/CachePosition.h"
#include "mcs/QueryPlan.h"
#include "network/RequestDispatcher.h"
#include "mcs/StreamingJoiner.h"
@@ -70,12 +71,17 @@
NewBeliefState*
next_guess(NewBeliefState* current_guess,
NewBeliefState* guessing_input);
+
+ NewBeliefState*
+ jump_guess(NewBeliefState* guessing_input,
+ std::size_t step);
bool
compute(NewBeliefState* input,
std::size_t& k1,
std::size_t& k2,
std::size_t parent_qid,
+ std::size_t current_step,
EvaluatorPtr eval,
NewConcurrentMessageDispatcherPtr md);
@@ -87,6 +93,7 @@
bool
read_and_send_k1_k2(std::size_t parent_qid,
+ std::size_t current_step,
bool normal_solve,
std::size_t& k1,
std::size_t& k2,
@@ -103,6 +110,7 @@
protected:
std::size_t ctx_id;
std::size_t ctx_offset;
+ CachePosition cache;
ReturnPlanMapPtr return_plan;
ContextQueryPlanMapPtr queryplan_map;
BridgeRuleTablePtr bridge_rules;
Modified: dmcs/branches/dmcs1.5/src/mcs/CycleBreaker.cpp
===================================================================
--- dmcs/branches/dmcs1.5/src/mcs/CycleBreaker.cpp 2012-12-04 11:13:39 UTC (rev 3304)
+++ dmcs/branches/dmcs1.5/src/mcs/CycleBreaker.cpp 2012-12-04 15:53:28 UTC (rev 3305)
@@ -118,19 +118,35 @@
// different from non-cycle-breaking task, we will guess for all input here,
// including the bridge atoms from neighbors that might not be involved in the current cycle.
- NewBeliefState* current_guess = new NewBeliefState(BeliefStateOffset::instance()->NO_BLOCKS(),
- BeliefStateOffset::instance()->SIZE_BS());
+ NewBeliefState* current_guess;
+
+ std::size_t current_step = cache.find_position(k1);
+ DBGLOG(DBG, "CycleBreaker::startup: current_step = " << current_step);
+ if (current_step == 0)
+ {
+ current_guess = new NewBeliefState(BeliefStateOffset::instance()->NO_BLOCKS(),
+ BeliefStateOffset::instance()->SIZE_BS());
- (*current_guess) = (*starting_guess);
+ (*current_guess) = (*starting_guess);
+ DBGLOG(DBG, "CycleBreaker::startup: starting_guess = " << *current_guess);
+ }
+ else
+ {
+ current_guess = jump_guess(total_guessing_input, current_step);
+ DBGLOG(DBG, "CycleBreaker::startup: jump_guess = " << *current_guess);
+ }
+
DBGLOG(DBG, "CycleBreaker::startup: starting guess = " << *current_guess);
do
{
- if (compute(current_guess, k1, k2, parent_qid, eval, md)) break;
+ if (compute(current_guess, k1, k2, parent_qid, current_step, eval, md)) break;
+
+ current_step++;
current_guess = next_guess(current_guess, total_guessing_input);
if (current_guess)
{
- DBGLOG(DBG, "CycleBreaker::startup: current guess = " << *current_guess);
+ DBGLOG(DBG, "CycleBreaker::startup: next guess = " << *current_guess);
}
else
{
Modified: dmcs/branches/dmcs1.5/src/mcs/NewContext.cpp
===================================================================
--- dmcs/branches/dmcs1.5/src/mcs/NewContext.cpp 2012-12-04 11:13:39 UTC (rev 3304)
+++ dmcs/branches/dmcs1.5/src/mcs/NewContext.cpp 2012-12-04 15:53:28 UTC (rev 3305)
@@ -68,6 +68,7 @@
std::size_t& k1,
std::size_t& k2,
std::size_t parent_qid,
+ std::size_t current_step,
EvaluatorPtr eval,
NewConcurrentMessageDispatcherPtr md)
{
@@ -86,12 +87,87 @@
int timeout = 0;
md->send(NewConcurrentMessageDispatcher::EVAL_IN_MQ, eval->getInQueue(), heads, timeout);
- return read_and_send_k1_k2(parent_qid, true, k1, k2, eval, md);
+ return read_and_send_k1_k2(parent_qid, current_step, true, k1, k2, eval, md);
}
NewBeliefState*
+NewContext::jump_guess(NewBeliefState* guessing_input,
+ std::size_t step)
+{
+ NewBeliefState* guess = new NewBeliefState(BeliefStateOffset::instance()->NO_BLOCKS(),
+ BeliefStateOffset::instance()->SIZE_BS());
+ (*guess) = (*starting_guess);
+
+ if (step == 0)
+ {
+ return guess;
+ }
+
+ std::size_t n = BeliefStateOffset::instance()->NO_BLOCKS();
+ std::size_t s = BeliefStateOffset::instance()->SIZE_BS();
+
+ // convert step to binary, store in a vector
+ std::vector<bool> bin_step;
+
+ while (step > 0)
+ {
+ bool rem = ((step%2) == 1);
+ bin_step.push_back(rem);
+ step /= 2;
+ }
+
+ std::vector<bool>::const_iterator it = bin_step.begin();
+ std::size_t first_bit_set = guessing_input->getFirst();
+ assert (first_bit_set % (s+1) == 0);
+ std::size_t bit = first_bit_set;
+
+ // now turn on/off corresponding bits based on the stored binary representation of step
+ do
+ {
+ bit = guessing_input->getNext(bit);
+
+ if (bit % (s+1) != 0)
+ {
+ if (*it)
+ {
+ guess->set(bit, NewBeliefState::DMCS_TRUE);
+ }
+ else
+ {
+ guess->set(bit, NewBeliefState::DMCS_FALSE);
+ }
+
+ it++;
+ if (it == bin_step.end())
+ {
+ break;
+ }
+ }
+ }
+ while (bit);
+
+
+ while (bit)
+ {
+ bit = guessing_input->getNext(bit);
+ if (bit % (s+1) != 0)
+ {
+ guess->set(bit, NewBeliefState::DMCS_FALSE);
+ }
+ }
+
+ if (it != bin_step.end())
+ {
+ delete guess;
+ guess = NULL;
+ }
+
+ return guess;
+}
+
+NewBeliefState*
NewContext::next_guess(NewBeliefState* current_guess,
NewBeliefState* guessing_input)
{
@@ -142,8 +218,10 @@
}
+
bool
NewContext::read_and_send_k1_k2(std::size_t parent_qid,
+ std::size_t current_step,
bool normal_solve,
std::size_t& k1,
std::size_t& k2,
@@ -179,6 +257,12 @@
assert (models_counter < k1);
k2 -= models_counter;
k1 -= models_counter;
+
+ if (current_step > 0)
+ {
+ DBGLOG(DBG, "NewContext::read_and_send_k1_k2(): update cache with (" << current_step << "," << models_counter << ")");
+ cache.update_cache(current_step, models_counter);
+ }
}
else if (models_sent < k2 - k1 + 1)
// the number models returned by the Evaluator is in between k1,k2.
Modified: dmcs/branches/dmcs1.5/src/mcs/NormalContext.cpp
===================================================================
--- dmcs/branches/dmcs1.5/src/mcs/NormalContext.cpp 2012-12-04 11:13:39 UTC (rev 3304)
+++ dmcs/branches/dmcs1.5/src/mcs/NormalContext.cpp 2012-12-04 15:53:28 UTC (rev 3305)
@@ -246,11 +246,22 @@
{
if (must_guess(input))
{
- NewBeliefState* current_guess = new NewBeliefState(BeliefStateOffset::instance()->NO_BLOCKS(),
- BeliefStateOffset::instance()->SIZE_BS());
+ NewBeliefState* current_guess;
+
+ std::size_t current_step = cache.find_position(k1);
+
+ if (current_step == 0)
+ {
+ current_guess = new NewBeliefState(BeliefStateOffset::instance()->NO_BLOCKS(),
+ BeliefStateOffset::instance()->SIZE_BS());
+
+ (*current_guess) = (*starting_guess);
+ }
+ else
+ {
+ current_guess = jump_guess(total_guessing_input, current_step);
+ }
- (*current_guess) = (*starting_guess);
-
// iterate over all possible guesses or until k1 --> k2 models were computed
DBGLOG(DBG, "NormalContext::process_input(). Total guessing input = " << *total_guessing_input);
DBGLOG(DBG, "NormalContext::process_input(). input = " << *input);
@@ -267,12 +278,13 @@
DBGLOG(DBG, "NormalContext::process_input(). input = " << *input);
DBGLOG(DBG, "NormalContext::process_input(). combined input = " << *combined_input);
- if (compute(combined_input, k1, k2, parent_qid, eval, md))
+ if (compute(combined_input, k1, k2, parent_qid, current_step, eval, md))
{
computed_k1_k2 = true;
break;
}
+ current_step++;
current_guess = next_guess(current_guess, total_guessing_input);
if (current_guess)
{
@@ -296,7 +308,9 @@
}
else
{
- return compute(input, k1, k2, parent_qid, eval, md);
+ // disable caching
+ std::size_t current_step_zero = 0;
+ return compute(input, k1, k2, parent_qid, current_step_zero, eval, md);
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mm...@us...> - 2012-12-04 11:13:50
|
Revision: 3304
http://dmcs.svn.sourceforge.net/dmcs/?rev=3304&view=rev
Author: mmsc
Date: 2012-12-04 11:13:39 +0000 (Tue, 04 Dec 2012)
Log Message:
-----------
Disable some redundant code.
Modified Paths:
--------------
dmcs/branches/dmcs1.5/src/mcs/NewContext.cpp
Modified: dmcs/branches/dmcs1.5/src/mcs/NewContext.cpp
===================================================================
--- dmcs/branches/dmcs1.5/src/mcs/NewContext.cpp 2012-12-04 10:49:24 UTC (rev 3303)
+++ dmcs/branches/dmcs1.5/src/mcs/NewContext.cpp 2012-12-04 11:13:39 UTC (rev 3304)
@@ -256,6 +256,7 @@
{
if (heads->getHeads() != NULL)
{
+#if 0
if (normal_solve)
{
HeadsPlusBeliefState* heads_plus_bs = static_cast<HeadsPlusBeliefState*>(heads);
@@ -281,6 +282,7 @@
DBGLOG(DBG, "NewContext::send_out_result(): combined bs = " << *belief_state);
}
// otherwise, this context broke a cycle and we don't have input_bs
+#endif
// project
std::size_t parent_ctx_id = invoker_from_qid(parent_qid);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mm...@us...> - 2012-12-04 10:49:37
|
Revision: 3303
http://dmcs.svn.sourceforge.net/dmcs/?rev=3303&view=rev
Author: mmsc
Date: 2012-12-04 10:49:24 +0000 (Tue, 04 Dec 2012)
Log Message:
-----------
Add Cache for position.
Modified Paths:
--------------
dmcs/branches/dmcs1.5/include/mcs/Makefile.am
dmcs/branches/dmcs1.5/src/Makefile.am
dmcs/branches/dmcs1.5/src/mcs/Makefile.am
dmcs/branches/dmcs1.5/testsuite/Makefile.am
Added Paths:
-----------
dmcs/branches/dmcs1.5/include/mcs/CachePosition.h
dmcs/branches/dmcs1.5/src/mcs/CachePosition.cpp
dmcs/branches/dmcs1.5/testsuite/testCache.cpp
Added: dmcs/branches/dmcs1.5/include/mcs/CachePosition.h
===================================================================
--- dmcs/branches/dmcs1.5/include/mcs/CachePosition.h (rev 0)
+++ dmcs/branches/dmcs1.5/include/mcs/CachePosition.h 2012-12-04 10:49:24 UTC (rev 3303)
@@ -0,0 +1,54 @@
+/* DMCS -- Distributed Nonmonotonic Multi-Context Systems.
+ * Copyright (C) 2009, 2010 Minh Dao-Tran, Thomas Krennwallner
+ *
+ * This file is part of DMCS.
+ *
+ * DMCS is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * DMCS is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with DMCS. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/**
+ * @file CachePosition.h
+ * @author Minh Dao-Tran <da...@kr...>
+ * @date Tue Dec 4 10:35:26 2012
+ *
+ * @brief
+ */
+
+#ifndef ___CACHE_H___
+#define ___CACHE_H___
+
+#include <vector>
+
+namespace dmcs {
+
+class CachePosition {
+public:
+ void
+ update_cache(std::size_t index,
+ std::size_t k);
+
+ std::size_t
+ find_position(const std::size_t k);
+
+private:
+ std::vector<std::size_t> mark;
+};
+
+} // namespace dmcs
+
+#endif // ___CACHE_H___
+
+// Local Variables:
+// mode: C++
+// End:
Modified: dmcs/branches/dmcs1.5/include/mcs/Makefile.am
===================================================================
--- dmcs/branches/dmcs1.5/include/mcs/Makefile.am 2012-12-03 10:59:03 UTC (rev 3302)
+++ dmcs/branches/dmcs1.5/include/mcs/Makefile.am 2012-12-04 10:49:24 UTC (rev 3303)
@@ -10,6 +10,7 @@
BridgeRule.h \
BridgeRuleEvaluator.h \
BridgeRuleTable.h \
+ CachePosition.h \
ForwardMessage.h \
Heads.h \
ID.h \
Modified: dmcs/branches/dmcs1.5/src/Makefile.am
===================================================================
--- dmcs/branches/dmcs1.5/src/Makefile.am 2012-12-03 10:59:03 UTC (rev 3302)
+++ dmcs/branches/dmcs1.5/src/Makefile.am 2012-12-04 10:49:24 UTC (rev 3303)
@@ -39,7 +39,7 @@
# the new_dmcsd binary
new_dmcsd_SOURCES = \
- new_dmcsd.cpp
+ new_dmcsd.cpp
new_dmcsd_LDADD = \
$(top_builddir)/src/dmcs/libdmcs.a \
@@ -48,6 +48,7 @@
$(top_builddir)/src/network/libthreads.a \
$(top_builddir)/src/process/libprocess.a \
$(top_builddir)/src/mcs/libmcs.a \
+ $(top_builddir)/src/mcs/libcache.a \
@LIBCURL@
# the dmcsc binary
Added: dmcs/branches/dmcs1.5/src/mcs/CachePosition.cpp
===================================================================
--- dmcs/branches/dmcs1.5/src/mcs/CachePosition.cpp (rev 0)
+++ dmcs/branches/dmcs1.5/src/mcs/CachePosition.cpp 2012-12-04 10:49:24 UTC (rev 3303)
@@ -0,0 +1,94 @@
+/* DMCS -- Distributed Nonmonotonic Multi-Context Systems.
+ * Copyright (C) 2009, 2010 Minh Dao-Tran, Thomas Krennwallner
+ *
+ * This file is part of DMCS.
+ *
+ * DMCS is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * DMCS is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with DMCS. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/**
+ * @file CachePosition.cpp
+ * @author Minh Dao-Tran <da...@kr...>
+ * @date Tue Dec 4 10:39:01 2012
+ *
+ * @brief
+ */
+
+#include <assert.h>
+#include <iostream>
+#include "mcs/CachePosition.h"
+
+namespace dmcs {
+
+void
+CachePosition::update_cache(std::size_t index,
+ std::size_t k)
+{
+ assert (index == mark.size()+1);
+
+ if (index == 1)
+ {
+ mark.push_back(k);
+ }
+ else
+ {
+ k += mark.back();
+ mark.push_back(k);
+ }
+}
+
+std::size_t
+CachePosition::find_position(const std::size_t k)
+{
+ if (mark.empty())
+ {
+ return 0;
+ }
+
+ // as mark is incremental, we can do a binary search here
+ std::size_t beg = 0;
+ std::size_t end = mark.size();
+ std::size_t mid;
+
+ while (beg+1 < end)
+ {
+ mid = (beg + end)/2;
+ if (mark[mid] < k)
+ {
+ beg = mid;
+ }
+ else if (mark[mid] > k)
+ {
+ end = mid;
+ }
+ else if (mark[mid] == k)
+ {
+ return mid;
+ }
+ }
+
+ // actually beg but outside we count from 1
+ if (mark[beg] == k)
+ {
+ return beg;
+ }
+
+ return beg+1;
+}
+
+} // namespace dmcs
+
+// Local Variables:
+// mode: C++
+// End:
Modified: dmcs/branches/dmcs1.5/src/mcs/Makefile.am
===================================================================
--- dmcs/branches/dmcs1.5/src/mcs/Makefile.am 2012-12-03 10:59:03 UTC (rev 3302)
+++ dmcs/branches/dmcs1.5/src/mcs/Makefile.am 2012-12-04 10:49:24 UTC (rev 3303)
@@ -26,7 +26,7 @@
$(BOOST_GRAPH_LIBS)
-noinst_LIBRARIES = libmcs.a
+noinst_LIBRARIES = libmcs.a libcache.a
# the mcs library
libmcs_a_SOURCES = \
@@ -49,3 +49,7 @@
QueryPlan.cpp \
ReturnedBeliefState.cpp \
StreamingJoiner.cpp
+
+# the cache lirary
+libcache_a_SOURCES = \
+ CachePosition.cpp
\ No newline at end of file
Modified: dmcs/branches/dmcs1.5/testsuite/Makefile.am
===================================================================
--- dmcs/branches/dmcs1.5/testsuite/Makefile.am 2012-12-03 10:59:03 UTC (rev 3302)
+++ dmcs/branches/dmcs1.5/testsuite/Makefile.am 2012-12-04 10:49:24 UTC (rev 3303)
@@ -25,6 +25,7 @@
TESTS = \
+ testCache \
testClasp \
testBeliefComparison \
testBridgeRuleParswer \
@@ -68,6 +69,7 @@
BOOST_TEST_LOG_LEVEL=all
check_PROGRAMS = \
+ testCache \
testClasp \
testBeliefComparison \
testBridgeRuleParser \
@@ -111,6 +113,10 @@
testSystemWithQueryPlan \
testSystem
+testCache_SOURCES = testCache.cpp
+testCache_LDADD = \
+ $(top_builddir)/src/mcs/libcache.a
+
testClasp_SOURCES = testClasp.cpp
testClasp_LDADD = \
$(top_builddir)/src/dmcs/libdmcs.a \
Added: dmcs/branches/dmcs1.5/testsuite/testCache.cpp
===================================================================
--- dmcs/branches/dmcs1.5/testsuite/testCache.cpp (rev 0)
+++ dmcs/branches/dmcs1.5/testsuite/testCache.cpp 2012-12-04 10:49:24 UTC (rev 3303)
@@ -0,0 +1,79 @@
+/* DMCS -- Distributed Nonmonotonic Multi-Context Systems.
+ * Copyright (C) 2009, 2010 Minh Dao-Tran, Thomas Krennwallner
+ *
+ * This file is part of DMCS.
+ *
+ * DMCS is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * DMCS is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with DMCS. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/**
+ * @file testCache.cpp
+ * @author Minh Dao-Tran <da...@kr...>
+ * @date Tue Dec 4 11:02:21 2012
+ *
+ * @brief
+ *
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif // HAVE_CONFIG_H
+
+#include <iostream>
+#include "mcs/CachePosition.h"
+
+#define BOOST_TEST_DYN_LINK
+#define BOOST_TEST_MODULE "testCache"
+#include <boost/test/unit_test.hpp>
+#include <boost/thread.hpp>
+
+using namespace dmcs;
+
+BOOST_AUTO_TEST_CASE ( testCachPosition )
+{
+ CachePosition cp;
+ cp.update_cache(1,3);
+ cp.update_cache(2,3);
+ cp.update_cache(3,3);
+ cp.update_cache(4,3);
+ cp.update_cache(5,3);
+ cp.update_cache(6,3);
+ cp.update_cache(7,3);
+ cp.update_cache(8,3);
+ cp.update_cache(9,3);
+ cp.update_cache(10,3);
+ cp.update_cache(11,3);
+ cp.update_cache(12,3);
+ cp.update_cache(13,3);
+ cp.update_cache(14,3);
+ cp.update_cache(15,3);
+
+ std::cerr << "Update finished" << std::endl;
+
+ static const std::size_t ask[] = {3, 5, 10, 12, 20, 23, 25, 27};
+ std::vector<std::size_t> ask_vec(ask, ask + sizeof(ask)/sizeof(ask[0]));
+
+ for (std::vector<std::size_t>::const_iterator it = ask_vec.begin(); it != ask_vec.end(); ++it)
+ {
+ std::cerr << "Find position for value = " << *it << std::endl;
+ std::size_t pos = cp.find_position(*it);
+ std::cerr << "value = " << *it << ", pos = " << pos << std::endl;
+ }
+}
+
+
+// Local Variables:
+// mode: C++
+// End:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mm...@us...> - 2012-12-03 10:59:15
|
Revision: 3302
http://dmcs.svn.sourceforge.net/dmcs/?rev=3302&view=rev
Author: mmsc
Date: 2012-12-03 10:59:03 +0000 (Mon, 03 Dec 2012)
Log Message:
-----------
Fixed a bug in Joiner.
Modified Paths:
--------------
dmcs/branches/dmcs1.5/examples/test/runTest.sh
dmcs/branches/dmcs1.5/include/mcs/StreamingJoiner.h
dmcs/branches/dmcs1.5/src/mcs/StreamingJoiner.cpp
Modified: dmcs/branches/dmcs1.5/examples/test/runTest.sh
===================================================================
--- dmcs/branches/dmcs1.5/examples/test/runTest.sh 2012-11-30 09:24:43 UTC (rev 3301)
+++ dmcs/branches/dmcs1.5/examples/test/runTest.sh 2012-12-03 10:59:03 UTC (rev 3302)
@@ -27,32 +27,37 @@
#################################################################################
moveLogFiles()
{
- noargs=$#
- optimized=opt_
- loopMode=noloop_
+ mvTopoName=$1
+ mvTestName=$2
+ mvTestPack=$3
+ mvRunOpt=$4
+ mvNoLoop=$5
+
+ optimized=
+ loopMode=
mode=
- if [ $noargs -eq 3 ] ; then
- optimized=
- loopMode=
- elif [ $noargs -eq 4 ] ; then
- loopMode=
+
+ if [ x$mvRunOpt = xopt ] ; then
+ optimized=opt_
fi
-
- toponame=$1
- testname=$2
+
+ if [ x$mvNoLoop = xnoloop ] ; then
+ loopMode=noloop_
+ fi
+
mode=$optimized$loopMode$3
basedir=../../..
createSubDir $basedir/output
- createSubDir $basedir/output/$toponame
- createSubDir $basedir/output/$toponame/$testname
- createSubDir $basedir/output/$toponame/$testname/$mode
+ createSubDir $basedir/output/$mvTopoName
+ createSubDir $basedir/output/$mvTopoName/$mvTestName
+ createSubDir $basedir/output/$mvTopoName/$mvTestName/$mode
if [ x$WANTLOG = xyes ] ; then
- rm $basedir/output/$toponame/$testname/$mode/*
+ rm $basedir/output/$mvTopoName/$mvTestName/$mode/*
fi
- mv *.log $basedir/output/$toponame/$testname/$mode
+ mv *.log $basedir/output/$mvTopoName/$mvTestName/$mode
} # end of moveLogFiles
#################################################################################
@@ -136,9 +141,10 @@
no_test_packs=${#testpack[@]}
for ((i = 0; i < $no_test_packs; ++i)) ; do
- runOneInstance $filename $toponame $testname ${testpack[$i]}
- runOneInstance $filename $toponame $testname ${testpack[$i]} opt
- if [ $i -gt 0 ] ; then
+ runOneInstance $filename $toponame $testname ${testpack[$i]} noopt loop
+ runOneInstance $filename $toponame $testname ${testpack[$i]} opt loop
+ if [ $i -gt 1 ] ; then
+ runOneInstance $filename $toponame $testname ${testpack[$i]} noopt noloop
runOneInstance $filename $toponame $testname ${testpack[$i]} opt noloop
fi
done
Modified: dmcs/branches/dmcs1.5/include/mcs/StreamingJoiner.h
===================================================================
--- dmcs/branches/dmcs1.5/include/mcs/StreamingJoiner.h 2012-11-30 09:24:43 UTC (rev 3301)
+++ dmcs/branches/dmcs1.5/include/mcs/StreamingJoiner.h 2012-12-03 10:59:03 UTC (rev 3302)
@@ -47,11 +47,13 @@
StreamingJoiner(std::size_t ps,
NewNeighborVecPtr n);
+#if 0
ReturnedBeliefState*
trigger_join(std::size_t query_id,
const NewHistory& history,
NewConcurrentMessageDispatcherPtr md,
NewJoinerDispatcherPtr jd);
+#endif
ReturnedBeliefState*
first_join(std::size_t query_id,
@@ -69,11 +71,13 @@
void
reset();
+#if 0
ReturnedBeliefState*
process(std::size_t query_id,
const NewHistory& history,
NewConcurrentMessageDispatcherPtr md,
NewJoinerDispatcherPtr jd);
+#endif
bool
do_join(std::size_t query_id);
@@ -119,7 +123,7 @@
// if pack_size == 0, we ask for all models
std::size_t pack_size;
std::size_t next_neighbor;
- bool first_round;
+ // bool first_round;
bool asking_next;
std::vector<std::size_t> pack_count;
NeighborOffset2IndexPtr offset2index;
Modified: dmcs/branches/dmcs1.5/src/mcs/StreamingJoiner.cpp
===================================================================
--- dmcs/branches/dmcs1.5/src/mcs/StreamingJoiner.cpp 2012-11-30 09:24:43 UTC (rev 3301)
+++ dmcs/branches/dmcs1.5/src/mcs/StreamingJoiner.cpp 2012-12-03 10:59:03 UTC (rev 3302)
@@ -40,7 +40,7 @@
pack_size(ps),
offset2index(new NeighborOffset2Index),
next_neighbor(0),
- first_round(true),
+ // first_round(true),
asking_next(false),
pack_count(n->size(), 0)
{
@@ -62,7 +62,7 @@
{
BaseJoiner::reset();
- first_round = true;
+ // first_round = true;
asking_next = false;
next_neighbor = 0;
@@ -71,7 +71,7 @@
}
-
+#if 0
ReturnedBeliefState*
StreamingJoiner::trigger_join(std::size_t query_id,
const NewHistory& history,
@@ -121,6 +121,7 @@
return end_rbs;
}
}
+#endif
@@ -130,8 +131,8 @@
NewConcurrentMessageDispatcherPtr md,
NewJoinerDispatcherPtr jd)
{
- // Warming up round, set first_round to FALSE
- first_round = false;
+ reset();
+ // first_round = false;
if (!ask_first_packs(query_id, history, 0, neighbors->size()-1, md, jd))
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mm...@us...> - 2012-11-30 09:24:50
|
Revision: 3301
http://dmcs.svn.sourceforge.net/dmcs/?rev=3301&view=rev
Author: mmsc
Date: 2012-11-30 09:24:43 +0000 (Fri, 30 Nov 2012)
Log Message:
-----------
Bug with cyclic-opt fixed.
Modified Paths:
--------------
dmcs/branches/dmcs1.5/include/network/NewConcurrentMessageDispatcher.tcc
dmcs/branches/dmcs1.5/src/mcs/CycleBreaker.cpp
dmcs/branches/dmcs1.5/src/mcs/NewContext.cpp
dmcs/branches/dmcs1.5/src/mcs/NormalContext.cpp
Modified: dmcs/branches/dmcs1.5/include/network/NewConcurrentMessageDispatcher.tcc
===================================================================
--- dmcs/branches/dmcs1.5/include/network/NewConcurrentMessageDispatcher.tcc 2012-11-29 22:20:23 UTC (rev 3300)
+++ dmcs/branches/dmcs1.5/include/network/NewConcurrentMessageDispatcher.tcc 2012-11-30 09:24:43 UTC (rev 3301)
@@ -39,7 +39,7 @@
NewConcurrentMessageDispatcher::send(MQIDs id, MessageType* mess, int msecs)
{
assert (id < SEPARATOR);
- DBGLOG(DBG, "NewConcurrentMessageDispatcher::send(" << id << ")");
+ //DBGLOG(DBG, "NewConcurrentMessageDispatcher::send(" << id << ")");
ConcurrentMessageQueuePtr cmq = getMQ(id);
return send(cmq.get(), mess, msecs);
}
@@ -52,7 +52,7 @@
MessageType* mess, int msecs)
{
assert (SEPARATOR < type && type < END_OF_MQ);
- DBGLOG(DBG, "NewConcurrentMessageDispatcher::send(" << type << ", " << id << ")");
+ //DBGLOG(DBG, "NewConcurrentMessageDispatcher::send(" << type << ", " << id << ")");
ConcurrentMessageQueuePtr cmq = getMQ(type, id);
return send(cmq.get(), mess, msecs);
}
@@ -91,7 +91,7 @@
NewConcurrentMessageDispatcher::receive(MQIDs id, int msecs)
{
assert (id < SEPARATOR);
- DBGLOG(DBG, "NewConcurrentMessageDispatcher::receive(" << id << ")");
+ //DBGLOG(DBG, "NewConcurrentMessageDispatcher::receive(" << id << ")");
ConcurrentMessageQueuePtr cmq = getMQ(id);
return receive<MessageType>(cmq.get(), msecs);
}
@@ -103,7 +103,7 @@
NewConcurrentMessageDispatcher::receive(MQIDs type, std::size_t id, int msecs)
{
assert (SEPARATOR < type && type < END_OF_MQ);
- DBGLOG(DBG, "NewConcurrentMessageDispatcher::receive(" << type << ", " << id << ")");
+ //DBGLOG(DBG, "NewConcurrentMessageDispatcher::receive(" << type << ", " << id << ")");
ConcurrentMessageQueuePtr cmq = getMQ(type, id);
return receive<MessageType>(cmq.get(), msecs);
}
Modified: dmcs/branches/dmcs1.5/src/mcs/CycleBreaker.cpp
===================================================================
--- dmcs/branches/dmcs1.5/src/mcs/CycleBreaker.cpp 2012-11-29 22:20:23 UTC (rev 3300)
+++ dmcs/branches/dmcs1.5/src/mcs/CycleBreaker.cpp 2012-11-30 09:24:43 UTC (rev 3301)
@@ -121,12 +121,21 @@
NewBeliefState* current_guess = new NewBeliefState(BeliefStateOffset::instance()->NO_BLOCKS(),
BeliefStateOffset::instance()->SIZE_BS());
- (*current_guess) = (*starting_guess);
+ (*current_guess) = (*starting_guess);
+ DBGLOG(DBG, "CycleBreaker::startup: starting guess = " << *current_guess);
do
{
if (compute(current_guess, k1, k2, parent_qid, eval, md)) break;
current_guess = next_guess(current_guess, total_guessing_input);
+ if (current_guess)
+ {
+ DBGLOG(DBG, "CycleBreaker::startup: current guess = " << *current_guess);
+ }
+ else
+ {
+ DBGLOG(DBG, "CycleBreaker::startup: current guess = NULL, break!");
+ }
}
while (current_guess);
Modified: dmcs/branches/dmcs1.5/src/mcs/NewContext.cpp
===================================================================
--- dmcs/branches/dmcs1.5/src/mcs/NewContext.cpp 2012-11-29 22:20:23 UTC (rev 3300)
+++ dmcs/branches/dmcs1.5/src/mcs/NewContext.cpp 2012-11-30 09:24:43 UTC (rev 3301)
@@ -72,7 +72,7 @@
NewConcurrentMessageDispatcherPtr md)
{
///@todo: create heads = (NULL, k1, k2) in case of real leaf node.
- DBGLOG(DBG, "NormalContext[" << ctx_id << "]::compute(): input = " << *input);
+ DBGLOG(DBG, "NewContext[" << ctx_id << "]::compute(): input = " << *input);
Heads* heads = evaluate_bridge_rules(bridge_rules, input, k1, k2,
BeliefStateOffset::instance()->getStartingOffsets());
Modified: dmcs/branches/dmcs1.5/src/mcs/NormalContext.cpp
===================================================================
--- dmcs/branches/dmcs1.5/src/mcs/NormalContext.cpp 2012-11-29 22:20:23 UTC (rev 3300)
+++ dmcs/branches/dmcs1.5/src/mcs/NormalContext.cpp 2012-11-30 09:24:43 UTC (rev 3301)
@@ -252,15 +252,21 @@
(*current_guess) = (*starting_guess);
// iterate over all possible guesses or until k1 --> k2 models were computed
- DBGLOG(DBG, "NormalContext::process_request(). Guessing input = " << *total_guessing_input);
+ DBGLOG(DBG, "NormalContext::process_input(). Total guessing input = " << *total_guessing_input);
+ DBGLOG(DBG, "NormalContext::process_input(). input = " << *input);
+ DBGLOG(DBG, "NormalContext::process_input(). starting guess = " << *current_guess);
bool computed_k1_k2 = false;
do
{
NewBeliefState* combined_input =
new NewBeliefState(BeliefStateOffset::instance()->NO_BLOCKS(),
BeliefStateOffset::instance()->SIZE_BS());
- (*combined_input ) = (*input) | (*current_guess);
+ (*combined_input) = (*input);
+ (*combined_input) = (*combined_input) | (*current_guess);
+ DBGLOG(DBG, "NormalContext::process_input(). input = " << *input);
+ DBGLOG(DBG, "NormalContext::process_input(). combined input = " << *combined_input);
+
if (compute(combined_input, k1, k2, parent_qid, eval, md))
{
computed_k1_k2 = true;
@@ -268,6 +274,14 @@
}
current_guess = next_guess(current_guess, total_guessing_input);
+ if (current_guess)
+ {
+ DBGLOG(DBG, "NormalContext::process_input(). current guess = " << *current_guess);
+ }
+ else
+ {
+ DBGLOG(DBG, "NormalContext::process_input(). current guess = NULL. break!");
+ }
}
while (current_guess);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mm...@us...> - 2012-11-29 22:20:30
|
Revision: 3300
http://dmcs.svn.sourceforge.net/dmcs/?rev=3300&view=rev
Author: mmsc
Date: 2012-11-29 22:20:23 +0000 (Thu, 29 Nov 2012)
Log Message:
-----------
Still working on the fix.
Modified Paths:
--------------
dmcs/branches/dmcs1.5/include/dmcs/DLVEvaluator.h
dmcs/branches/dmcs1.5/src/dmcs/DLVEvaluator.cpp
Modified: dmcs/branches/dmcs1.5/include/dmcs/DLVEvaluator.h
===================================================================
--- dmcs/branches/dmcs1.5/include/dmcs/DLVEvaluator.h 2012-11-29 18:21:17 UTC (rev 3299)
+++ dmcs/branches/dmcs1.5/include/dmcs/DLVEvaluator.h 2012-11-29 22:20:23 UTC (rev 3300)
@@ -59,6 +59,13 @@
private:
void
+ test_and_send(NewBeliefState* local_model,
+ const NewBeliefState* input_bs,
+ Heads* heads,
+ std::size_t ctx_id,
+ NewConcurrentMessageDispatcherPtr md);
+
+ void
read_all(std::size_t ctx_id,
Heads* heads,
BeliefTablePtr btab,
Modified: dmcs/branches/dmcs1.5/src/dmcs/DLVEvaluator.cpp
===================================================================
--- dmcs/branches/dmcs1.5/src/dmcs/DLVEvaluator.cpp 2012-11-29 18:21:17 UTC (rev 3299)
+++ dmcs/branches/dmcs1.5/src/dmcs/DLVEvaluator.cpp 2012-11-29 22:20:23 UTC (rev 3300)
@@ -36,7 +36,7 @@
#include "dmcs/Instantiator.h"
#include "mcs/BeliefStateOffset.h"
#include "mcs/Logger.h"
-#include "parser/DLVResultParser.h"
+#include "parser/NewDLVResultParser.h"
namespace dmcs {
@@ -143,38 +143,73 @@
void
+DLVEvaluator::test_and_send(NewBeliefState* local_model,
+ const NewBeliefState* input_bs,
+ Heads* heads,
+ std::size_t ctx_id,
+ NewConcurrentMessageDispatcherPtr md)
+{
+ if (!local_model->consistent_with(*input_bs, ctx_id,
+ BeliefStateOffset::instance()->getStartingOffsets()))
+ {
+ DBGLOG(DBG, "DLVEvaluator::test_and_send: inconsistent with input_bs = " << *input_bs);
+ delete local_model;
+ local_model = NULL;
+ }
+ else
+ {
+ DBGLOG(DBG, "DLVEvaluator::test_and_send: consistent with input_bs = " << *input_bs);
+ models_counter++;
+ (*local_model) = (*local_model) | (*input_bs);
+ HeadsBeliefStatePair* res = new HeadsBeliefStatePair();
+ res->first = heads;
+ res->second = local_model;
+
+ DBGLOG(DBG, "DLVEvaluator::test_and_send: send back = " << *local_model);
+
+ int timeout = 0;
+ md->send(NewConcurrentMessageDispatcher::EVAL_OUT_MQ, out_queue, res, timeout);
+ }
+
+}
+
+
+void
DLVEvaluator::read_all(std::size_t ctx_id,
Heads* heads,
BeliefTablePtr btab,
NewConcurrentMessageDispatcherPtr md)
{
- BeliefStateResultAdder adder(out_queue, md, heads);
- DLVResultParser dlv_parser(ctx_id, btab);
+ // dirty hack
+ HeadsPlusBeliefState* heads_plus_bs = static_cast<HeadsPlusBeliefState*>(heads);
+ const NewBeliefState* input_bs = heads_plus_bs->getInputBeliefState();
+ NewDLVResultParser dlv_parser(btab, ctx_id);
+
std::istream& is = proc->getInput();
do
{
- std::string input;
- std::getline(is, input);
+ std::string str_input;
+ std::getline(is, str_input);
- if ( input.empty() || is.bad() )
+ if ( str_input.empty() || is.bad() )
{
- /*DBGLOG(DBG, "DLVEvaluator::read_all: Leaving loop because got input size " << input.size()
+ /*DBGLOG(DBG, "DLVEvaluator::read_all: Leaving loop because got input size " << str_input.size()
<< ", stream bits fail " << is.fail() << ", bad " << is.bad()
<< ", eof " << is.eof());*/
break;
}
// discard weak answer set cost lines
- if( 0 == input.compare(0, 22, "Cost ([Weight:Level]):") )
+ if( 0 == str_input.compare(0, 22, "Cost ([Weight:Level]):") )
{
//DBGLOG(DBG, "DLVEvaluator::read_all: Discarding weak answer set cost line");
}
else
{
// parse line
- std::istringstream iss(input);
- dlv_parser.parse(iss, adder);
+ NewBeliefState* local_model = dlv_parser.parseString(str_input);
+ test_and_send(local_model, input_bs, heads, ctx_id, md);
}
}
while (1);
@@ -190,33 +225,42 @@
{
assert (0 < k1 && k1 <= k2);
- BeliefStateResultAdder adder(out_queue, md, heads);
- DLVResultParser dlv_parser(ctx_id, btab);
+ HeadsPlusBeliefState* heads_plus_bs = static_cast<HeadsPlusBeliefState*>(heads);
+ const NewBeliefState* input_bs = heads_plus_bs->getInputBeliefState();
+ NewDLVResultParser dlv_parser(btab, ctx_id);
+
std::istream& is = proc->getInput();
// ignore the first k1 models
while (models_counter < k1-1)
{
- std::string input;
- std::getline(is, input);
+ std::string str_input;
+ std::getline(is, str_input);
- if ( input.empty() || is.bad() )
+ if ( str_input.empty() || is.bad() )
{
- /*DBGLOG(DBG, "DLVEvaluator::read_until_k2: Leaving loop because got input size " << input.size()
+ /*DBGLOG(DBG, "DLVEvaluator::read_until_k2: Leaving loop because got input size " << str_input.size()
<< ", stream bits fail " << is.fail() << ", bad " << is.bad()
<< ", eof " << is.eof());*/
break;
}
// discard weak answer set cost lines
- if ( 0 == input.compare(0, 22, "Cost ([Weight:Level]):") )
+ if ( 0 == str_input.compare(0, 22, "Cost ([Weight:Level]):") )
{
//DBGLOG(DBG, "DLVEvaluator::read_until_k2: Discarding weak answer set cost line");
}
else
{
- ++models_counter;
+ NewBeliefState* local_model = dlv_parser.parseString(str_input);
+ if (local_model->consistent_with(*input_bs, ctx_id,
+ BeliefStateOffset::instance()->getStartingOffsets()))
+ {
+ ++models_counter;
+ }
+ delete local_model;
+ local_model = NULL;
}
}
@@ -225,30 +269,32 @@
return;
}
+ DBGLOG(DBG, "DLVEvaluator::read_until_k2: " << k1-1 << "models ignored.");
+
while (models_counter < k2)
{
- std::string input;
- std::getline(is, input);
+ std::string str_input;
+ std::getline(is, str_input);
- if ( input.empty() || is.bad() )
+ if ( str_input.empty() || is.bad() )
{
- /*DBGLOG(DBG, "DLVEvaluator::read_until_k2: Leaving loop because got input size " << input.size()
+ /*DBGLOG(DBG, "DLVEvaluator::read_until_k2: Leaving loop because got input size " << str_input.size()
<< ", stream bits fail " << is.fail() << ", bad " << is.bad()
<< ", eof " << is.eof() << std::endl;*/
break;
}
// discard weak answer set cost lines
- if( 0 == input.compare(0, 22, "Cost ([Weight:Level]):") )
+ if( 0 == str_input.compare(0, 22, "Cost ([Weight:Level]):") )
{
//DBGLOG(DBG, "DLVEvaluator::read_until_k2: Discarding weak answer set cost line");
}
else
{
// parse line
- ++models_counter;
- std::istringstream iss(input);
- dlv_parser.parse(iss, adder);
+ NewBeliefState* local_model = dlv_parser.parseString(str_input);
+ DBGLOG(DBG, "DLVEvaluator::read_until_k2: local_model" << *local_model);
+ test_and_send(local_model, input_bs, heads, ctx_id, md);
}
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mm...@us...> - 2012-11-29 18:21:28
|
Revision: 3299
http://dmcs.svn.sourceforge.net/dmcs/?rev=3299&view=rev
Author: mmsc
Date: 2012-11-29 18:21:17 +0000 (Thu, 29 Nov 2012)
Log Message:
-----------
Intermediate commit: on fixing a bug with cyclic topology: missing models after encoutering conflict ones.
Modified Paths:
--------------
dmcs/branches/dmcs1.5/examples/test/runTest.sh
dmcs/branches/dmcs1.5/include/parser/Makefile.am
dmcs/branches/dmcs1.5/src/parser/Makefile.am
Added Paths:
-----------
dmcs/branches/dmcs1.5/include/parser/NewDLVResultParser.h
dmcs/branches/dmcs1.5/src/parser/NewDLVResultParser.cpp
Modified: dmcs/branches/dmcs1.5/examples/test/runTest.sh
===================================================================
--- dmcs/branches/dmcs1.5/examples/test/runTest.sh 2012-11-29 12:28:58 UTC (rev 3298)
+++ dmcs/branches/dmcs1.5/examples/test/runTest.sh 2012-11-29 18:21:17 UTC (rev 3299)
@@ -27,15 +27,20 @@
#################################################################################
moveLogFiles()
{
- no_args=$#
+ noargs=$#
optimized=opt_
- if [ $no_args -eq 3 ] ; then
+ loopMode=noloop_
+ mode=
+ if [ $noargs -eq 3 ] ; then
optimized=
+ loopMode=
+ elif [ $noargs -eq 4 ] ; then
+ loopMode=
fi
toponame=$1
testname=$2
- mode=$optimized$3
+ mode=$optimized$loopMode$3
basedir=../../..
createSubDir $basedir/output
@@ -58,6 +63,7 @@
teName=$3
tpack=$4
runOpt=$5
+ noLoop=$6
basedir=../../..
@@ -71,39 +77,45 @@
wantOpt=-opt
fi
- for (( i = 1; i <= $MAXTRY; ++i)) ; do
- if [ $i -eq 1 ] ; then
- echo "Run "$teName $tpack $runOpt
+ wantNoLoop=
+ if [ x$noLoop = xnoloop ] ; then
+ wantNoLoop=-noloop
+ fi
+
+ declare -i j
+ for (( j=1; j <= $MAXTRY; ++j)) ; do
+ if [ $j -eq 1 ] ; then
+ echo "Run "$teName $tpack $runOpt $noLoop
else
- echo "Retry($i) "$teName $tpack $runOpt
+ echo "Retry($j) "$teName $tpack $runOpt $noLoop
fi
- bash $toName-command-line$wantOpt-$tpack$wantlog.sh
+ bash $toName-command-line$wantOpt-$tpack$wantlog$wantNoLoop.sh
RETVAL=$?
echo $RETVAL
if [ $RETVAL -eq 0 ] ; then
- echo "PASSED: $teName $tpack $runOpt" > $toName-status.log
- echo $toName,$teName,$tpack,$runOpt >> $basedir/passedtests.log
- (cat $toName-time.log ; echo ; cat $toName.log ; echo ; cat $toName-err.log) | mail -s "PASSED: dmcs testcase on GLUCK: $teName $tpack $runOpt" $EMAIL
+ echo "PASSED: $teName $tpack $runOpt $noLoop" > $toName-status.log
+ echo $toName,$teName,$tpack,$runOpt,$noLoop >> $basedir/passedtests.log
+ (cat $toName-time.log ; echo ; cat $toName.log ; echo ; cat $toName-err.log) | mail -s "PASSED: dmcs testcase on GLUCK: $teName $tpack $runOpt $noLoop" $EMAIL
break
elif [ $RETVAL -eq 124 ] ; then
- echo "TIMEOUT: $teName $tpack $runOpt" > $toName-status.log
- echo $toName,$teName,$tpack,$runOpt >> $basedir/timeouttests.log
- (cat $toName-time.log ; echo ; cat $toName.log ; echo ; cat $toName-err.log) | mail -s "TIMEOUT: dmcs testcase on GLUCK: $teName $tpack $runOpt" $EMAIL
+ echo "TIMEOUT: $teName $tpack $runOpt $noLoop" > $toName-status.log
+ echo $toName,$teName,$tpack,$runOpt,$noLoop >> $basedir/timeouttests.log
+ (cat $toName-time.log ; echo ; cat $toName.log ; echo ; cat $toName-err.log) | mail -s "TIMEOUT: dmcs testcase on GLUCK: $teName $tpack $runOpt $noLoop" $EMAIL
break
else
- if [ $i -eq $MAXtRY ] ; then
- echo "FAILED: $teName $tpack $runOpt" > $toName-status.log
- echo $toName,$teName,$tpack,$runOpt >> $basedir/$filename
- (cat $toName-time.log ; echo ; cat $toName.log ; echo ; cat $toName-err.log) | mail -s "FAILED: dmcs testcase on GLUCK: $teName $tpack $runOpt" $EMAIL
+ if [ $j -eq $MAXTRY ] ; then
+ echo "FAILED: $teName $tpack $runOpt $noLoop" > $toName-status.log
+ echo $toName,$teName,$tpack,$runOpt,$noLoop >> $basedir/$filename
+ (cat $toName-time.log ; echo ; cat $toName.log ; echo ; cat $toName-err.log) | mail -s "FAILED: dmcs testcase on GLUCK: $teName $tpack $runOpt $noLoop" $EMAIL
else
- (cat $toName-time.log ; echo ; cat $toName.log ; echo ; cat $toName-err.log) | mail -s "FAILED($i): dmcs testcase on GLUCK: $teName $tpack $runOpt" $EMAIL
+ (cat $toName-time.log ; echo ; cat $toName.log ; echo ; cat $toName-err.log) | mail -s "FAILED($j): dmcs testcase on GLUCK: $teName $tpack $runOpt $noLoop" $EMAIL
fi
fi
done
- moveLogFiles $toName $teName $tpack $runOpt
+ moveLogFiles $toName $teName $tpack $runOpt $noLoop
} # end of runOneInstance
#################################################################################
@@ -126,6 +138,9 @@
for ((i = 0; i < $no_test_packs; ++i)) ; do
runOneInstance $filename $toponame $testname ${testpack[$i]}
runOneInstance $filename $toponame $testname ${testpack[$i]} opt
+ if [ $i -gt 0 ] ; then
+ runOneInstance $filename $toponame $testname ${testpack[$i]} opt noloop
+ fi
done
cd ../../.. # get out of data/$toponame/$testname
@@ -145,9 +160,12 @@
# list[0] = toponame
# list[1] = testname
# list[2] = testpack
- # list[3] = (mode)
+ # list[3] = (opt-mode)
+ # list[4] = (loop-mode)
cd data/${list[0]}/${list[1]}
- if [ $noArguments -eq 4 ] ; then
+ if [ $noArguments -eq 5 ] ; then
+ runOneInstance failedtests.tmp ${list[0]} ${list[1]} ${list[2]} ${list[3]} ${list[4]}
+ elif [ $noArguments -eq 4 ] ; then
runOneInstance failedtests.tmp ${list[0]} ${list[1]} ${list[2]} ${list[3]}
else
runOneInstance failedtests.tmp ${list[0]} ${list[1]} ${list[2]}
Modified: dmcs/branches/dmcs1.5/include/parser/Makefile.am
===================================================================
--- dmcs/branches/dmcs1.5/include/parser/Makefile.am 2012-11-29 12:28:58 UTC (rev 3298)
+++ dmcs/branches/dmcs1.5/include/parser/Makefile.am 2012-11-29 18:21:17 UTC (rev 3299)
@@ -5,6 +5,7 @@
BridgeRuleParser.h \
DLVResultGrammar.h \
DLVResultParser.h \
+ NewDLVResultParser.h \
ParserState.h \
QueryPlanParser.h \
ReturnPlanParser.h
Added: dmcs/branches/dmcs1.5/include/parser/NewDLVResultParser.h
===================================================================
--- dmcs/branches/dmcs1.5/include/parser/NewDLVResultParser.h (rev 0)
+++ dmcs/branches/dmcs1.5/include/parser/NewDLVResultParser.h 2012-11-29 18:21:17 UTC (rev 3299)
@@ -0,0 +1,101 @@
+/* DMCS -- Distributed Nonmonotonic Multi-Context Systems.
+ * Copyright (C) 2009, 2010 Minh Dao-Tran, Thomas Krennwallner
+ *
+ * This file is part of DMCS.
+ *
+ * DMCS is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * DMCS is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with DMCS. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/**
+ * @file NewDLVResultParser.h
+ * @author Minh Dao-Tran <da...@kr...>
+ * @date Thu Nov 29 17:53:40 2012
+ *
+ * @brief
+ *
+ *
+ */
+
+#ifndef ___NEW_DLV_RESULT_PARSER_H___
+#define ___NEW_DLV_RESULT_PARSER_H___
+
+#include "mcs/NewBeliefState.h"
+#include "mcs/BeliefTable.h"
+
+namespace {
+
+using namespace dmcs;
+
+struct SemState
+{
+ SemState(const BeliefTablePtr& btab,
+ const std::size_t ctx_id)
+ : btab(btab),
+ ctx_id(ctx_id)
+ { }
+
+
+ void
+ reset_current()
+ {
+ current = new NewBeliefState(BeliefStateOffset::instance()->NO_BLOCKS(),
+ BeliefStateOffset::instance()->SIZE_BS());
+
+ const std::vector<std::size_t>& starting_offsets = BeliefStateOffset::instance()->getStartingOffsets();
+ current->setEpsilon(ctx_id, starting_offsets);
+
+ std::size_t start_bit = starting_offsets[ctx_id] + 1;
+ std::size_t end_bit;
+ if (ctx_id == starting_offsets.size() - 1)
+ end_bit = current->status_bit.size();
+ else
+ end_bit = starting_offsets[ctx_id+1];
+
+ for (std::size_t i = start_bit; i < end_bit; ++i)
+ current->set(i, NewBeliefState::DMCS_FALSE);
+ }
+
+ BeliefTablePtr btab;
+ const std::size_t ctx_id;
+ NewBeliefState* current;
+};
+
+} // namespace
+
+/*******************************************************************************************/
+
+namespace dmcs {
+
+class NewDLVResultParser
+{
+public:
+ NewDLVResultParser(BeliefTablePtr btab,
+ const std::size_t ctx_id)
+ : state(btab, ctx_id)
+ { }
+
+ NewBeliefState* parseString(const std::string& instr);
+
+private:
+ SemState state;
+};
+
+} // namespace dmcs
+
+#endif // ___NEW_DLV_RESULT_PARSER_H___
+
+
+// Local Variables:
+// mode: C++
+// End:
Modified: dmcs/branches/dmcs1.5/src/parser/Makefile.am
===================================================================
--- dmcs/branches/dmcs1.5/src/parser/Makefile.am 2012-11-29 12:28:58 UTC (rev 3298)
+++ dmcs/branches/dmcs1.5/src/parser/Makefile.am 2012-11-29 18:21:17 UTC (rev 3299)
@@ -31,5 +31,6 @@
BridgeRuleParser.cpp \
DLVResultGrammar.cpp \
DLVResultParser.cpp \
+ NewDLVResultParser.cpp \
QueryPlanParser.cpp \
ReturnPlanParser.cpp
Added: dmcs/branches/dmcs1.5/src/parser/NewDLVResultParser.cpp
===================================================================
--- dmcs/branches/dmcs1.5/src/parser/NewDLVResultParser.cpp (rev 0)
+++ dmcs/branches/dmcs1.5/src/parser/NewDLVResultParser.cpp 2012-11-29 18:21:17 UTC (rev 3299)
@@ -0,0 +1,196 @@
+/* DMCS -- Distributed Nonmonotonic Multi-Context Systems.
+ * Copyright (C) 2009, 2010 Minh Dao-Tran, Thomas Krennwallner
+ *
+ * This file is part of DMCS.
+ *
+ * DMCS is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * DMCS is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with DMCS. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/**
+ * @file NewDLVResultParser.h
+ * @author Minh Dao-Tran <da...@kr...>
+ * @date Thu Nov 29 18:03:26 2012
+ *
+ * @brief
+ *
+ *
+ */
+
+#undef BOOST_SPIRIT_DEBUG
+#undef BOOST_SPIRIT_DEBUG_WS
+
+#include "mcs/BeliefStateOffset.h"
+#include "parser/NewDLVResultParser.h"
+
+#include <boost/config/warning_disable.hpp>
+#include <boost/spirit/include/qi.hpp>
+#include <boost/spirit/include/phoenix_core.hpp>
+#include <boost/spirit/include/phoenix_operator.hpp>
+#include <boost/spirit/include/phoenix_object.hpp>
+#include <boost/spirit/include/phoenix_fusion.hpp>
+#include <boost/spirit/include/phoenix_stl.hpp>
+#include <boost/fusion/include/adapt_struct.hpp>
+#include <boost/spirit/home/phoenix/statement/if.hpp>
+
+namespace {
+
+namespace qi = boost::spirit::qi;
+namespace ascii = boost::spirit::ascii;
+namespace phoenix = boost::phoenix;
+namespace fusion = boost::fusion;
+
+using namespace dmcs;
+
+template<typename Iterator>
+struct SkipperGrammar: boost::spirit::qi::grammar<Iterator>
+{
+ SkipperGrammar(): SkipperGrammar::base_type(ws)
+ {
+ using namespace boost::spirit;
+ ws = ascii::space
+ | qi::lexeme[ qi::char_('%') > *(qi::char_ - qi::eol) ];
+
+ #ifdef BOOST_SPIRIT_DEBUG_WS
+ BOOST_SPIRIT_DEBUG_NODE(ws);
+ #endif
+ }
+
+ boost::spirit::qi::rule<Iterator> ws;
+};
+
+
+struct HandleLiteral
+{
+ HandleLiteral(SemState& s) : s(s) { }
+
+ template<typename SourceAttributes, typename Context>
+ void
+ operator()(const SourceAttributes& source,
+ Context& ctx,
+ boost::spirit::qi::unused_type) const
+ {
+ const boost::fusion::vector2<boost::optional<char>, std::string>& attr = source;
+
+ bool strong_neg = boost::fusion::at_c<0>(attr);
+ const std::string& belief_text = boost::fusion::at_c<1>(attr);
+ ID belief_id = s.btab->getIDByString(belief_text);
+ assert (belief_id != ID_FAIL);
+
+ if (strong_neg)
+ {
+ s.current->set(s.ctx_id,
+ belief_id.address,
+ BeliefStateOffset::instance()->getStartingOffsets(),
+ NewBeliefState::DMCS_FALSE);
+ }
+ else
+ {
+ s.current->set(s.ctx_id,
+ belief_id.address,
+ BeliefStateOffset::instance()->getStartingOffsets());
+ }
+ }
+
+ SemState& s;
+};
+
+
+
+template<typename Iterator, typename Skipper>
+struct DLVResultGrammar : qi::grammar<Iterator, Skipper>
+{
+ DLVResultGrammar(SemState& state) : DLVResultGrammar::base_type(dlvline)
+ {
+ using qi::int_;
+ using qi::_val;
+ using qi::_1;
+ using qi::lexeme;
+ using qi::raw;
+ using qi::char_;
+ using qi::omit;
+ using qi::lit;
+
+ number =
+ lexeme[ char_('0') ]
+ | lexeme[ char_('1', '9') >> *(char_('0', '9')) ];
+
+ ident =
+ lexeme[char_('"') >> *(char_ - '"') >> char_('"')]
+ | (ascii::lower >> *(ascii::alnum|char_('_')));
+
+ ///TODO: When raw[] is not used, we won't get from 2nd arguments in the facts.
+ ///Something wrong with boost!!! try not to use raw[] with newer version of boost!
+ fact =
+ raw[ident >> -( char_('(') >> (ident | number) >> *(char_(',') >> (ident | number)) >> char_(')') )];
+
+ mlit = ( -char_('-') >> fact >> lit(',') ) [ HandleLiteral(state) ];
+ flit = ( -char_('-') >> fact >> lit('}') ) [ HandleLiteral(state) ];
+
+ answerset
+ = (lit('{') >> '}')
+ | (lit('{') >> *(mlit) >> flit);
+
+ costline
+ = lit("Cost") >> +(ascii::alnum | char_("[]<>():"));
+
+ dlvline
+ = (-lit("Best model:") >> answerset)
+ |
+ costline;
+ }
+
+ qi::rule<Iterator, Skipper> costline, answerset, mlit, flit, dlvline;
+ qi::rule<Iterator, std::string(), Skipper> ident, fact, number;
+
+};
+
+
+} // namespace
+
+/*******************************************************************************************/
+
+namespace dmcs {
+
+NewBeliefState* NewDLVResultParser::parseString(const std::string& instr)
+{
+ state.reset_current();
+
+ std::string::const_iterator begIt = instr.begin();
+ std::string::const_iterator endIt = instr.end();
+
+ typedef SkipperGrammar<std::string::const_iterator> Skipper;
+
+ Skipper skipper;
+
+ DLVResultGrammar<std::string::const_iterator, Skipper> grammar(state);
+
+ bool r = qi::phrase_parse(begIt, endIt, grammar, skipper);
+
+ if (r && begIt == endIt)
+ {
+ return state.current;
+ //std::cerr << "Bridge rules parsing succeeded" << std::endl;
+ }
+ else
+ {
+ //std::cerr << "Bridge rules parsing failed" << std::endl;
+ throw std::runtime_error("Bridge rules parsing failed");
+ }
+}
+
+} // namespace dmcs
+
+// Local Variables:
+// mode: C++
+// End:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mm...@us...> - 2012-11-29 12:29:10
|
Revision: 3298
http://dmcs.svn.sourceforge.net/dmcs/?rev=3298&view=rev
Author: mmsc
Date: 2012-11-29 12:28:58 +0000 (Thu, 29 Nov 2012)
Log Message:
-----------
Allow to exit after first loop.
Modified Paths:
--------------
dmcs/branches/dmcs1.5/include/dmcs/ProgramOptions.h
dmcs/branches/dmcs1.5/include/network/NewClient.h
dmcs/branches/dmcs1.5/src/generator/new_staticGen.cpp
dmcs/branches/dmcs1.5/src/network/NewClient.cpp
dmcs/branches/dmcs1.5/src/new_dmcsc.cpp
Modified: dmcs/branches/dmcs1.5/include/dmcs/ProgramOptions.h
===================================================================
--- dmcs/branches/dmcs1.5/include/dmcs/ProgramOptions.h 2012-11-29 12:01:26 UTC (rev 3297)
+++ dmcs/branches/dmcs1.5/include/dmcs/ProgramOptions.h 2012-11-29 12:28:58 UTC (rev 3298)
@@ -77,6 +77,7 @@
#define K2 "k2"
#define STARTUP_TIME "startup-time"
#define TIMEOUT "timeout"
+#define LOOP "loop"
} // namespace dmcs
Modified: dmcs/branches/dmcs1.5/include/network/NewClient.h
===================================================================
--- dmcs/branches/dmcs1.5/include/network/NewClient.h 2012-11-29 12:01:26 UTC (rev 3297)
+++ dmcs/branches/dmcs1.5/include/network/NewClient.h 2012-11-29 12:28:58 UTC (rev 3298)
@@ -42,7 +42,8 @@
NewClient(boost::asio::io_service& io_service,
boost::asio::ip::tcp::resolver::iterator endpoint_iterator,
const std::string& h,
- ForwardMessage& fwd_mess);
+ ForwardMessage& fwd_mess,
+ bool loop);
typedef void (*CallbackFunc)(ReturnedBeliefStateListPtr);
@@ -102,6 +103,7 @@
private:
connection_ptr conn;
CallbackFunc callback;
+ bool loop;
};
} // namespace dmcs
Modified: dmcs/branches/dmcs1.5/src/generator/new_staticGen.cpp
===================================================================
--- dmcs/branches/dmcs1.5/src/generator/new_staticGen.cpp 2012-11-29 12:01:26 UTC (rev 3297)
+++ dmcs/branches/dmcs1.5/src/generator/new_staticGen.cpp 2012-11-29 12:28:58 UTC (rev 3298)
@@ -890,7 +890,8 @@
std::size_t k1,
std::size_t k2,
std::string filename,
- bool want_log = false)
+ bool loop,
+ bool want_log)
{
std::ofstream file;
file.open(filename.c_str());
@@ -943,15 +944,67 @@
<< "--signature=" << testpath << "/client.qp "
<< "--belief-state-size=" << no_atoms << " "
<< "--k1=" << k1 << " "
- << "--k2=" << k2 << " "
- << " > " << prefix << ".log "
- << " 2> " << prefix << "-err.log" << std::endl;
+ << "--k2=" << k2 << " ";
+ if (loop)
+ {
+ file << "--loop=1 ";
+ }
+ else
+ {
+ file << "--loop=0 ";
+ }
+
+ file << "> " << prefix << ".log "
+ << "2> " << prefix << "-err.log" << std::endl;
+
file.close();
}
+std::string
+update_filename(const std::string& filename, const std::string& update_part)
+{
+ std::size_t dot_pos = filename.find(".");
+ assert (dot_pos != std::string::npos);
+
+ std::string new_filename = filename;
+ new_filename.insert(dot_pos, update_part);
+
+ return new_filename;
+}
+
+
void
+print_command_lines(const std::string& filename_text,
+ const std::string& filename_shell,
+ const std::string& filename_log_shell,
+ std::size_t k1,
+ std::size_t k2)
+{
+ // [k1,k2] == [0,0]
+ // or
+ // [k1,k2] == [1,pack_size]
+
+ print_command_lines_file(false, TESTDIR, dmcspath, k1, k2, filename_text, true, false);
+ print_command_lines_file(true, TESTDIR, dmcspath, k1, k2, filename_shell, true, false);
+ print_command_lines_file(true, TESTDIR, dmcspath, k1, k2, filename_log_shell, true, true);
+
+
+ if (k2 > 0)
+ {
+ std::string filename_unique_text = update_filename(filename_text, "-noloop");
+ std::string filename_unique_shell = update_filename(filename_shell, "-noloop");
+ std::string filename_unique_log_shell = update_filename(filename_log_shell, "-noloop");
+
+ print_command_lines_file(false, TESTDIR, dmcspath, k1, k2, filename_unique_text, false, false);
+ print_command_lines_file(true, TESTDIR, dmcspath, k1, k2, filename_unique_shell, false, false);
+ print_command_lines_file(true, TESTDIR, dmcspath, k1, k2, filename_unique_log_shell, false, true);
+ }
+}
+
+
+void
print_command_lines()
{
std::string filename_command_line_all = prefix + "-command-line-all.txt";
@@ -961,9 +1014,10 @@
std::string filename_command_line_opt_all_sh = prefix + "-command-line-opt-all.sh";
std::string filename_command_line_opt_all_log_sh = prefix + "-command-line-opt-all-log.sh";
- print_command_lines_file(false, TESTDIR, dmcspath, 0, 0, filename_command_line_all);
- print_command_lines_file(true, TESTDIR, dmcspath, 0, 0, filename_command_line_all_sh);
- print_command_lines_file(true, TESTDIR, dmcspath, 0, 0, filename_command_line_all_log_sh, true);
+ print_command_lines(filename_command_line_all,
+ filename_command_line_all_sh,
+ filename_command_line_all_log_sh,
+ 0, 0);
if (pack_size > 0)
{
@@ -973,9 +1027,10 @@
std::string filename_command_line_pack = prefix + "-command-line-" + out.str() + ".txt";
std::string filename_command_line_pack_sh = prefix + "-command-line-" + out.str() + ".sh";
std::string filename_command_line_pack_log_sh = prefix + "-command-line-" + out.str() + "-log.sh";
- print_command_lines_file(false, TESTDIR, dmcspath, 1, pack_size, filename_command_line_pack);
- print_command_lines_file(true, TESTDIR, dmcspath, 1, pack_size, filename_command_line_pack_sh);
- print_command_lines_file(true, TESTDIR, dmcspath, 1, pack_size, filename_command_line_pack_log_sh, true);
+ print_command_lines(filename_command_line_pack,
+ filename_command_line_pack_sh,
+ filename_command_line_pack_log_sh,
+ 1, pack_size);
}
OptionValueMap::iterator it = cmdline_options.find("returnplan");
@@ -984,9 +1039,9 @@
cmdline_options.insert(std::pair<std::string, std::string>("optqueryplan", prefix + ".oqp"));
- print_command_lines_file(false, TESTDIR, dmcspath, 0, 0, filename_command_line_opt_all);
- print_command_lines_file(true, TESTDIR, dmcspath, 0, 0, filename_command_line_opt_all_sh);
- print_command_lines_file(true, TESTDIR, dmcspath, 0, 0, filename_command_line_opt_all_log_sh, true);
+ print_command_lines(filename_command_line_opt_all,
+ filename_command_line_opt_all_sh,
+ filename_command_line_opt_all_log_sh, 0, 0);
if (pack_size > 0)
{
@@ -996,9 +1051,10 @@
std::string filename_command_line_opt_pack_sh = prefix + "-command-line-opt-" + out.str() + ".sh";
std::string filename_command_line_opt_pack_log_sh = prefix + "-command-line-opt-" + out.str() + "-log.sh";
- print_command_lines_file(false, TESTDIR, dmcspath, 1, pack_size, filename_command_line_opt_pack);
- print_command_lines_file(true, TESTDIR, dmcspath, 1, pack_size, filename_command_line_opt_pack_sh);
- print_command_lines_file(true, TESTDIR, dmcspath, 1, pack_size, filename_command_line_opt_pack_log_sh, true);
+ print_command_lines(filename_command_line_opt_pack,
+ filename_command_line_opt_pack_sh,
+ filename_command_line_opt_pack_log_sh,
+ 1, pack_size);
}
}
Modified: dmcs/branches/dmcs1.5/src/network/NewClient.cpp
===================================================================
--- dmcs/branches/dmcs1.5/src/network/NewClient.cpp 2012-11-29 12:01:26 UTC (rev 3297)
+++ dmcs/branches/dmcs1.5/src/network/NewClient.cpp 2012-11-29 12:28:58 UTC (rev 3298)
@@ -43,9 +43,11 @@
NewClient::NewClient(boost::asio::io_service& io_service,
boost::asio::ip::tcp::resolver::iterator endpoint_iterator,
const std::string& h,
- ForwardMessage& fwd_mess)
+ ForwardMessage& fwd_mess,
+ bool loop = true)
: conn(new connection(io_service)),
- callback(0)
+ callback(0),
+ loop(loop)
{
boost::asio::ip::tcp::endpoint endpoint = *endpoint_iterator;
@@ -229,8 +231,12 @@
callback(result_list);
}
- if (next_k == 0)
+ if (!loop)
{
+ DBGLOG(DBG, "NewClient::handle_read_answer(): Only once round required. Let's get back.");
+ }
+ else if (next_k == 0)
+ {
DBGLOG(DBG, "NewClient::handle_read_answer(): Done. Let's get back.");
}
else
Modified: dmcs/branches/dmcs1.5/src/new_dmcsc.cpp
===================================================================
--- dmcs/branches/dmcs1.5/src/new_dmcsc.cpp 2012-11-29 12:01:26 UTC (rev 3297)
+++ dmcs/branches/dmcs1.5/src/new_dmcsc.cpp 2012-11-29 12:28:58 UTC (rev 3298)
@@ -205,6 +205,7 @@
std::string port;
std::string filename_signature = "";
std::size_t root_ctx;
+ bool loop;
// range of requested equilibria. [0,0] for requesting all equilibria
std::size_t k1;
std::size_t k2;
@@ -220,6 +221,7 @@
(ROOT_CTX, boost::program_options::value<std::size_t>(&root_ctx)->default_value(0), "set root context id to query")
(SIGNATURE, boost::program_options::value<std::string>(&filename_signature)->default_value(""), "set signature file name")
(BS_SIZE, boost::program_options::value<std::size_t>(&bs_size), "set belief state size")
+ (LOOP, boost::program_options::value<bool>(&loop)->default_value(true), "set belief state size")
(K1, boost::program_options::value<std::size_t>(&k1)->default_value(1), "set starting range of requested equlibria. k1 <= k2")
(K2, boost::program_options::value<std::size_t>(&k2)->default_value(1), "set end range of requested equilibria. [0,0] for requesting all equilibria")
;
@@ -265,7 +267,7 @@
ForwardMessage request(qid, history, k1, k2);
ForwardMessage end_message(end_qid, history);
- NewClient client(*io_service, it, header, request);
+ NewClient client(*io_service, it, header, request, loop);
client.setCallback(&handle_belief_states);
if (!filename_signature.empty())
@@ -313,12 +315,12 @@
diff_count = final_result.size() - diff_count;
next_count++;
- /*if (!unique)
+ if (!loop)
{
- DBGLOG(DBG, "new_dmcsc: Do not need unique answers. Going to terminate the client after 1st round.");
+ DBGLOG(DBG, "new_dmcsc: Do not require looping. Going to terminate the client after 1st round.");
client.terminate(end_message);
break;
- }*/
+ }
if (last_round)
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mm...@us...> - 2012-11-29 12:01:38
|
Revision: 3297
http://dmcs.svn.sourceforge.net/dmcs/?rev=3297&view=rev
Author: mmsc
Date: 2012-11-29 12:01:26 +0000 (Thu, 29 Nov 2012)
Log Message:
-----------
Fix a bug regarding joining conflict models.
Modified Paths:
--------------
dmcs/branches/dmcs1.5/include/mcs/NewContext.h
dmcs/branches/dmcs1.5/src/mcs/NewContext.cpp
dmcs/branches/dmcs1.5/src/network/NewClient.cpp
dmcs/branches/dmcs1.5/src/new_dmcsc.cpp
Modified: dmcs/branches/dmcs1.5/include/mcs/NewContext.h
===================================================================
--- dmcs/branches/dmcs1.5/include/mcs/NewContext.h 2012-11-23 21:39:18 UTC (rev 3296)
+++ dmcs/branches/dmcs1.5/include/mcs/NewContext.h 2012-11-29 12:01:26 UTC (rev 3297)
@@ -79,7 +79,7 @@
EvaluatorPtr eval,
NewConcurrentMessageDispatcherPtr md);
- std::size_t
+ std::pair<std::size_t, std::size_t>
read_and_send(std::size_t parent_qid,
bool normal_solve,
EvaluatorPtr eval,
Modified: dmcs/branches/dmcs1.5/src/mcs/NewContext.cpp
===================================================================
--- dmcs/branches/dmcs1.5/src/mcs/NewContext.cpp 2012-11-23 21:39:18 UTC (rev 3296)
+++ dmcs/branches/dmcs1.5/src/mcs/NewContext.cpp 2012-11-29 12:01:26 UTC (rev 3297)
@@ -153,15 +153,25 @@
DBGLOG(DBG, "NewContext::read_and_send_k1_k2(): k1 = " << k1 << ", k2 = " << k2);
if (k1 == 0 && k2 == 0)
{
- std::size_t models_sent = read_and_send(parent_qid, normal_solve, eval, md);
+ std::pair<std::size_t, std::size_t> p = read_and_send(parent_qid, normal_solve, eval, md);
+ std::size_t models_sent = p.first;
+ std::size_t conflict_models = p.second;
}
else
{
- std::size_t models_sent = read_and_send(parent_qid, normal_solve, eval, md);
+ std::pair<std::size_t, std::size_t> p = read_and_send(parent_qid, normal_solve, eval, md);
+ std::size_t models_sent = p.first;
+ std::size_t conflict_models = p.second;
std::size_t models_counter = eval->getModelsCounter();
- DBGLOG(DBG, "NewContext::read_and_send_k1_k2(): models_counter = " << models_counter);
- DBGLOG(DBG, "NewContext::read_and_send_k1_k2(): models_sent = " << models_sent);
+ DBGLOG(DBG, "NewContext::read_and_send_k1_k2(): models_counter = " << models_counter);
+ DBGLOG(DBG, "NewContext::read_and_send_k1_k2(): conflict_models = " << conflict_models);
+ DBGLOG(DBG, "NewContext::read_and_send_k1_k2(): models_sent = " << models_sent);
+
+ assert (conflict_models <= models_counter);
+ models_counter -= conflict_models;
+
+ DBGLOG(DBG, "NewContext::read_and_send_k1_k2(): non-conflict models_counter = " << models_counter);
if (models_sent == 0)
// there was no model in the range [k1,k2]. models_counter are the number of models before k1.
@@ -191,13 +201,15 @@
// Read from EVAL_OUT_MQ[index] until getting (heads, NULL).
// Return the number of models received.
// Note that this function doesn't care about (k1, k2). The Evaluator and the outter loop take care of this issue.
-std::size_t
+std::pair<std::size_t, std::size_t>
NewContext::read_and_send(std::size_t parent_qid,
bool normal_solve,
EvaluatorPtr eval,
NewConcurrentMessageDispatcherPtr md)
{
- std::size_t models_counter = 0;
+ std::size_t models_sent = 0;
+ std::size_t conflict_models = 0;
+
int timeout = 0;
while (1)
{
@@ -220,17 +232,18 @@
DBGLOG(DBG, "NewContext[" << ctx_id << "]::read_and_send(). Got res = " << *belief_state);
if (send_out_result(parent_qid, normal_solve, heads, belief_state, md))
{
- ++models_counter;
+ ++models_sent;
DBGLOG(DBG, "NewContext[" << ctx_id << "]::read_and_send(). successfully sent.");
}
else
{
+ ++conflict_models;
DBGLOG(DBG, "NewContext[" << ctx_id << "]::read_and_send().NOT sent due to wrong guess.");
}
}
}
- return models_counter;
+ return std::make_pair<std::size_t, std::size_t>(models_sent, conflict_models);
}
Modified: dmcs/branches/dmcs1.5/src/network/NewClient.cpp
===================================================================
--- dmcs/branches/dmcs1.5/src/network/NewClient.cpp 2012-11-23 21:39:18 UTC (rev 3296)
+++ dmcs/branches/dmcs1.5/src/network/NewClient.cpp 2012-11-29 12:01:26 UTC (rev 3297)
@@ -215,8 +215,8 @@
std::size_t pack_size = mess->getPackSize();
std::size_t next_k = 0;
- DBGLOG(DBG, "result_list.size() = " << result_list->size());
- DBGLOG(DBG, "pack_size = " << pack_size);
+ DBGLOG(DBG, "NewClient::handle_read_answer: result_list.size() = " << result_list->size());
+ DBGLOG(DBG, "NewClient::handle_read_answer: pack_size = " << pack_size);
if (pack_size > 0)
{
Modified: dmcs/branches/dmcs1.5/src/new_dmcsc.cpp
===================================================================
--- dmcs/branches/dmcs1.5/src/new_dmcsc.cpp 2012-11-23 21:39:18 UTC (rev 3296)
+++ dmcs/branches/dmcs1.5/src/new_dmcsc.cpp 2012-11-29 12:01:26 UTC (rev 3297)
@@ -304,7 +304,7 @@
while (keep_running)
{
- DBGLOG(DBG, "Entering round " << next_count);
+ DBGLOG(DBG, "new_dmcsc: Entering round " << next_count);
io_service->run();
last_model_count = model_count;
@@ -313,6 +313,13 @@
diff_count = final_result.size() - diff_count;
next_count++;
+ /*if (!unique)
+ {
+ DBGLOG(DBG, "new_dmcsc: Do not need unique answers. Going to terminate the client after 1st round.");
+ client.terminate(end_message);
+ break;
+ }*/
+
if (last_round)
{
keep_running = false;
@@ -326,6 +333,7 @@
std::size_t left_to_request = pack_size - final_result.size();
k1 = k2 + 1;
k2 = k1 + left_to_request;
+ DBGLOG(DBG, "new_dmcsc: Going to ask for next. k1 = " << k1 << ", k2 = " << k2);
request.setPackRequest(k1, k2);
client.next(request);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mm...@us...> - 2012-11-23 21:39:24
|
Revision: 3296
http://dmcs.svn.sourceforge.net/dmcs/?rev=3296&view=rev
Author: mmsc
Date: 2012-11-23 21:39:18 +0000 (Fri, 23 Nov 2012)
Log Message:
-----------
Fix neighbor offset initialization.
Modified Paths:
--------------
dmcs/branches/dmcs1.5/include/mcs/NormalContext.h
dmcs/branches/dmcs1.5/include/network/NewConcurrentMessageDispatcher.tcc
dmcs/branches/dmcs1.5/src/generator/new_staticGen.cpp
dmcs/branches/dmcs1.5/src/mcs/NormalContext.cpp
dmcs/branches/dmcs1.5/src/network/NewServer.cpp
dmcs/branches/dmcs1.5/src/network/NewThreadFactory.cpp
dmcs/branches/dmcs1.5/src/new_dmcsd.cpp
Modified: dmcs/branches/dmcs1.5/include/mcs/NormalContext.h
===================================================================
--- dmcs/branches/dmcs1.5/include/mcs/NormalContext.h 2012-11-21 20:21:09 UTC (rev 3295)
+++ dmcs/branches/dmcs1.5/include/mcs/NormalContext.h 2012-11-23 21:39:18 UTC (rev 3296)
@@ -80,6 +80,9 @@
init();
bool
+ must_guess(NewBeliefState* input);
+
+ bool
process_input(NewBeliefState* input,
std::size_t parent_qid,
EvaluatorPtr eval,
Modified: dmcs/branches/dmcs1.5/include/network/NewConcurrentMessageDispatcher.tcc
===================================================================
--- dmcs/branches/dmcs1.5/include/network/NewConcurrentMessageDispatcher.tcc 2012-11-21 20:21:09 UTC (rev 3295)
+++ dmcs/branches/dmcs1.5/include/network/NewConcurrentMessageDispatcher.tcc 2012-11-23 21:39:18 UTC (rev 3296)
@@ -30,6 +30,8 @@
#ifndef NEW_CONCURRENT_MESSAGE_DISPATCHER_TCC
#define NEW_CONCURRENT_MESSAGE_DISPATCHER_TCC
+#include "mcs/Logger.h"
+
namespace dmcs {
template<typename MessageType>
@@ -37,6 +39,7 @@
NewConcurrentMessageDispatcher::send(MQIDs id, MessageType* mess, int msecs)
{
assert (id < SEPARATOR);
+ DBGLOG(DBG, "NewConcurrentMessageDispatcher::send(" << id << ")");
ConcurrentMessageQueuePtr cmq = getMQ(id);
return send(cmq.get(), mess, msecs);
}
@@ -49,6 +52,7 @@
MessageType* mess, int msecs)
{
assert (SEPARATOR < type && type < END_OF_MQ);
+ DBGLOG(DBG, "NewConcurrentMessageDispatcher::send(" << type << ", " << id << ")");
ConcurrentMessageQueuePtr cmq = getMQ(type, id);
return send(cmq.get(), mess, msecs);
}
@@ -87,6 +91,7 @@
NewConcurrentMessageDispatcher::receive(MQIDs id, int msecs)
{
assert (id < SEPARATOR);
+ DBGLOG(DBG, "NewConcurrentMessageDispatcher::receive(" << id << ")");
ConcurrentMessageQueuePtr cmq = getMQ(id);
return receive<MessageType>(cmq.get(), msecs);
}
@@ -98,6 +103,7 @@
NewConcurrentMessageDispatcher::receive(MQIDs type, std::size_t id, int msecs)
{
assert (SEPARATOR < type && type < END_OF_MQ);
+ DBGLOG(DBG, "NewConcurrentMessageDispatcher::receive(" << type << ", " << id << ")");
ConcurrentMessageQueuePtr cmq = getMQ(type, id);
return receive<MessageType>(cmq.get(), msecs);
}
Modified: dmcs/branches/dmcs1.5/src/generator/new_staticGen.cpp
===================================================================
--- dmcs/branches/dmcs1.5/src/generator/new_staticGen.cpp 2012-11-21 20:21:09 UTC (rev 3295)
+++ dmcs/branches/dmcs1.5/src/generator/new_staticGen.cpp 2012-11-23 21:39:18 UTC (rev 3296)
@@ -498,7 +498,10 @@
}
// then adjust to get optimal local interface
- opt_topo_gen->create_opt_interface();
+ if (topology_type != BINARY_TREE_TOPOLOGY)
+ {
+ opt_topo_gen->create_opt_interface();
+ }
//#ifdef DEBUG
DBGLOG(DBG, "Optimal local interface:");
@@ -685,7 +688,7 @@
file_client_qp.close();
// context specific query plans #############################################################################
- for (std::size_t i = 0; i < no_contexts; ++i)
+ for (int i = no_contexts-1; i >= 0; --i)
{
std::stringstream str_i;
str_i << i;
@@ -736,7 +739,7 @@
for (std::size_t j = 0; j < starting_offset[1]; ++j)
bs->set(j);
- for (LocalInterfaceMap::const_iterator it = opt_lcim->begin(); it != opt_lcim->end(); ++it)
+ for (LocalInterfaceMap::const_iterator it = lcim->begin(); it != lcim->end(); ++it)
{
ContextPair cp = it->first;
if (cp.first == 0)
@@ -1212,7 +1215,7 @@
print_command_lines();
if (topology_type != RANDOM_TOPOLOGY && topology_type != DIAMOND_ARBITRARY_TOPOLOGY &&
- topology_type != RING_EDGE_TOPOLOGY && topology_type != BINARY_TREE_TOPOLOGY)
+ topology_type != RING_EDGE_TOPOLOGY)
{
generate_opt_topology();
write_plans(true);
Modified: dmcs/branches/dmcs1.5/src/mcs/NormalContext.cpp
===================================================================
--- dmcs/branches/dmcs1.5/src/mcs/NormalContext.cpp 2012-11-21 20:21:09 UTC (rev 3295)
+++ dmcs/branches/dmcs1.5/src/mcs/NormalContext.cpp 2012-11-23 21:39:18 UTC (rev 3296)
@@ -212,7 +212,30 @@
}
+bool
+NormalContext::must_guess(NewBeliefState* input)
+{
+ if (total_guessing_input == NULL)
+ return false;
+ // if for one of the guessing neighbor, the epsilon bit is OFF then we also have to guess
+ //
+ ///@todo: can be made more efficient by determining neighbors that needs guess
+ for (NewNeighborVec::const_iterator it = guessing_neighbors->begin(); it != guessing_neighbors->end(); ++it)
+ {
+ NewNeighborPtr neighbor = *it;
+ std::size_t neighbor_id = neighbor->neighbor_id;
+
+ if (input->isEpsilon(neighbor_id, BeliefStateOffset::instance()->getStartingOffsets()))
+ {
+ return true;
+ }
+ }
+
+ return false;
+}
+
+
bool
NormalContext::process_input(NewBeliefState* input,
std::size_t parent_qid,
@@ -221,7 +244,7 @@
std::size_t& k1,
std::size_t& k2)
{
- if (total_guessing_input != NULL)
+ if (must_guess(input))
{
NewBeliefState* current_guess = new NewBeliefState(BeliefStateOffset::instance()->NO_BLOCKS(),
BeliefStateOffset::instance()->SIZE_BS());
Modified: dmcs/branches/dmcs1.5/src/network/NewServer.cpp
===================================================================
--- dmcs/branches/dmcs1.5/src/network/NewServer.cpp 2012-11-21 20:21:09 UTC (rev 3295)
+++ dmcs/branches/dmcs1.5/src/network/NewServer.cpp 2012-11-23 21:39:18 UTC (rev 3296)
@@ -285,18 +285,22 @@
reg->joiner_dispatcher = NewJoinerDispatcherPtr(new NewJoinerDispatcher);
}
+ DBGLOG(DBG, "NewServer::initialize(): create main threads.");
thread_factory->createMainThreads(reg->message_dispatcher,
reg->request_dispatcher,
reg->output_dispatcher,
reg->joiner_dispatcher);
+ DBGLOG(DBG, "NewServer::initialize(): create context threads.");
thread_factory->createContextThreads(reg->contexts,
reg->message_dispatcher,
reg->request_dispatcher,
reg->joiner_dispatcher);
+ DBGLOG(DBG, "NewServer::initialize(): second initialization phase DONE.");
}
+
void
NewServer::handle_accept(const boost::system::error_code& e,
connection_ptr conn)
Modified: dmcs/branches/dmcs1.5/src/network/NewThreadFactory.cpp
===================================================================
--- dmcs/branches/dmcs1.5/src/network/NewThreadFactory.cpp 2012-11-21 20:21:09 UTC (rev 3295)
+++ dmcs/branches/dmcs1.5/src/network/NewThreadFactory.cpp 2012-11-23 21:39:18 UTC (rev 3296)
@@ -136,6 +136,7 @@
for (NewNeighborVec::const_iterator it = neighbors->begin();
it != neighbors->end(); ++it)
{
+ DBGLOG(DBG, "NewThreadFactory::createNeighborThreads: neighbor = " << **it);
NewNeighborThreadPtr neighbor(new NewNeighborThread(*it));
NewNeighborThreadWrapper neighbor_wrapper;
boost::thread* neighbor_thread = new boost::thread(neighbor_wrapper, neighbor, md);
Modified: dmcs/branches/dmcs1.5/src/new_dmcsd.cpp
===================================================================
--- dmcs/branches/dmcs1.5/src/new_dmcsd.cpp 2012-11-21 20:21:09 UTC (rev 3295)
+++ dmcs/branches/dmcs1.5/src/new_dmcsd.cpp 2012-11-23 21:39:18 UTC (rev 3296)
@@ -130,7 +130,6 @@
ReturnPlanMapPtr return_plan = ReturnPlanParser::parseFile(filename_return_plan);
- std::cerr << filename_opt_query_plan << std::endl;
ContextQueryPlanMapPtr opt_queryplan_map = ContextQueryPlanMapPtr();
if (filename_opt_query_plan != "")
{
@@ -180,6 +179,22 @@
}
}
}
+
+ // reassign neighbors' offsets
+ std::size_t new_neighbor_offset = 0;
+ for (NewNeighborVec::iterator it = physical_neighbors->begin(); it != physical_neighbors->end(); ++it)
+ {
+ NewNeighborPtr neighbor = *it;
+ neighbor->neighbor_offset = new_neighbor_offset;
+ new_neighbor_offset++;
+ }
+
+ for (NewNeighborVec::iterator it = guessing_neighbors->begin(); it != guessing_neighbors->end(); ++it)
+ {
+ NewNeighborPtr neighbor = *it;
+ neighbor->neighbor_offset = new_neighbor_offset;
+ new_neighbor_offset++;
+ }
}
else
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mm...@us...> - 2012-11-21 20:21:16
|
Revision: 3295
http://dmcs.svn.sourceforge.net/dmcs/?rev=3295&view=rev
Author: mmsc
Date: 2012-11-21 20:21:09 +0000 (Wed, 21 Nov 2012)
Log Message:
-----------
Display number of collected models in case of timeout.
Modified Paths:
--------------
dmcs/branches/dmcs1.5/examples/test/tables.py
Modified: dmcs/branches/dmcs1.5/examples/test/tables.py
===================================================================
--- dmcs/branches/dmcs1.5/examples/test/tables.py 2012-11-21 16:21:13 UTC (rev 3294)
+++ dmcs/branches/dmcs1.5/examples/test/tables.py 2012-11-21 20:21:09 UTC (rev 3295)
@@ -88,7 +88,24 @@
return no_answers
+def get_no_intermediate_answers(filename):
+ no_answers = '---'
+ print'"filename = ' + filename
+ with open(filename, 'r') as f:
+ lines = f.readlines()
+ if len(lines) > 0:
+ last_line = lines[len(lines)-1]
+ print 'last_line = ' + last_line
+ sign = last_line.find('Received partial equilibria:')
+ if sign != -1:
+ no_answers = last_line[sign + len('Received partial equilibria:') + 1 : len(last_line)-1]
+ print 'no_answers = ' + no_answers
+ f.closed
+ return no_answers
+
+
def get_outcome(toponame, dirname):
+ err_filename = dirname + '/' + toponame + '-err.log'
status_filename = dirname + '/' + toponame + '-status.log'
time_filename = dirname + '/' + toponame + '-time.log'
log_filename = dirname + '/' + toponame + '.log'
@@ -108,6 +125,7 @@
noans = get_no_answers(log_filename)
else:
outcome = get_error_code(time_filename)
+ noans = get_no_intermediate_answers(err_filename)
return outcome, noans
@@ -125,14 +143,6 @@
-def peek(outcomes):
- for oc in outcomes:
- print oc[0][0]
-
- print "\n"
-
-
-
def ordered_push(outcomes, outcome, sorted_testcases, testcase):
if outcomes == []:
outcomes.append(outcome)
@@ -145,7 +155,6 @@
while i < len(outcomes):
old_val = float(outcomes[i][0][0])
i = i + 1
- print "Compare: " + str(old_val) + " and " + str(new_val)
if old_val > new_val:
found = True
break
@@ -157,7 +166,6 @@
outcomes.insert(i, outcome)
sorted_testcases.insert(i, testcase)
- peek(outcomes)
def process_test_cases(toponame, testpacks, current_test_case):
@@ -192,6 +200,15 @@
+def nice_display(time, val):
+ if time == '1000124':
+ return '(' + val + ')'
+ elif time == '10001':
+ return 'E'
+ else:
+ return time
+
+
def build_row(tex_output, tex_row_template,
outcomes, sorted_testcases,
topo, topo_abbr):
@@ -205,6 +222,8 @@
mem = topo + '-' + instance[1] + '-' + instance[2] + '-' + instance[3] + '-' + instance[4] + '-' + instance[5]
str_i = '{' + str(i+1) + '}'
+ print outcome
+
tex_output.write(tex_row_template.format(mem,
topo_abbr,
str_i,
@@ -216,12 +235,12 @@
final_display(outcome[0][1]),
final_display(outcome[1][0]),
final_display(outcome[1][1]),
- final_display(outcome[2][0]),
- final_display(outcome[3][0]),
- final_display(outcome[4][0]),
- final_display(outcome[5][0]),
- final_display(outcome[6][0]),
- final_display(outcome[7][0])))
+ nice_display(outcome[2][0], outcome[2][1]),
+ nice_display(outcome[3][0], outcome[3][1]),
+ nice_display(outcome[4][0], outcome[4][1]),
+ nice_display(outcome[5][0], outcome[5][1]),
+ nice_display(outcome[6][0], outcome[6][1]),
+ nice_display(outcome[7][0], outcome[7][1])))
def main(argv):
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mm...@us...> - 2012-11-21 16:21:21
|
Revision: 3294
http://dmcs.svn.sourceforge.net/dmcs/?rev=3294&view=rev
Author: mmsc
Date: 2012-11-21 16:21:13 +0000 (Wed, 21 Nov 2012)
Log Message:
-----------
Update scripts.
Modified Paths:
--------------
dmcs/branches/dmcs1.5/examples/test/runTest.sh
dmcs/branches/dmcs1.5/examples/test/tables.py
Modified: dmcs/branches/dmcs1.5/examples/test/runTest.sh
===================================================================
--- dmcs/branches/dmcs1.5/examples/test/runTest.sh 2012-11-21 10:48:28 UTC (rev 3293)
+++ dmcs/branches/dmcs1.5/examples/test/runTest.sh 2012-11-21 16:21:13 UTC (rev 3294)
@@ -1,7 +1,8 @@
#!/bin/bash
DOECHO=yes
-WANTLOG=yes
+WANTLOG=no
+MAXTRY=4
EMA...@kr...
testpack[0]="all"
@@ -70,20 +71,37 @@
wantOpt=-opt
fi
- echo "Run "$teName $tpack $runOpt
- bash $toName-command-line$wantOpt-$tpack$wantlog.sh
- RETVAL=$?
- echo $RETVAL
+ for (( i = 1; i <= $MAXTRY; ++i)) ; do
+ if [ $i -eq 1 ] ; then
+ echo "Run "$teName $tpack $runOpt
+ else
+ echo "Retry($i) "$teName $tpack $runOpt
+ fi
- if [ $RETVAL = 0 ] ; then
- echo "PASSED: $teName $tpack $runOpt" > $toName-status.log
- echo $toName,$teName,$tpack,$runOpt >> $basedir/passedtests.log
- (cat $toName-time.log ; echo ; cat $toName.log ; echo ; cat $toName-err.log) | mail -s "PASSED: dmcs testcase on GLUCK: $teName $tpack $runOpt" $EMAIL
- else
- echo "FAILED: $teName $tpack $runOpt" > $toName-status.log
- echo $toName,$teName,$tpack,$runOpt >> $basedir/$filename
- (cat $toName-time.log ; echo ; cat $toName.log ; echo ; cat $toName-err.log) | mail -s "FAILED: dmcs testcase on GLUCK: $teName $tpack $runOpt" $EMAIL
- fi
+ bash $toName-command-line$wantOpt-$tpack$wantlog.sh
+ RETVAL=$?
+ echo $RETVAL
+
+ if [ $RETVAL -eq 0 ] ; then
+ echo "PASSED: $teName $tpack $runOpt" > $toName-status.log
+ echo $toName,$teName,$tpack,$runOpt >> $basedir/passedtests.log
+ (cat $toName-time.log ; echo ; cat $toName.log ; echo ; cat $toName-err.log) | mail -s "PASSED: dmcs testcase on GLUCK: $teName $tpack $runOpt" $EMAIL
+ break
+ elif [ $RETVAL -eq 124 ] ; then
+ echo "TIMEOUT: $teName $tpack $runOpt" > $toName-status.log
+ echo $toName,$teName,$tpack,$runOpt >> $basedir/timeouttests.log
+ (cat $toName-time.log ; echo ; cat $toName.log ; echo ; cat $toName-err.log) | mail -s "TIMEOUT: dmcs testcase on GLUCK: $teName $tpack $runOpt" $EMAIL
+ break
+ else
+ if [ $i -eq $MAXtRY ] ; then
+ echo "FAILED: $teName $tpack $runOpt" > $toName-status.log
+ echo $toName,$teName,$tpack,$runOpt >> $basedir/$filename
+ (cat $toName-time.log ; echo ; cat $toName.log ; echo ; cat $toName-err.log) | mail -s "FAILED: dmcs testcase on GLUCK: $teName $tpack $runOpt" $EMAIL
+ else
+ (cat $toName-time.log ; echo ; cat $toName.log ; echo ; cat $toName-err.log) | mail -s "FAILED($i): dmcs testcase on GLUCK: $teName $tpack $runOpt" $EMAIL
+ fi
+ fi
+ done
moveLogFiles $toName $teName $tpack $runOpt
} # end of runOneInstance
Modified: dmcs/branches/dmcs1.5/examples/test/tables.py
===================================================================
--- dmcs/branches/dmcs1.5/examples/test/tables.py 2012-11-21 10:48:28 UTC (rev 3293)
+++ dmcs/branches/dmcs1.5/examples/test/tables.py 2012-11-21 16:21:13 UTC (rev 3294)
@@ -125,6 +125,14 @@
+def peek(outcomes):
+ for oc in outcomes:
+ print oc[0][0]
+
+ print "\n"
+
+
+
def ordered_push(outcomes, outcome, sorted_testcases, testcase):
if outcomes == []:
outcomes.append(outcome)
@@ -132,18 +140,28 @@
else:
i = 0
new_val = float(outcome[0][0])
+ found = False
+
while i < len(outcomes):
old_val = float(outcomes[i][0][0])
i = i + 1
+ print "Compare: " + str(old_val) + " and " + str(new_val)
if old_val > new_val:
+ found = True
break
- outcomes.insert(i-1, outcome)
- sorted_testcases.insert(i-1, testcase)
+ if found == True:
+ outcomes.insert(i-1, outcome)
+ sorted_testcases.insert(i-1, testcase)
+ else:
+ outcomes.insert(i, outcome)
+ sorted_testcases.insert(i, testcase)
+ peek(outcomes)
+
def process_test_cases(toponame, testpacks, current_test_case):
- outcomes = []
+ outcomes = [ ]
sorted_testcases = []
test_runs = []
@@ -182,8 +200,8 @@
outcome = outcomes[i]
instance = sorted_testcases[i]
- print len(outcome)
- print instance
+ #print len(outcome)
+ #print instance
mem = topo + '-' + instance[1] + '-' + instance[2] + '-' + instance[3] + '-' + instance[4] + '-' + instance[5]
str_i = '{' + str(i+1) + '}'
@@ -249,10 +267,10 @@
outcomes, sorted_testcases,
topo, topo_abbreviation[topo])
- print outcomes
- print "\n"
- print sorted_testcases
- print "\n"
+ #print outcomes
+ #print "\n"
+ #print sorted_testcases
+ #print "\n"
if line == "":
break
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mm...@us...> - 2012-11-21 10:48:39
|
Revision: 3293
http://dmcs.svn.sourceforge.net/dmcs/?rev=3293&view=rev
Author: mmsc
Date: 2012-11-21 10:48:28 +0000 (Wed, 21 Nov 2012)
Log Message:
-----------
Fix bugs in the computation loop of NormalContext.
Modified Paths:
--------------
dmcs/branches/dmcs1.5/include/mcs/NormalContext.h
dmcs/branches/dmcs1.5/src/mcs/NewContext.cpp
dmcs/branches/dmcs1.5/src/mcs/NormalContext.cpp
dmcs/branches/dmcs1.5/src/mcs/StreamingJoiner.cpp
dmcs/branches/dmcs1.5/src/parser/DLVResultParser.cpp
Modified: dmcs/branches/dmcs1.5/include/mcs/NormalContext.h
===================================================================
--- dmcs/branches/dmcs1.5/include/mcs/NormalContext.h 2012-11-20 22:27:55 UTC (rev 3292)
+++ dmcs/branches/dmcs1.5/include/mcs/NormalContext.h 2012-11-21 10:48:28 UTC (rev 3293)
@@ -79,6 +79,14 @@
void
init();
+ bool
+ process_input(NewBeliefState* input,
+ std::size_t parent_qid,
+ EvaluatorPtr eval,
+ NewConcurrentMessageDispatcherPtr md,
+ std::size_t& k1,
+ std::size_t& k2);
+
void
process_request(std::size_t parent_qid,
const NewHistory& history,
Modified: dmcs/branches/dmcs1.5/src/mcs/NewContext.cpp
===================================================================
--- dmcs/branches/dmcs1.5/src/mcs/NewContext.cpp 2012-11-20 22:27:55 UTC (rev 3292)
+++ dmcs/branches/dmcs1.5/src/mcs/NewContext.cpp 2012-11-21 10:48:28 UTC (rev 3293)
@@ -265,6 +265,7 @@
}
(*belief_state) = (*belief_state) | (*input_bs);
+ DBGLOG(DBG, "NewContext::send_out_result(): combined bs = " << *belief_state);
}
// otherwise, this context broke a cycle and we don't have input_bs
Modified: dmcs/branches/dmcs1.5/src/mcs/NormalContext.cpp
===================================================================
--- dmcs/branches/dmcs1.5/src/mcs/NormalContext.cpp 2012-11-20 22:27:55 UTC (rev 3292)
+++ dmcs/branches/dmcs1.5/src/mcs/NormalContext.cpp 2012-11-21 10:48:28 UTC (rev 3293)
@@ -212,79 +212,82 @@
}
-void
-NormalContext::process_request(std::size_t parent_qid,
- const NewHistory& history,
- EvaluatorPtr eval,
- NewConcurrentMessageDispatcherPtr md,
- NewJoinerDispatcherPtr jd,
- std::size_t k1,
- std::size_t k2)
+
+bool
+NormalContext::process_input(NewBeliefState* input,
+ std::size_t parent_qid,
+ EvaluatorPtr eval,
+ NewConcurrentMessageDispatcherPtr md,
+ std::size_t& k1,
+ std::size_t& k2)
{
- assert ((k1 == 0 && k2 == 0) || (0 < k1 && k1 < k2+1));
- NewBeliefState* input;
-
- while (1)
+ if (total_guessing_input != NULL)
{
- // prepare the fixed part of the input
- if (!is_leaf)
+ NewBeliefState* current_guess = new NewBeliefState(BeliefStateOffset::instance()->NO_BLOCKS(),
+ BeliefStateOffset::instance()->SIZE_BS());
+
+ (*current_guess) = (*starting_guess);
+
+ // iterate over all possible guesses or until k1 --> k2 models were computed
+ DBGLOG(DBG, "NormalContext::process_request(). Guessing input = " << *total_guessing_input);
+ bool computed_k1_k2 = false;
+ do
{
- std::size_t this_qid = query_id(ctx_id, ++query_counter);
- DBGLOG(DBG, "NormalContext[" << ctx_id << "]::process_request: trigger join with query_id = " << this_qid << " " << detailprint(this_qid));
- ReturnedBeliefState* rbs = joiner->first_join(this_qid, history, md, jd);
- if (rbs->belief_state == NULL)
+ NewBeliefState* combined_input =
+ new NewBeliefState(BeliefStateOffset::instance()->NO_BLOCKS(),
+ BeliefStateOffset::instance()->SIZE_BS());
+ (*combined_input ) = (*input) | (*current_guess);
+
+ if (compute(combined_input, k1, k2, parent_qid, eval, md))
{
+ computed_k1_k2 = true;
break;
}
- input = rbs->belief_state;
+ current_guess = next_guess(current_guess, total_guessing_input);
}
- else
- input = new NewBeliefState(BeliefStateOffset::instance()->NO_BLOCKS(),
- BeliefStateOffset::instance()->SIZE_BS());
-
- if (total_guessing_input != NULL)
+ while (current_guess);
+
+ // carefully clean up
+ if (current_guess)
{
- NewBeliefState* current_guess = new NewBeliefState(BeliefStateOffset::instance()->NO_BLOCKS(),
- BeliefStateOffset::instance()->SIZE_BS());
-
- (*current_guess) = (*starting_guess);
+ delete current_guess;
+ current_guess = NULL;
+ }
- // make guess
- DBGLOG(DBG, "NormalContext::process_request(). Guessing input = " << *total_guessing_input);
- bool computed_k1_k2 = false;
- do
- {
- NewBeliefState* combined_input =
- new NewBeliefState(BeliefStateOffset::instance()->NO_BLOCKS(),
- BeliefStateOffset::instance()->SIZE_BS());
- (*combined_input ) = (*input) | (*current_guess);
+ return computed_k1_k2;
+ }
+ else
+ {
+ return compute(input, k1, k2, parent_qid, eval, md);
+ }
+}
- if (compute(combined_input, k1, k2, parent_qid, eval, md))
- {
- computed_k1_k2 = true;
- break;
- }
- current_guess = next_guess(current_guess, total_guessing_input);
- }
- while (current_guess);
- if (computed_k1_k2 || is_leaf)
- {
- if (current_guess)
- {
- delete current_guess;
- current_guess = NULL;
- }
+void
+NormalContext::process_request(std::size_t parent_qid,
+ const NewHistory& history,
+ EvaluatorPtr eval,
+ NewConcurrentMessageDispatcherPtr md,
+ NewJoinerDispatcherPtr jd,
+ std::size_t k1,
+ std::size_t k2)
+{
+ assert ((k1 == 0 && k2 == 0) || (0 < k1 && k1 < k2+1));
- break;
- }
- }
- else
- {
- if (compute(input, k1, k2, parent_qid, eval, md) || is_leaf) break;
- }
+ std::size_t this_qid = query_id(ctx_id, ++query_counter);
+ ReturnedBeliefState* rbs = joiner->first_join(this_qid, history, md, jd);
+ NewBeliefState* input = rbs->belief_state;
+
+ while (input != NULL)
+ {
+ DBGLOG(DBG, "NormalContext::process_request: input = " << *input);
+ if (process_input(input, parent_qid, eval, md, k1, k2)) break;
+
+ this_qid = query_id(ctx_id, ++query_counter);
+ rbs = joiner->next_join(this_qid, history, md, jd);
+ input = rbs->belief_state;
}
}
Modified: dmcs/branches/dmcs1.5/src/mcs/StreamingJoiner.cpp
===================================================================
--- dmcs/branches/dmcs1.5/src/mcs/StreamingJoiner.cpp 2012-11-20 22:27:55 UTC (rev 3292)
+++ dmcs/branches/dmcs1.5/src/mcs/StreamingJoiner.cpp 2012-11-21 10:48:28 UTC (rev 3293)
@@ -135,6 +135,7 @@
if (!ask_first_packs(query_id, history, 0, neighbors->size()-1, md, jd))
{
+ DBGLOG(DBG, "StreamingJoiner::first_join: One neighbor is inconsistent. Bailing out!");
// A neighbor is inconsistent. Reset and return NULL
reset();
ReturnedBeliefState* end_rbs = new ReturnedBeliefState(NULL, query_id);
@@ -160,6 +161,7 @@
if (pack_size > 0)
{
+ DBGLOG(DBG, "StreamingJoiner::first_join: first join failed. Call next join.");
return next_join(query_id, history, md, jd);
}
@@ -175,6 +177,18 @@
NewConcurrentMessageDispatcherPtr md,
NewJoinerDispatcherPtr jd)
{
+ if (!joined_results.empty())
+ {
+ ReturnedBeliefState* rbs = joined_results.front();
+ joined_results.pop_front();
+ return rbs;
+ }
+ else if (pack_size == 0)
+ {
+ ReturnedBeliefState* end_rbs = new ReturnedBeliefState(NULL, query_id);
+ return end_rbs;
+ }
+
// now really going to the loop of asking next =============================================
while (1)
{
@@ -191,6 +205,8 @@
pc++;
std::size_t k_one = pc * pack_size + 1;
std::size_t k_two = (pc+1) * pack_size;
+
+ DBGLOG(DBG, "StreamingJoiner::next_join: k1 = " << k_one << ", k2 = " << k_two);
// Ask next at neighbor_offset
if (ask_neighbor_and_receive(next_neighbor, query_id, history, k_one, k_two, md, jd))
@@ -200,6 +216,7 @@
assert (next_neighbor > 0);
// Ask first packs before neighbor_offset
+ DBGLOG(DBG, "StreamingJoiner::next_join: Going to ask_first_pack. next_neighbor = " << next_neighbor);
bool ret = ask_first_packs(query_id, history, 0, next_neighbor - 1, md, jd);
assert (ret == true);
@@ -223,6 +240,7 @@
{
next_neighbor++;
asking_next = true;
+ DBGLOG(DBG, "StreamingJoiner::next_join: move to next neighbor = " << next_neighbor);
}
}
}
@@ -256,6 +274,7 @@
if (bs)
{
+ DBGLOG(DBG, "StreamingJoiner::ask_neighbor_and_receive: bs = " << *bs);
std::size_t offset = neighbor_offset_from_qid(qid);
std::size_t noff = ((*neighbors)[neighbor_index])->neighbor_offset;
assert (noff == offset);
@@ -401,7 +420,7 @@
// be careful that we are blocked here. Use timeout sending instead?
ReturnedBeliefState* rbs = new ReturnedBeliefState(result, query_id);
- DBGLOG(DBG, "Succeeded: push back " << *result);
+ //DBGLOG(DBG, "StreamingJoiner::join: Succeeded: push back " << *result);
joined_results.push_back(rbs);
return true;
@@ -420,7 +439,7 @@
{
assert (from_neighbor <= to_neighbor && to_neighbor < neighbors->size());
- DBGLOG(DBG, "StreamingJoiner::ask_first_packs: forward_qid = " << forward_qid);
+ DBGLOG(DBG, "StreamingJoiner::ask_first_packs: forward_qid = " << forward_qid << ", from_neighbor = " << from_neighbor << ", to_neighbor = " << to_neighbor);
for (std::size_t i = from_neighbor; i <= to_neighbor; ++i)
{
@@ -433,6 +452,7 @@
k2 = pack_size;
}
+ DBGLOG(DBG, "StreamingJoiner::ask_first_packs i = " << i << ", k1 = " << k1 << ", k2 = " << k2);
// in this method, we register to joiner_dispatcher
ask_neighbor(i, forward_qid, history, k1, k2, md, jd);
}
@@ -487,6 +507,7 @@
jd->unregisterIdOffset(qid, joiner_offset);
if (count_models_read[neighbor_index] == 0)
{
+ DBGLOG(DBG, "StreamingJoiner::ask_first_packs: encounter an inconsistent neighbor with noff = " << noff);
// this neighbor is inconsistent
return false;
}
Modified: dmcs/branches/dmcs1.5/src/parser/DLVResultParser.cpp
===================================================================
--- dmcs/branches/dmcs1.5/src/parser/DLVResultParser.cpp 2012-11-20 22:27:55 UTC (rev 3292)
+++ dmcs/branches/dmcs1.5/src/parser/DLVResultParser.cpp 2012-11-21 10:48:28 UTC (rev 3293)
@@ -55,7 +55,7 @@
{
std::string input;
std::getline(is, input);
- DBGLOG(DBG, "DLVResultParser::parse(): Input to parser = " << input);
+ //DBGLOG(DBG, "DLVResultParser::parse(): Input to parser = " << input);
if (input.empty() || is.bad())
{
/*DBGLOG(DBG, "leaving loop because got input size " << input.size()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mm...@us...> - 2012-11-20 22:28:02
|
Revision: 3292
http://dmcs.svn.sourceforge.net/dmcs/?rev=3292&view=rev
Author: mmsc
Date: 2012-11-20 22:27:55 +0000 (Tue, 20 Nov 2012)
Log Message:
-----------
Unify joiners by introducing LeafJoiner. Prepare to fix NormalContext's processing of requests.
Modified Paths:
--------------
dmcs/branches/dmcs1.5/include/mcs/BaseJoiner.h
dmcs/branches/dmcs1.5/include/mcs/Makefile.am
dmcs/branches/dmcs1.5/include/mcs/NormalContext.h
dmcs/branches/dmcs1.5/include/mcs/StreamingJoiner.h
dmcs/branches/dmcs1.5/src/mcs/Makefile.am
dmcs/branches/dmcs1.5/src/mcs/NewContext.cpp
dmcs/branches/dmcs1.5/src/mcs/NormalContext.cpp
Added Paths:
-----------
dmcs/branches/dmcs1.5/include/mcs/LeafJoiner.h
dmcs/branches/dmcs1.5/src/mcs/LeafJoiner.cpp
Modified: dmcs/branches/dmcs1.5/include/mcs/BaseJoiner.h
===================================================================
--- dmcs/branches/dmcs1.5/include/mcs/BaseJoiner.h 2012-11-20 16:47:06 UTC (rev 3291)
+++ dmcs/branches/dmcs1.5/include/mcs/BaseJoiner.h 2012-11-20 22:27:55 UTC (rev 3292)
@@ -33,9 +33,11 @@
#include <vector>
#include <boost/shared_ptr.hpp>
#include "mcs/NewBeliefState.h"
-#include "network/NewJoinerDispatcher.h"
+#include "mcs/ForwardMessage.h"
#include "mcs/NewNeighbor.h"
+#include "mcs/ReturnedBeliefState.h"
#include "network/NewConcurrentMessageDispatcher.h"
+#include "network/NewJoinerDispatcher.h"
namespace dmcs {
@@ -48,6 +50,18 @@
registerJoinIn(std::size_t offset,
NewConcurrentMessageDispatcherPtr md);
+ virtual ReturnedBeliefState*
+ first_join(std::size_t query_id,
+ const NewHistory& history,
+ NewConcurrentMessageDispatcherPtr md,
+ NewJoinerDispatcherPtr jd) = 0;
+
+ virtual ReturnedBeliefState*
+ next_join(std::size_t query_id,
+ const NewHistory& history,
+ NewConcurrentMessageDispatcherPtr md,
+ NewJoinerDispatcherPtr jd) = 0;
+
protected:
void
init();
@@ -65,6 +79,8 @@
ReturnedBeliefStateList joined_results;
};
+typedef boost::shared_ptr<BaseJoiner> BaseJoinerPtr;
+
} // namespace dmcs
#endif // BASE_JOINER_H
Added: dmcs/branches/dmcs1.5/include/mcs/LeafJoiner.h
===================================================================
--- dmcs/branches/dmcs1.5/include/mcs/LeafJoiner.h (rev 0)
+++ dmcs/branches/dmcs1.5/include/mcs/LeafJoiner.h 2012-11-20 22:27:55 UTC (rev 3292)
@@ -0,0 +1,66 @@
+/* DMCS -- Distributed Nonmonotonic Multi-Context Systems.
+ * Copyright (C) 2009, 2010 Minh Dao-Tran, Thomas Krennwallner
+ *
+ * This file is part of DMCS.
+ *
+ * DMCS is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * DMCS is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with DMCS. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+ /**
+ * @file LeafJoiner.h
+ * @author Minh Dao Tran <da...@kr...>
+ * @date Tue Nov 20 11:04:06 2012
+ *
+ * @brief
+ *
+ *
+ */
+
+#ifndef __LEAF_JOINER_H__
+#define __LEAF_JOINER_H__
+
+#include "mcs/BaseJoiner.h"
+#include "mcs/BeliefStateOffset.h"
+
+namespace dmcs {
+
+class LeafJoiner : public BaseJoiner
+{
+public:
+ LeafJoiner(NewNeighborVecPtr n);
+
+ ReturnedBeliefState*
+ first_join(std::size_t query_id,
+ const NewHistory& history,
+ NewConcurrentMessageDispatcherPtr md = NewConcurrentMessageDispatcherPtr(),
+ NewJoinerDispatcherPtr jd = NewJoinerDispatcherPtr());
+
+
+ ReturnedBeliefState*
+ next_join(std::size_t query_id,
+ const NewHistory& history,
+ NewConcurrentMessageDispatcherPtr md = NewConcurrentMessageDispatcherPtr(),
+ NewJoinerDispatcherPtr jd = NewJoinerDispatcherPtr());
+};
+
+typedef boost::shared_ptr<LeafJoiner> LeafJoinerPtr;
+
+} // namespace dmcs
+
+#endif // __LEAF_JOINER_H__
+
+
+// Local Variables:
+// mode: C++
+// End:
Modified: dmcs/branches/dmcs1.5/include/mcs/Makefile.am
===================================================================
--- dmcs/branches/dmcs1.5/include/mcs/Makefile.am 2012-11-20 16:47:06 UTC (rev 3291)
+++ dmcs/branches/dmcs1.5/include/mcs/Makefile.am 2012-11-20 22:27:55 UTC (rev 3292)
@@ -19,6 +19,7 @@
NewBeliefState.h \
NewContext.h \
CycleBreaker.h \
+ LeafJoiner.h \
NewMessage.h \
NormalContext.h \
NewNeighbor.h \
Modified: dmcs/branches/dmcs1.5/include/mcs/NormalContext.h
===================================================================
--- dmcs/branches/dmcs1.5/include/mcs/NormalContext.h 2012-11-20 16:47:06 UTC (rev 3291)
+++ dmcs/branches/dmcs1.5/include/mcs/NormalContext.h 2012-11-20 22:27:55 UTC (rev 3292)
@@ -36,7 +36,7 @@
#include "mcs/BridgeRuleEvaluator.h"
#include "mcs/QueryPlan.h"
#include "network/RequestDispatcher.h"
-#include "mcs/StreamingJoiner.h"
+#include "mcs/BaseJoiner.h"
#include "network/NewConcurrentMessageDispatcher.h"
#include "mcs/NewContext.h"
@@ -110,7 +110,7 @@
// For opt topologies where some links are cut to break cycles.
NewNeighborVecPtr guessing_neighbors;
- StreamingJoinerPtr joiner;
+ BaseJoinerPtr joiner;
// to deal with cycles
boost::thread* cycle_breaker_thread;
Modified: dmcs/branches/dmcs1.5/include/mcs/StreamingJoiner.h
===================================================================
--- dmcs/branches/dmcs1.5/include/mcs/StreamingJoiner.h 2012-11-20 16:47:06 UTC (rev 3291)
+++ dmcs/branches/dmcs1.5/include/mcs/StreamingJoiner.h 2012-11-20 22:27:55 UTC (rev 3292)
@@ -53,17 +53,7 @@
NewConcurrentMessageDispatcherPtr md,
NewJoinerDispatcherPtr jd);
-private:
- void
- reset();
-
ReturnedBeliefState*
- process(std::size_t query_id,
- const NewHistory& history,
- NewConcurrentMessageDispatcherPtr md,
- NewJoinerDispatcherPtr jd);
-
- ReturnedBeliefState*
first_join(std::size_t query_id,
const NewHistory& history,
NewConcurrentMessageDispatcherPtr md,
@@ -75,7 +65,16 @@
NewConcurrentMessageDispatcherPtr md,
NewJoinerDispatcherPtr jd);
+private:
+ void
+ reset();
+ ReturnedBeliefState*
+ process(std::size_t query_id,
+ const NewHistory& history,
+ NewConcurrentMessageDispatcherPtr md,
+ NewJoinerDispatcherPtr jd);
+
bool
do_join(std::size_t query_id);
Added: dmcs/branches/dmcs1.5/src/mcs/LeafJoiner.cpp
===================================================================
--- dmcs/branches/dmcs1.5/src/mcs/LeafJoiner.cpp (rev 0)
+++ dmcs/branches/dmcs1.5/src/mcs/LeafJoiner.cpp 2012-11-20 22:27:55 UTC (rev 3292)
@@ -0,0 +1,71 @@
+/* DMCS -- Distributed Nonmonotonic Multi-Context Systems.
+ * Copyright (C) 2009, 2010 Minh Dao-Tran, Thomas Krennwallner
+ *
+ * This file is part of DMCS.
+ *
+ * DMCS is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * DMCS is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with DMCS. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+ /**
+ * @file LeafJoiner.cpp
+ * @author Minh Dao Tran <da...@kr...>
+ * @date Tue Nov 20 11:13:26 2012
+ *
+ * @brief
+ *
+ *
+ */
+
+#include "mcs/LeafJoiner.h"
+
+namespace dmcs {
+
+
+
+LeafJoiner::LeafJoiner(NewNeighborVecPtr n)
+ : BaseJoiner(n)
+{ }
+
+
+
+ReturnedBeliefState*
+LeafJoiner::first_join(std::size_t query_id,
+ const NewHistory& history,
+ NewConcurrentMessageDispatcherPtr md,
+ NewJoinerDispatcherPtr jd)
+{
+ NewBeliefState* input = new NewBeliefState(BeliefStateOffset::instance()->NO_BLOCKS(),
+ BeliefStateOffset::instance()->SIZE_BS());
+
+ ReturnedBeliefState* rbs = new ReturnedBeliefState(input, query_id);
+ return rbs;
+}
+
+
+
+ReturnedBeliefState*
+LeafJoiner::next_join(std::size_t query_id,
+ const NewHistory& history,
+ NewConcurrentMessageDispatcherPtr md,
+ NewJoinerDispatcherPtr jd)
+{
+ ReturnedBeliefState* rbs = new ReturnedBeliefState(NULL, query_id);
+ return rbs;
+}
+
+} // namespace dmcs
+
+// Local Variables:
+// mode: C++
+// End:
Modified: dmcs/branches/dmcs1.5/src/mcs/Makefile.am
===================================================================
--- dmcs/branches/dmcs1.5/src/mcs/Makefile.am 2012-11-20 16:47:06 UTC (rev 3291)
+++ dmcs/branches/dmcs1.5/src/mcs/Makefile.am 2012-11-20 22:27:55 UTC (rev 3292)
@@ -42,6 +42,7 @@
NewBeliefState.cpp \
NewContext.cpp \
CycleBreaker.cpp \
+ LeafJoiner.cpp \
NormalContext.cpp \
Pool.cpp \
QueryID.cpp \
Modified: dmcs/branches/dmcs1.5/src/mcs/NewContext.cpp
===================================================================
--- dmcs/branches/dmcs1.5/src/mcs/NewContext.cpp 2012-11-20 16:47:06 UTC (rev 3291)
+++ dmcs/branches/dmcs1.5/src/mcs/NewContext.cpp 2012-11-20 22:27:55 UTC (rev 3292)
@@ -81,7 +81,7 @@
return false;
}
- DBGLOG(DBG, "NormalContext[" << ctx_id << "]::compute(): heads = " << *(heads->getHeads()));
+ DBGLOG(DBG, "NewContext[" << ctx_id << "]::compute(): heads = " << *(heads->getHeads()));
// send heads to Evaluator
int timeout = 0;
md->send(NewConcurrentMessageDispatcher::EVAL_IN_MQ, eval->getInQueue(), heads, timeout);
Modified: dmcs/branches/dmcs1.5/src/mcs/NormalContext.cpp
===================================================================
--- dmcs/branches/dmcs1.5/src/mcs/NormalContext.cpp 2012-11-20 16:47:06 UTC (rev 3291)
+++ dmcs/branches/dmcs1.5/src/mcs/NormalContext.cpp 2012-11-20 22:27:55 UTC (rev 3292)
@@ -31,8 +31,11 @@
#include "mcs/NormalContext.h"
#include "mcs/CycleBreaker.h"
#include "mcs/ForwardMessage.h"
+#include "mcs/LeafJoiner.h"
+#include "mcs/StreamingJoiner.h"
#include "dmcs/DLVEvaluator.h"
+
namespace dmcs {
NormalContext::NormalContext(std::size_t cid,
@@ -53,7 +56,7 @@
guessing_neighbors(gnbs)
{
if (nbs->size() == 0)
- joiner = StreamingJoinerPtr();
+ joiner = LeafJoinerPtr(new LeafJoiner(nbs));
else
joiner = StreamingJoinerPtr(new StreamingJoiner(pack_size, nbs));
@@ -228,7 +231,7 @@
{
std::size_t this_qid = query_id(ctx_id, ++query_counter);
DBGLOG(DBG, "NormalContext[" << ctx_id << "]::process_request: trigger join with query_id = " << this_qid << " " << detailprint(this_qid));
- ReturnedBeliefState* rbs = joiner->trigger_join(this_qid, history, md, jd);
+ ReturnedBeliefState* rbs = joiner->first_join(this_qid, history, md, jd);
if (rbs->belief_state == NULL)
{
break;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|