[eclipse-clp-users] Need help creating a custom reified constraint

From: Philipp Marcus <marcus_at_cip.ifi.lmu.de>
Date: Thu, 08 Apr 2010 17:28:14 +0200
Hi,

i need help creating a custom reified constraint. Given the following 
program, whereby the predicate existsPath/3 tells, if there exists a 
path between two nodes in a graph with the paths given in a List called 
PathList.

    :-lib(propia).
    :-lib(fd).

    :- export struct( path(sourceNode,targetNode,distance,edgesPassed)).

    existsPath(X,Y,PathList) :-
         member(path{sourceNode:X,targetNode:Y},PathList) infers fd.


a possible call of the program would be:

Y#::["X","Y","K","L","I"],
existsPath("X",Y,
     [path{sourceNode:"X",targetNode:"K"},
     path{sourceNode:"X",targetNode:"I"}]).
Now I need to create a reified version of that constraint, looking 
something like:

existsPath(X,Y,PathList,B)

but I don't know how to do that. I would be really happy if someone 
could help me with this problem.

Best regards,
Philipp
Received on Thu Apr 08 2010 - 15:48:09 CEST

This archive was generated by hypermail 2.2.0 : Thu Feb 02 2012 - 02:31:58 CET