Re: [eclipse-users] User defined constraints.

From: Joachim Schimpf <js10_at_...2...>
Date: Wed, 14 Mar 2007 19:19:19 +0000
Malcolm Ryan wrote:
> On 13/03/2007, at 4:26 AM, Joachim Schimpf wrote:
>> Malcolm Ryan wrote:
>>> I'm trying to do reasoning about graphs using a CLP in Eclipse.
> 
> I worked out the following solution:
> 
> adjacent(From, To) :-
>          domain_list(From, FromDomain),
>          domain_list(To, ToDomain),
> 
>          outgoing(FromDomain, Outgoing),
>          incoming(ToDomain, Incoming),
> 
>          From &:: Incoming,
>          To &:: Outgoing,
> 
>          (ground(From), ground(To) ->
>                  true
>          ;
>                  % suspend doesn't work properly on ic_symbolic
>                  symbol_domain_index(From, _, F),
>                  symbol_domain_index(To, _, T),
>                  suspend(adjacent(From, To), 2, [F,T]->constrained)
>          ).

This looks correct, but you can stop resuspending the constraint
as soon as one of the variables has been instantiated.


> 
>> An easy and quite efficient way to do this is to use the
>> "Generalised Propagation" library lib(propia).
> ...
>> adjacent(X,Y) :-
>> 	edge(X,Y) infers ic.
>>
> 
> Wow, that's much simpler than my solution.
> How does it work?

Propia can actually use two different algorithms in this case.
The more general one is recomputing the solution set every time
X or Y change, using a method called topological branch-and-bound.

The other method is used when you specify "infers ac", and is
only applicable when - as in this case - the solution set is
finite.  The constraint is then translated into two element/3
constraints.


 > The documentation on lib(propia) is very sparse.

Apart from the reference manual, there are chapters on Propia in
both the ECLiPSe Tutorial and the Constraint Library Manual.
These also contains references to background papers.


-- Joachim
Received on Wed Mar 14 2007 - 19:20:00 CET

This archive was generated by hypermail 2.2.0 : Mon Jul 09 2018 - 02:05:29 CEST