For the more complex constraint behaviours (beyond those waiting for instantiations), we need to employ lower-level primitives of the ECLiPSe kernel (suspensions and priorities). If we want to add a new constraint to an existing solver, we also need to use the lower-level interface that the particular solver provides.
Apart from the delay clauses used above, ECLiPSe also provides a more powerful (though less declarative) way of causing a goal to delay. The following is another implementation of the constraint checking behaviour, this time using the suspend/3 built-in predicate to create a delayed goal for capacity/2:
capacity(T,N) :- (var(T);var(N)), !, suspend(capacity(T,N), 0, [T,N]->inst). capacity(1, N) :- N>=0.0, N=<350.0. capacity(2, N) :- N>=0.0, N=<180.0. capacity(3, N) :- N>=0.0, N=<50.0. |