当前位置: 首页>>代码示例>>Python>>正文


Python Solver.tabuSearch方法代码示例

本文整理汇总了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()
开发者ID:smohsinali,项目名称:aad,代码行数:32,代码来源:main.py

示例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"
开发者ID:smohsinali,项目名称:aad,代码行数:33,代码来源:slsSAT.py


注:本文中的Solver.Solver.tabuSearch方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。