clp with intervals

From: Joost Geurts <>
Date: Fri 19 Nov 2004 04:59:26 PM GMT
Message-Id: <>
Dear people,

I have the following CLP program which fails although I do not really
understand why. It fails in SWI-prolog at exactly the same point so I
assume it is me who made a mistake. Maybe somebody can explain, and
possibly suggest a way to solve it.

The problem is that I have a N intervals (in the example below there are
two, A and B) which are contained in an interval C which has the
property that it is a small as possible.  

For completeness I state additional requirements for my application
although they are not all encoded in the sample program:
The C interval is contained in D. Finally at label time I'd like to
specify whether C should be labeled min, max or centered (default:

The last constraint, CX2 #= MinX2 fails. My guess is it has something to
do with the minlist constraint. I am using eclipse 5.7 with the ic

Any help would be greatly appreciated,




run(Out) :-
        CVars = [AX1,AX2,BX1,BX2,CX1,CX2,DX1,DX2],
        Out =

        L = 0, H = 1000,
        AX1 #>= L, AX1 #=< H, AX2 #>= L, AX2 #=< H, AX1 #=< AX2,
        BX1 #>= L, BX1 #=< H, BX2 #>= L, BX2 #=< H, BX1 #=< BX2,
        CX1 #>= L, CX1 #=< H, CX2 #>= L, CX2 #=< H, CX1 #=< CX2,      
        DX1 #>= L, DX1 #=< H, DX2 #>= L, DX2 #=< H, DX1 #=< DX2,
        % set size for A , B
        WA = 180,
        WB = 120,
        % width A,B
        WA #= AX2 - AX1,        
        WB #= BX2 - BX1,                        
        % A before B
        AX2 #=< BX1,

        % C contains A&B
        AX1 #>= CX1, AX2 #=< CX2,
        BX1 #>= CX1, BX2 #=< CX2,
        % find minimum  of A & B
        % D contains C
        DX1 #=< CX1, DX2 #>= CX2,               
        % C fits tightly
        CX1 #= MinX1, 
        CX2 #= MinX2, % This constraint fails!

Joost Geurts <>
Received on Fri Nov 19 17:05:33 2004

This archive was generated by hypermail 2.1.8 : Wed 16 Nov 2005 06:07:31 PM GMT GMT