本文整理汇总了Python中server.Server.evaluate方法的典型用法代码示例。如果您正苦于以下问题:Python Server.evaluate方法的具体用法?Python Server.evaluate怎么用?Python Server.evaluate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类server.Server
的用法示例。
在下文中一共展示了Server.evaluate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: exit
# 需要导入模块: from server import Server [as 别名]
# 或者: from server.Server import evaluate [as 别名]
exit (1)
sz = sys.argv[1]
nprobs = int(sys.argv[2])
s = Server()
for probi in range(nprobs):
prob = s.get_training_problem(int(sz))
print prob["id"]
if not os.path.exists("tests"):
os.makedirs("tests")
opstr1 = "_".join(prob['operators'])
opstr2 = " ".join(prob['operators'])
inout_file = open("tests/%02d-%s-%s.inout" % (prob['size'], opstr1, prob['id']), 'w')
inout_file.write("# %s\n" % prob['challenge'])
inout_file.write("%d %s\n" % (prob['size'], opstr2))
inputs = []
while len(inputs) < 256: inputs.append(random.getrandbits(64))
outputs = s.evaluate(problem = prob['id'], arguments = inputs)
inouts = zip(inputs, outputs)
for (i,o) in inouts:
inout_file.write("%d %d\n" % (i,o))
示例2: len
# 需要导入模块: from server import Server [as 别名]
# 或者: from server.Server import evaluate [as 别名]
## Some probably useful values
inputs = hbv_inputs + [ 0x00000000ffffffff, 0x5555555555555555, 0xaaaaaaaaaaaaaaaa,
0x3333333333333333, 0xcccccccccccccccc, 0x0f0f0f0f0f0f0f0f, 0xf0f0f0f0f0f0f0f0,
0x00ff00ff00ff00ff, 0xff00ff00ff00ff00, 0x0000ffff0000ffff, 0xffff0000ffff0000 ]
outputs = []
############
while True: ## Alternately "evaluate" 256 inputs & "guess" a program using hbv on accumulated in/out pairs
while len(inputs) < in_sent + 256: inputs.append(random.getrandbits(64))
new_outs = s.evaluate(problem = prob['id'], arguments = inputs[in_sent : in_sent+256], training = training )
outputs = outputs + new_outs
inouts = zip(inputs[in_sent : in_sent+256], new_outs)
in_sent = in_sent + 256
for (i,o) in inouts:
inout_file.write("%d %d\n" % (i,o))
inout_file.flush()
#############
myinput = open(inout_fname)
myoutput = open(inout_fname + ".hbv", 'w')