本文整理汇总了Python中Solver.Solver.tabuSearch方法的典型用法代码示例。如果您正苦于以下问题:Python Solver.tabuSearch方法的具体用法?Python Solver.tabuSearch怎么用?Python Solver.tabuSearch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Solver.Solver
的用法示例。
在下文中一共展示了Solver.tabuSearch方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: print
# 需要导入模块: from Solver import Solver [as 别名]
# 或者: from Solver.Solver import tabuSearch [as 别名]
else:
print("formula is not satisfiable")
print("Time taken:", end - start, "secs")
del cnf
del solver
satisfiable = False
print()
solver = Solver()
cnf = CNF()
cnf.read_dimacs_file(file_name)
start = time.time()
satisfiable = solver.tabuSearch(cnf, 100000, 5)
end = time.time()
if satisfiable:
print("s SATISFIABLE:")
print("v", *format_output(cnf.variable_values), sep=" " )
else:
print("formula is not satisfiable")
print("Time taken:", end - start, "secs")
del cnf
del solver
satisfiable = False
print()
示例2: enumerate
# 需要导入模块: from Solver import Solver [as 别名]
# 或者: from Solver.Solver import tabuSearch [as 别名]
del solver
satisfiable = False
for j, dataSet in enumerate(dataSets):
print("\nFor dataset:", dataSet)
for run in range(num_runs):
print("\nRun#:",run, "For dataset:",dataSet)
file_name = dataSet
solver = Solver()
cnf = CNF()
cnf.read_dimacs_file(file_name)
start = time.clock()
satisfiable = solver.tabuSearch(cnf, 200, 5)
end = time.clock()
if satisfiable:
print("s SATISFIABLE:")
print("v", format_output(cnf.variable_values))
else:
print("Cannot find Solution")
print("Time taken:%2.4f" % (end - start), "secs")
time_matrix2[j][run] = end - start
del cnf
del solver
satisfiable = False
print("\nRuntimes, each columns show timetaken on one of iterations and row shows datasets.\n"