Re: [eclipse-clp-users] negate constraints

From: Alexandre Saidi <Alexandre.Saidi_at_ec-lyon.fr>
Date: Wed, 31 Mar 2010 11:02:19 +0200
Hi Olivier,
I’m not sur i understand what you want to do with the negation.

Tell me what if :
example :-

    OutputModel = [A, B, C, D],
    A #:: 1..100,
    B #:: 1..100,
    C #:: 1..100,
    D #:: 1..100,
    
	#\+ (A #> 8 #\/ B#> 8 #\/  C #> 8 #\/ D#> 8),
    
    labeling(OutputModel),
    writeln(OutputModel).

In both cases,  constraint propagation will restrict variable domaine.
It’s better not to use Disjunction (like member).

Alex

Le 30 mars 2010 à 09:57, Oliver Shycle a écrit :

> Hi all,
> 
> I have a problem to express negated constraints in ECLiPSe. In my programm, I want to express what value certain interval constraints may NOT have. Consider the following problem description: the program shall find values for four variables such that the values are NOT greater than 8.
> 
> Here's the code:
> ------------------------------------------------------
> :- lib(ic).
> 
> example :-
> 
>     OutputModel = [A, B, C, D],
>     A #:: 1..100,
>     B #:: 1..100,
>     C #:: 1..100,
>     D #:: 1..100,
>     
>     not(wrong_value(OutputModel)),
>     labeling(OutputModel),
>     writeln(OutputModel).
> 
> wrong_value(Vars) :-
>     member(Var, Vars),
>     greater_eight(Var).
> 
> greater_eight(X) :-
>     X #> 8.
> ------------------------------------------------------
> 
> I know that I rather could limit the variable's domains to a maximum of 8, but I want to demonstrate my problem with this snippet. When ECLiPSe comes along the constraint "X #> 8" with the first variable of the list, the term evaluates to true. Therefore wrong_value evaluates to true without even setting up constraints for the other variables. The negation not(wrong_value(OutputModel)) thus becomes false and ECLiPSe sais it can't find a solution. If I test the code with a set of integers instead of variables everything works as expected.
> How can I tell ECLiPSe not to evaluate X #> 8 instantly, but keeping the constraint in mind for later instantiation during labeling/1?
> 
> Many thanks for your help.
> 
> Oliver.
> 
> ------------------------------------------------------------------------------
> Download Intel&#174; Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev_______________________________________________
> ECLiPSe-CLP-Users mailing list
> ECLiPSe-CLP-Users_at_lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/eclipse-clp-users

 -------------------------------
Alexandre Saidi
Maitre de Conférences
Ecole Centrale de Lyon-Dép. MI
LIRIS-CNRS UMR 5205
Tél : 0472186530, Fax : 0472186443
Received on Wed Mar 31 2010 - 09:02:33 CEST

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