Re: [eclipse-clp-users] negate constraints

From: Oliver Shycle <oliver.shycle_at_googlemail.com>
Date: Wed, 31 Mar 2010 14:27:35 +0200
Hello,

well I think the negation axample was not really good to express what i
want. Let me formulate the problem like this:
We stick to the variables and their domains as before. I need constraints
that express the following: "if any variable has a value greater than eight,
there must be at least one variable with a value smaller than eight."
-------------------------------
example :-
    OutputModel = [A, B, C, D],
    A #:: 1..100,
    B #:: 1..100,
    C #:: 1..100,
    D #:: 1..100,

% constraints

    labeling(OutputModel),
    writeln(OutputModel).
---------------------------------

I dont know how to express such kind of constraints.
Thanks for your help.

Oliver.

On 31 March 2010 11:02, Alexandre Saidi <Alexandre.Saidi_at_ec-lyon.fr> wrote:

> 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 - 12:27:42 CEST

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