[ ^ CSE 341 | section index | <-- previous ]

Feasibility, success, answers

The current contents of the constraint store may be in one of three states:

When the constraint solver detects an infeasible state, it must backtrack.

When the constraint solver detects either feasible or unknown, CLP will continue searching the derivation tree. (Why do we want to continue in the unknown case?)

If the constraint store is feasible and we are at a leaf of the derivation tree---that is, the current goal is empty---then we have found a successful derivation and CLP(R) will print an answer.

What is an answer?

A answer is a solution's valuation applied to the projection of the constraint store onto the variables in the original goal.

Okay, so what are projections and valuations?

A valuation is simply an assignment of values (in the case of inequality constraints, values = ranges) to every variable in the constraint store.

A projection of a set of constraints C onto a set of variables V, where V is a subset of the variables in C, is set of constraints D such that

Basically, you can think of a projection as a simplification of an answer with respect to a set of variables---"only the variables we care about".

Lists

Constraints can operate over lists as well (Prolog was influenced by Lisp):

append( [], Ys, Ys ). append( [X|Xs], Ys, [X|Zs] ) :- append( Xs, Ys, Zs ).

Note the Miranda-like syntax for lists, and the use of | as a cons operator. Also notice the pattern-match-like format of the rule parameters.


Last modified: Wed May 24 20:10:50 PDT 2000