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

From: Joachim Schimpf <joachim.schimpf_at_infotech.monash.edu.au>
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).
...


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

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