Re: [eclipse-users] Constraint Challenge

From: Andrew Eremin <a.eremin_at_crosscoreop.com>
Date: Fri, 30 Mar 2007 10:55:15 +0100
Dear Dorothea,

> I need help for a planing contraint problem.
>
> I want to model the following situation with the help of constraints:
>
> There are two activities one will be executed after an other within a 
> definite range.
>
> EndTimeFirst #:: [2..10],
> StartTimeSecond #:: [2..10],
> EndTimeFirst #<= StartTimeSecond,
>
> This allows delays between the execution of the two activities. This is 
> intended.
>
> Now, I want to state that there is no other activity executed during the 
> delay. Do you have any idea, how to do that?
>   

One way would be to use reified constraints to define a predicate 
constraining variables not to be within the delay:

not_in_range(X, Start, End) :-
    #<(X, Start, Before),
    #>(X, End, After),
    Before + After #= 1.

and then:

...
(
    foreach(StartTime, OtherStartTimes),
    param(StartTimeSecond, EndTimeFirst)
do
    not_in_range(StartTime, EndTimeFirst, StartTimeSecond)
),
...

    Andy
Received on Fri Mar 30 2007 - 10:55:25 CEST

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