Re: [eclipse-clp-users] Finite domain with partial order

From: Joachim Schimpf <joachim.schimpf_at_...44...>
Date: Sun, 01 Feb 2009 01:23:42 +1100
Meer, A.P. van der wrote:
> Hello,
> Iím trying to implement a (prototype of a) type system in Eclipse using 
> constraint handling rules. The problem is that the domain of types is 
> partially ordered. For example, if we take integers, reals and strings, 
> I would like integer < real but not string < integer or string > 
> integer. Iím currently using the FD solver for this, representing each 
> type with an integer, but that is not really convenient, since I have to 
> keep checking that the comparisons are actually valid.
> Is there an ďofficialĒ way of using partial orders in eclipse? I didnít 
> see anything in the manual. I suppose I could try the FD_Sets solver, 
> because the subset relation is a partial order, or I could try the SD 
> solver and somehow define my own < relation, but either sounds 
> straightforward.

Yes, you define your own relation.  Here is one way:

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

lt(X,Y) :- lt_table(X,Y) infers ac.

lt_table(integer, real).
lt_table(real, simple).
lt_table(string, simple).

Received on Sat Jan 31 2009 - 14:23:54 CET

This archive was generated by hypermail 2.3.0 : Thu Aug 22 2019 - 09:15:17 CEST