11.3 Modelling with CLP and ECL^{i}PS^{e}
When modelling problems with constraints, the basic idea is to set up
a network of variables and constraints. Figure 11.1 shows
such a constraint network.
Figure 11.1: A Constraint Network
It can be seen that the Constraint Logic Programming (CLP) formulation

is a natural declarative description of the constraint network
 can serve as a program to set up the constraint network
The main ECL^{i}PS^{e} language constructs used in modelling are

Builtin constraints
X #> Y
 Abstraction
before(task(Si,Di), task(Sj,Dj)) : Si+Di #<= Sj.
 Conjunction
between(X,Y,Z) : X #< Y, Y #< Z.
 Disjunction (but see below)
neighbour(X,Y) : ( X #= Y+1 ; Y #= X+1 ).
 Iteration
not_among(X, L) : ( foreach(Y,L),param(X) do X #\= Y ).
 Recursion
not_among(X, []).
not_among(X, [YYs]) : X #\= Y, not_among(X, Ys).