concepts.dm.crow.csp_solver.dpll_sampling.dpll_solve#

dpll_solve(executor, csp, *, generator_manager=None, simulation_interface=None, actions=None, max_generator_trials=3, enable_ignore=False, solvable_only=False, verbose=False)[source]#

Solve the constraint satisfaction problem using the DPLL-sampling algorithm.

Parameters:
  • executor (CrowExecutor) – the executor.

  • csp (ConstraintSatisfactionProblem) – the constraint satisfaction problem.

  • generator_manager (CrowGeneratorExecutor | None) – the generator manager.

  • simulation_interface (CrowSimulationControllerInterface | None) – the simulation interface.

  • actions (Sequence[CrowControllerApplier] | None) – the list of actions. Only used when simulation_interface is not None.

  • max_generator_trials (int) – the maximum number of trials for each generator.

  • enable_ignore (bool) – whether to ignore constraints whose RHS value is not determined.

  • solvable_only (bool) – whether to only return whether the problem is solvable, without returning the solution.

  • verbose (bool) – whether to print verbose information.

Returns:

When solvable_only is True, return a single Boolean value indicating whether the problem is solvable. When solvable_only is False, return an assignment dictionary. When the problem is not solvable, return None.

Raises:
  • CSPNotSolvable – when the problem is not solvable.

  • CSPNoGenerator – when no generator can be found to solve the problem. However, the problem may still be solvable.

Return type:

bool | Dict[int, Assignment] | None