concepts.dm.pdsketch.csp_solvers.dpll_sampling.csp_dpll_sampling_solve#

csp_dpll_sampling_solve(executor, csp, *, generator_manager=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 (PDSketchExecutor) – the executor.

  • csp (ConstraintSatisfactionProblem) – the constraint satisfaction problem.

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

  • 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