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

Derivation states

Each node in the derivation tree consists of a list of goal literals followed by a list of primitive constraints. Together, the goals and constraints (usually written < G | C >) constitute a state of the computation. The tree is constructed by repeatedly selecting one item from the list of literals and processing it as follows:

  1. If the literal is a primitive, we move it to the current constraint store.


  2. Otherwise, we rewrite it using its rule, by
    • replacing the rule with its body, renaming formals as necessary
    • constraining actual parameters to be equal to the formal parameters.

If there is some choice about how to rewrite the rule, this node becomes a choice point and the tree branches. We backtrack whenever we reach an infeasible constraint. When all branches are exhausted, the solver terminates.

Read over Alan's notes on the formal rules for how derivation states are constructed; they should make more sense now.

Constraints and the store

Q: When does something become a primitive constraint?
A: When there is no more rewriting to be done.


Q: What can the constraint solver solve?

A: It depends on the CLP dialect. All CLP dialects handle list and tree constraints. CLP(R) also handles linear real equality and inequality constraints. It can only handle nonlinear constraints if the variables' valuations can be straightforwardly deduced from the goal's linear constraints:

1 ?- X=Y*Y, Y=5. Y = 5 X = 25 *** Yes   2 ?- X=Y*Y, X=25 X = 25 25 = Y * Y *** Maybe
Q: How does the solver actually solve constraints?
A: It is not necessary to understand this in order to understand the CLP language family. The current implementation of CLP(R) uses a variant of the Gauss-Jordan algorithm for solving systems of linear equations. In this sense, you can view CLP(R) as an interface for a linear algebra package.

Last modified: Wed May 24 20:05:05 PDT 2000