[eclipse-users] User defined constraints.

From: Malcolm Ryan <malcolmr_at_cse.unsw.edu.au>
Date: Mon, 12 Mar 2007 15:29:02 +1100
I'm trying to do reasoning about graphs using a CLP in Eclipse. I'm  
using the ic_symbolic library. I've created a domain of vertices:

:- local domain(vertex(v0, v1, v2, ...)).

And have defined edges as facts of the form: edge(From, To).

I define a constraint adjacent(From, To) which states that the  
vertices given by From and To are adjacent. At the moment it is  
defined as follows:

adjacent(From, To) :-
         ground(From), !,
         findall(T, edge(From, T), ToList),
         To &:: ToList.

adjacent(From, To) :-
         ground(To), !,
         findall(F, edge(F, To), FromList),
         From &:: FromList.

adjacent(From, To) :-
         var(From), var(To),
         suspend(adjacent(From, To), 2, [From,To]->inst).

As you can see, it only propagates the constraint if one of From or  
To is grounded. Otherwise it suspends. I'd like to modify it so that  
it propagates constraints more effectively. If From is constrained to  
only a subset of all vertices, then To should be constrained to the  
set of neighbouring vertices. Can I do this in Eclipse? How?

Malcolm

--
      "The Christian ideal has not been tried and found wanting;
       it has been found difficult and left untried."
             - G.K.Chesterton, What's Wrong With The World
Received on Mon Mar 12 2007 - 04:29:15 CET

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