DocPlex 在使用搜索阶段时给出 CpoSolverException

DocPlex giving CpoSolverException when using search phases

我是运行 docplex 中的约束编程模型。当我添加以下搜索阶段时,我在 docplex 中收到错误:

    model.set_parameters({'SearchType': 'DepthFirst', 'Workers': 2, "LogVerbosity": "Verbose"})

    p1 = search_phase(
        vars=shifts.values(),
        varchooser=select_largest(var_impact()),
        valuechooser=select_largest(value_impact())
    )
    p2 = search_phase(
        vars=work_hours.values(),
        varchooser=select_smallest(domain_size()),
        valuechooser=select_random_value()
    )
    model.add(p1)
    ans = model.solve(TimeLimit=100, execfile='cpoptimizer.exe')

我收到以下错误

(base) dipplestix@DESKTOP-37BA91G:~/classes/csci 2951/hw2$ ./run.sh input/7_14.sched
 ! --------------------------------------------------- CP Optimizer 20.1.0.0 --
 ! Satisfiability problem - 196 variables, 266 constraints, 1 phase
 ! Presolve      : 21 extractables eliminated, 7 constraints generated
 ! TimeLimit            = 100
 ! Workers              = 2
 ! LogVerbosity         = Verbose
 ! SearchType           = DepthFirst
 ! Initial process time : 0.02s (0.02s extraction + 0.00s propagation)
 !  . Log search space  : 449.3 (before), 449.3 (after)
 !  . Memory usage      : 501.9 kB (before), 501.9 kB (after)
 ! Using parallel search with 2 workers.
 ! ----------------------------------------------------------------------------
 !               Branches  Non-fixed    W       Branch decision
Traceback (most recent call last):
  File "src/run.py", line 8, in <module>
    p = solve(sys.argv[1])
  File "/home/dipplestix/classes/csci 2951/hw2/src/solver.py", line 97, in solve
    ans = model.solve(TimeLimit=100, execfile='cpoptimizer.exe')
  File "/home/dipplestix/anaconda3/lib/python3.7/site-packages/docplex/cp/model.py", line 1080, in solve
    msol = solver.solve()
  File "/home/dipplestix/anaconda3/lib/python3.7/site-packages/docplex/cp/solver/solver.py", line 614, in solve
    raise e
  File "/home/dipplestix/anaconda3/lib/python3.7/site-packages/docplex/cp/solver/solver.py", line 607, in solve
    msol = self.agent.solve()
  File "/home/dipplestix/anaconda3/lib/python3.7/site-packages/docplex/cp/solver/solver_local.py", line 191, in solve
    jsol = self._wait_json_result(EVT_SOLVE_RESULT)
  File "/home/dipplestix/anaconda3/lib/python3.7/site-packages/docplex/cp/solver/solver_local.py", line 474, in _wait_json_result
    data = self._wait_event(evt)
  File "/home/dipplestix/anaconda3/lib/python3.7/site-packages/docplex/cp/solver/solver_local.py", line 424, in _wait_event
    evt, data = self._read_message()
  File "/home/dipplestix/anaconda3/lib/python3.7/site-packages/docplex/cp/solver/solver_local.py", line 533, in _read_message
    frame = self._read_frame(6)
  File "/home/dipplestix/anaconda3/lib/python3.7/site-packages/docplex/cp/solver/solver_local.py", line 593, in _read_frame
    raise CpoSolverException("Nothing to read from local solver process. Process seems to have been stopped (rc={}).".format(rc))
docplex.cp.solver.solver.CpoSolverException: Nothing to read from local solver process. Process seems to have been stopped (rc=5).

但是,如果我改用这个 search_phase 就可以了

    p1 = search_phase(
        vars=shifts.values(),
        varchooser=select_random_var(),
        valuechooser=select_random_value()
    )

知道是什么原因造成的吗?

不幸的是,评估者使用搜索分支的统计数据(如影响、成功率或 objective 变化度量)不适用于 DepthFirst 搜索中的变量和值。您可以在 Restart 和 MultiPoint 中使用它们。但是,在这种情况下 docplex 应该引发错误,而不是以这种方式退出。我们将在下一个版本中修复此问题。