Olivier Thirifay wrote: > > Hello, > > I would like to know if it is possible to obtain the "union" of domains like > in this example : > > predicat:- > VARS=[A,B,C], > A::0..5, > B::0..5, > C::0..5, > (A#=0,B#>0,C#=0);(A#=0,B#=0,C#=0). > > it returns me the domains that are covered by the constraints. > [A{0},B{1..5},C{0}] > [A{0},B{0},C{0}] > > I have a second predicate : > predicat:- > VARS=[A,B,C], > A::0..5, > B::0..5, > C::0..5. > which returns all possibilities. [A{0..5},B{0..5},C{0..5}] > > I would like to obtain the union of > [A{0},B{1..5},C{0}] > [A{0},B{0},C{0}] > -> [A{0},B{0..5},C{0}] > to compare with all possibilities [A{0..5},B{0..5},C{0..5}] > > Is it possible with the built-in predicate ? Dear Olivier, If I understand your problem, you may be interested in the propia library: :- lib(fd). :- lib(propia). predicat(VARS):- VARS=[A,B,C], A::0..5, B::0..5, C::0..5, ((A#=0,B#>0,C#=0);(A#=0,B#=0,C#=0)). [eclipse 19]: predicat([A,B,C]) infers most. A = 0 B = B{[0..5]} C = 0 Yes (0.00s cpu) Kind regards, Marco -- Marco Gavanelli DIF - Ferrara University IC-Parc visiting student William Penney Laboratory - Imperial College Exhibition Road London SW7 2AZ FAX: +44 20 7594 8432 Tel: +44 20 7594 8446 http://www.ing.unife.it/docenti/MarcoGavanelliReceived on Fri Oct 26 12:14:30 2001
This archive was generated by hypermail 2.1.8 : Wed 16 Nov 2005 06:07:11 PM GMT GMT