使用 from docplex.cp.model import CpoModel ,我编写了一个文档代码。模型防御如下所示。
from docplex.cp.model import CpoModel
mdl = CpoModel(name="HouseBuilding")
但是,通过solve()函数,它最终会打印出不必要的输出。
msol = mdl.solve(TimeLimit=10)
我相信它是打印在下面的东西。
solve status, solver parameters, solver information output log
示例输出为follows.How,我应该避免打印这些信息,而只打印解决方案。
! -------------------------------------------------- CP Optimizer 12.10.0.0 -- ! Maximization problem - 153 variables, 123 constraints ! TimeLimit = 10 ! Initial process time : 0.00s (0.00s extraction + 0.00s propagation) ! . Log search space : 330.1 (before), 330.1 (after) ! . Memory usage : 926.0 kB (before), 926.0 kB (after) ! Using parallel search with 4 workers. ! ---------------------------------------------------------------------------- ! Best Branches Non-fixed W Branch decision 0 153 - + New bound is 385 ! Using iterative diving. ! Using temporal relaxation. 0 153 1 - + New bound is 372 * 309 155 0.12s 1 (gap is 20.39%)