- Up - | Next >> |

Let's now illustrate how to solve this problem in Oz. We define the following constraint which can be added directely to the constraint store:

`[X Y Z] ::: 1#7`

Here we make use of Oz-variables whose syntax is given by words with leading capital letters. The line above states that `X, Y, Z`

are so called finite domain variables, i.e. variables taking values in a finite set of integers (here, between 1 and 7). We define the following set of propagators involving these variables:

`X + Y =: 3*Z`

X - Y =: Z

Note the trailing colon in `=:`

. The trailing colon is characteristic of operators denoting finite domain constraints.

Next, we invoke a predefined distribution strategy to enumerate the assignments to `X, Y, Z`

consistent with our constraints.

`{FD.distribute naive [X Y Z]}`

We represent a solution as a record (called feature tree in computational linguistics):

`solution(x:X y:Y z:Z)`

This record has label `solution`

and three features `x, y, z`

(Oz atoms, i.e. words starting with a lowercase letter). `x:X`

indicates that the value of feature `x`

is given by variable `X`

.

- Up - | Next >> |

Denys Duchier, Claire Gardent and Joachim Niehren

Version 1.2.4 (20020829)