[ library(repair) | Reference Manual | Alphabetic Index ]

+Constraint r_conflict_prop ?ConflictSet

Annotate Constraint as a repair constraint and monitor it for conflicts. It is propagated when it goes into conflict.
Constraint
Constraint to be monitored for conflict (Goal)
ConflictSet
Handle for the conflict set (atom or varibale) argument can alternatively be ConflictSet-ConflictData

Description

Repair constraints are constraints that are monitored by the repair library for conflicts caused by the tentative values of variables in the constraints. r_conflict_prop/2 annotates a constraint to be a repair constraint, and as with r_conflict/2, monitors the constraint for conflicts. The difference is that when a violation is first detected and the Constraint enters the ConflictSet, it is actually propagated at that point by calling the constraint.

Note that if you want constraint propagation from the very beginning, you should simply write the constraint twice, once without and once with annotation.

Constraint can be any goal that works logically, it should be useable as a ground check, and work on any instantiation pattern. Typically, it will be a constraint from some solver library.

ConflictSet can be a user-defined name (an atom) or it can be a variable in which case the system returns a conflict set handle that can later be passed to conflict_constraints/2.

Note that using different conflict sets for different groups of constraints will often make the search algorithm easier and more efficient. A second allowed form of the r_conflict annotation is Constraint r_conflict ConflictSet-ConflictData. If this is used, f ConflictData will appear in the conflict set instead of the Constraint itself. This feature can be used to pass additional information to the search algorithm.

Modules

This predicate is sensitive to its module context (tool predicate, see @/2).

Resatisfiable

no

Examples

 A #= B r_conflict_prop c, A = 5, writeln(1), B = 11, write(2), conflict_constraints(c, X).

1

no (more) solution.
% fails because A #= B was propagated when a conflict was detected 

See Also

conflict_constraints / 2, r_conflict / 2