- Added some new heuristics testing.
This commit is contained in:
parent
8f896432d1
commit
0a74c87934
@ -48,7 +48,7 @@ def parse(scout):
|
||||
return (ra,rb,rp,nc,st)
|
||||
|
||||
|
||||
def test_goal_selector(goalselector, options):
|
||||
def test_goal_selector(goalselector, options,branchbound):
|
||||
"""Test with a given goal selector
|
||||
|
||||
in:
|
||||
@ -86,6 +86,9 @@ def test_goal_selector(goalselector, options):
|
||||
claims = claims + nc
|
||||
states = states + st
|
||||
|
||||
if (bounds * states) > branchbound:
|
||||
return (-1,0,0,0,0,0)
|
||||
|
||||
return (attacks,bounds,proofs,claims,np,states)
|
||||
|
||||
# Max
|
||||
@ -106,8 +109,15 @@ class maxor:
|
||||
self.dir = dir
|
||||
self.min = mymin
|
||||
self.max = mymax
|
||||
if dir & 1:
|
||||
self.data = mymax
|
||||
else:
|
||||
self.data = mymin
|
||||
|
||||
def reg(self,data):
|
||||
def get(self):
|
||||
return self.data
|
||||
|
||||
def reg(self,d):
|
||||
"""Store a new data element
|
||||
|
||||
in:
|
||||
@ -117,20 +127,22 @@ class maxor:
|
||||
notifications according to initial settings.
|
||||
"""
|
||||
|
||||
self.data = d
|
||||
res = ""
|
||||
if self.min >= data:
|
||||
self.min = data
|
||||
if self.min >= d:
|
||||
if (self.dir & 2):
|
||||
res = res + "-"
|
||||
if self.max <= data:
|
||||
self.max = data
|
||||
self.min = d
|
||||
if self.max <= d:
|
||||
if (self.dir & 1):
|
||||
res = res + "+"
|
||||
self.max = d
|
||||
if res == "":
|
||||
return res
|
||||
else:
|
||||
return "[" + res + "]"
|
||||
|
||||
|
||||
# Main code
|
||||
def main():
|
||||
parser = OptionParser()
|
||||
@ -150,15 +162,19 @@ def main():
|
||||
boundstatesmax = maxor(2)
|
||||
|
||||
for g in range(1,63):
|
||||
if (g & 8) == 0 and (g & 4) == 0 :
|
||||
(ra,rb,rp,nc,np,st) = test_goal_selector(g, options)
|
||||
(ra,rb,rp,nc,np,st) = test_goal_selector(g, options,
|
||||
boundstatesmax.get())
|
||||
|
||||
res = str(g)
|
||||
if ra < 0:
|
||||
# Error: not well bounded
|
||||
res += "\tWent over bound, stopped investigation."
|
||||
else:
|
||||
# Scores: bounds are negative
|
||||
score1 = ra + rp - rb
|
||||
score2 = ra + (3 * rp) - (2 * rb)
|
||||
boundstates = rb * st
|
||||
|
||||
res = str(g)
|
||||
|
||||
def shows (res, mx, data):
|
||||
return res + "\t" + str(data) + mx.reg(data)
|
||||
|
Loading…
Reference in New Issue
Block a user