Reputation: 4448
I have a rule that generates the following
route(5,1,5,3)
route(5,2,5,3)
route(5,3,5,3)
route(3,1,3,1)
route(2,3,5,3)
route(3,3,5,3)
route(4,3,5,3)
route(4,1,3,1)
route(5,1,3,1)
route(3,2,3,1)
route(3,3,3,1)
route(3,4,3,1)
route(3,5,3,1)
in which the following part is a route starting at 5,1 and ending at 5,3
route(5,1,5,3)
route(5,2,5,3)
route(5,3,5,3)
in route(x1,y1,x2,y2)
I want to write a constraint so that these routes do not cross each other but I am not sure how to approach this problem. I would appreciate any help in this matter.
Upvotes: 1
Views: 265
Reputation: 4448
I used the following rule to prevent crossing of routes.
(X',Y') = (X'',Y'') :- route(X,Y,X',Y'), route(X,Y,X'',Y'').
Upvotes: 1