Consistency algorithms

NuCS provides the following consistency algorithms.

nucs.solvers.bound_consistency_algorithm.bound_consistency_algorithm(...) int[source]

This is the default consistency algorithm used by the solver.

Parameters:
  • algorithm_nb (int) – the number of registered propagator algorithms

  • statistics (NDArray) – a Numpy array of statistics

  • algorithms (NDArray) – the algorithms indexed by propagators

  • priorities (NDArray) – the propagation queue bucket priorities indexed by propagators

  • bounds (NDArray) – the bounds indexed by propagators

  • propagator_variables (NDArray) – the variables by propagators

  • propagator_parameters (NDArray) – the parameters by propagators

  • triggers (NDArray) – a Numpy array of event masks indexed by variables and propagators

  • triggers_offsets (NDArray) – the CSR offsets delimiting each (variable, event) slice of triggers

  • domains_stk (NDArray) – a stack of domains, the first level correspond to the current domains, the rest correspond to the choice points

  • entailed_propagator_depths (NDArray) – the depth at which each propagator was entailed, -1 when active

  • entailment_trail (NDArray) – the entailment trail, the first cell holds the trail size, the following cells hold the indices of the entailed propagators in entailment order

  • domain_update_stk (NDArray) – the stack of domain updates, unused here

  • unbound_variable_nb_stk (NDArray) – the stack of the unbound variables nb

  • stks_top (NDArray) – the height of the stacks as a Numpy array

  • triggered_propagators (NDArray) – the Numpy array of triggered propagators

  • compute_domains_fcts (ComputeDomainsFcts) – the typed list of compute_domains functions, built once at solver init

  • decision_variables (ArrayList) – the per-search list of decision variable arrays (unused here)

  • domain_buffer (NDArray) – a scratch buffer for prop_domains, sized to max propagator arity, allocated once at solver init

Returns:

a status (consistency, inconsistency or entailment) as an integer

Return type:

int

nucs.solvers.shaving_consistency_algorithm.shaving_consistency_algorithm(...) int[source]

This algorithm reduces the need of searching by shaving the domains.

Parameters:
  • algorithm_nb (int) – the number of registered propagator algorithms

  • statistics (NDArray) – a Numpy array of statistics

  • algorithms (NDArray) – the algorithms indexed by propagators

  • priorities (NDArray) – the propagation queue bucket priorities indexed by propagators

  • bounds (NDArray) – the bounds indexed by propagators

  • propagator_variables (NDArray) – the variables by propagators

  • propagator_parameters (NDArray) – the parameters by propagators

  • triggers (NDArray) – a Numpy array of event masks indexed by variables and propagators

  • triggers_offsets (NDArray) – the CSR offsets delimiting each (variable, event) slice of triggers

  • domains_stk (NDArray) – a stack of domains; the first level correspond to the current domains, the rest correspond to the choice points

  • entailed_propagator_depths (NDArray) – the depth at which each propagator was entailed, -1 when active

  • entailment_trail (NDArray) – the entailment trail, the first cell holds the trail size

  • domain_update_stk (NDArray) – the stack of domain updates

  • unbound_variable_nb_stk (NDArray) – the stack of the unbound variables nb

  • stks_top (NDArray) – the height of the stacks as a Numpy array

  • triggered_propagators (NDArray) – the Numpy array of triggered propagators

  • compute_domains_fcts (ComputeDomainsFcts) – the typed list of compute_domains functions

  • decision_variables (ArrayList) – the per-search list of decision variable arrays

  • domain_buffer (NDArray) – a scratch buffer for prop_domains, sized to max propagator arity, allocated once at solver init

Returns:

a status (consistency, inconsistency or entailment) as an integer

Return type:

int