6.3.3 Distribute

Description of the predicate distribute/3.

solveConstraint.pl: View Download

The predicate distribute/3 (from solveConstraint.pl) implements the Distribution Rule (or Choice Rule). It takes a constraint graph as its first argument, picks a node Z with two incoming dominance edges (from X and Y), and applies the Distribution Rule to them. It returns the two constraint graphs that are obtained by adding a dominance edge between X and Y in either direction. The predicate fails if the input constraint doesn't contain such a node Z with two incoming dominance edges.

distribute(usr(Ns,LCs,DCs,BCs),usr(Ns,LCs,[dom(X,Y)|DCs],BCs),usr(Ns,LCs,[dom(Y,X)|DCs],BCs)) :-
        member(dom(X,Z),DCs),
        member(dom(Y,Z),DCs),
        X \== Y.

The two calls of member/2 check that there are in fact two dominance edges dom(X,Z) and dom(Y,Z) in the list of dominance edges DCs of the incoming constraint. By adding X \== Y, we make sure that X and Y are different nodes. Otherwise, it would be possible to add dominances like dom(X,X).


Aljoscha Burchardt, Stephan Walter, Alexander Koller, Michael Kohlhase, Patrick Blackburn and Johan Bos
Version 1.2.5 (20030212)