Content deleted Content added
m Capitalising short description "logic programming with constraint satisfaction" per WP:SDFORMAT (via Bandersnatch) |
m →Labeling: {{sxhl}} |
||
Line 104:
Typically, constraint logic programs are written in such a way labeling literals are evaluated only after as many constraints as possible have been accumulated in the constraint store. This is because labeling literals enforce search, and search is more efficient if there are more constraints to be satisfied. A [[constraint satisfaction problem]] is typical solved by a constraint logic program having the following structure:
{{sxhl|
|prolog}}
When the interpreter evaluates the goal <code>solve(args)</code>, it places the body of a fresh variant of the first clause in the current goal. Since the first goal is <code>constraints(X')</code>, the second clause is evaluated, and this operation moves all constraints in the current goal and eventually in the constraint store. The literal <code>labeling(X')</code> is then evaluated, forcing a search for a solution of the constraint store. Since the constraint store contains exactly the constraints of the original constraint satisfaction problem, this operation searches for a solution of the original problem.
|