本文整理汇总了Python中Mistral.Solver.printStatistics方法的典型用法代码示例。如果您正苦于以下问题:Python Solver.printStatistics方法的具体用法?Python Solver.printStatistics怎么用?Python Solver.printStatistics使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mistral.Solver
的用法示例。
在下文中一共展示了Solver.printStatistics方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: xkcd
# 需要导入模块: from Mistral import Solver [as 别名]
# 或者: from Mistral.Solver import printStatistics [as 别名]
from Mistral import Solver
def xkcd(x, z,price):
model = Model(
z == Sum(x, price)
)
return [model,x]
price = [215, 275, 335, 355, 420, 580]
x = VarArray(len(price),0,100)
z = 1505
[model,x] = xkcd(x, z, price)
print "model:\n", model
solver = Solver(model, x)
print "solver:\n", solver
# solver.setVerbosity(10)
if (solver.solve()):
# solver.printStatistics()
print "x: ", x
# This don't work in NumberjackSolver, just Mistral
while solver.getNextSolution() == SAT:
# solver.printStatistics()
print "x: ", x
solver.printStatistics()
else:
print "No solution"