- Added timeout information.
This commit is contained in:
parent
1aa77eec27
commit
bc61255a78
@ -7,6 +7,8 @@ from optparse import OptionParser
|
|||||||
|
|
||||||
import scythertest
|
import scythertest
|
||||||
|
|
||||||
|
hurry = False # True then branch and bound
|
||||||
|
|
||||||
# Parse
|
# Parse
|
||||||
def parse(scout):
|
def parse(scout):
|
||||||
"""Parse Scyther output for heuristics tests
|
"""Parse Scyther output for heuristics tests
|
||||||
@ -26,6 +28,7 @@ def parse(scout):
|
|||||||
rp = 0
|
rp = 0
|
||||||
nc = 0
|
nc = 0
|
||||||
st = 0
|
st = 0
|
||||||
|
timeout = False
|
||||||
for l in scout.splitlines():
|
for l in scout.splitlines():
|
||||||
data = l.split()
|
data = l.split()
|
||||||
if len(data) > 4 and data[0] == 'claim':
|
if len(data) > 4 and data[0] == 'claim':
|
||||||
@ -44,8 +47,10 @@ def parse(scout):
|
|||||||
for d in data:
|
for d in data:
|
||||||
if d.startswith("states="):
|
if d.startswith("states="):
|
||||||
st = st + int(d[7:])
|
st = st + int(d[7:])
|
||||||
|
if d.startswith("time="):
|
||||||
|
timeout = True
|
||||||
|
|
||||||
return (ra,rb,rp,nc,st)
|
return (ra,rb,rp,nc,st,timeout)
|
||||||
|
|
||||||
|
|
||||||
def test_goal_selector(goalselector, options,branchbound):
|
def test_goal_selector(goalselector, options,branchbound):
|
||||||
@ -65,6 +70,8 @@ def test_goal_selector(goalselector, options,branchbound):
|
|||||||
|
|
||||||
import protocollist
|
import protocollist
|
||||||
|
|
||||||
|
global hurry
|
||||||
|
|
||||||
scythertest.set_extra_parameters("--count-states --heuristic=" + str(goalselector))
|
scythertest.set_extra_parameters("--count-states --heuristic=" + str(goalselector))
|
||||||
result = str(goalselector)
|
result = str(goalselector)
|
||||||
plist = protocollist.from_literature()
|
plist = protocollist.from_literature()
|
||||||
@ -75,21 +82,25 @@ def test_goal_selector(goalselector, options,branchbound):
|
|||||||
proofs = 0
|
proofs = 0
|
||||||
claims = 0
|
claims = 0
|
||||||
states = 0
|
states = 0
|
||||||
|
timeouts = 0
|
||||||
for p in plist:
|
for p in plist:
|
||||||
(status,scout) = scythertest.default_test([p], \
|
(status,scout) = scythertest.default_test([p], \
|
||||||
int(options.match), \
|
int(options.match), \
|
||||||
int(options.bounds))
|
int(options.bounds))
|
||||||
(ra,rb,rp,nc,st) = parse(scout)
|
(ra,rb,rp,nc,st,timeout) = parse(scout)
|
||||||
attacks = attacks + ra
|
attacks = attacks + ra
|
||||||
bounds = bounds + rb
|
bounds = bounds + rb
|
||||||
proofs = proofs + rp
|
proofs = proofs + rp
|
||||||
claims = claims + nc
|
claims = claims + nc
|
||||||
states = states + st
|
states = states + st
|
||||||
|
if timeout:
|
||||||
|
timeouts += 1
|
||||||
|
|
||||||
if (bounds * states) > branchbound:
|
|
||||||
|
if hurry and (bounds * states) > branchbound:
|
||||||
return (-1,0,0,0,0,0)
|
return (-1,0,0,0,0,0)
|
||||||
|
|
||||||
return (attacks,bounds,proofs,claims,np,states)
|
return (attacks,bounds,proofs,claims,np,states,timeouts)
|
||||||
|
|
||||||
# Max
|
# Max
|
||||||
class maxor:
|
class maxor:
|
||||||
@ -150,19 +161,19 @@ def main():
|
|||||||
(options, args) = parser.parse_args()
|
(options, args) = parser.parse_args()
|
||||||
scythertest.process_default_options(options)
|
scythertest.process_default_options(options)
|
||||||
|
|
||||||
print "G-sel\tAttack\tBound\tProof\tClaims\tScore1\tScore2\tStates\tBnd*Sts"
|
print
|
||||||
|
"G-sel\tAttack\tBound\tProof\tClaims\tTOuts\tProts\tStates\tBnd*Sts"
|
||||||
print
|
print
|
||||||
|
|
||||||
ramax = maxor(1)
|
ramax = maxor(1)
|
||||||
rbmax = maxor(2)
|
rbmax = maxor(2)
|
||||||
rpmax = maxor(1)
|
rpmax = maxor(1)
|
||||||
score1max = maxor(1)
|
|
||||||
score2max = maxor(1)
|
|
||||||
statesmax = maxor(2)
|
statesmax = maxor(2)
|
||||||
boundstatesmax = maxor(2)
|
boundstatesmax = maxor(2)
|
||||||
|
timeoutsmax = maxor(2)
|
||||||
|
|
||||||
for g in range(1,15):
|
for g in range(1,15):
|
||||||
(ra,rb,rp,nc,np,st) = test_goal_selector(g, options,
|
(ra,rb,rp,nc,np,st,timeouts) = test_goal_selector(g, options,
|
||||||
boundstatesmax.get())
|
boundstatesmax.get())
|
||||||
|
|
||||||
res = str(g)
|
res = str(g)
|
||||||
@ -170,12 +181,8 @@ def main():
|
|||||||
# Error: not well bounded
|
# Error: not well bounded
|
||||||
res += "\tWent over bound, stopped investigation."
|
res += "\tWent over bound, stopped investigation."
|
||||||
else:
|
else:
|
||||||
# Scores: bounds are negative
|
|
||||||
score1 = ra + rp - rb
|
|
||||||
score2 = ra + (3 * rp) - (2 * rb)
|
|
||||||
boundstates = rb * st
|
boundstates = rb * st
|
||||||
|
|
||||||
|
|
||||||
def shows (res, mx, data):
|
def shows (res, mx, data):
|
||||||
return res + "\t" + str(data) + mx.reg(data)
|
return res + "\t" + str(data) + mx.reg(data)
|
||||||
|
|
||||||
@ -183,11 +190,10 @@ def main():
|
|||||||
res = shows (res, rbmax, rb)
|
res = shows (res, rbmax, rb)
|
||||||
res = shows (res, rpmax, rp)
|
res = shows (res, rpmax, rp)
|
||||||
res = res + "\t" + str(nc)
|
res = res + "\t" + str(nc)
|
||||||
res = shows (res, score1max, score1)
|
res = shows (res, timeoutsmax, timeouts)
|
||||||
res = shows (res, score2max, score2)
|
res += "\t<%i>" % np
|
||||||
res = shows (res, statesmax, st)
|
res = shows (res, statesmax, st)
|
||||||
res = shows (res, boundstatesmax, boundstates)
|
res = shows (res, boundstatesmax, boundstates)
|
||||||
res += "\t<%i>" % np
|
|
||||||
|
|
||||||
print res
|
print res
|
||||||
print
|
print
|
||||||
|
Loading…
Reference in New Issue
Block a user