Fantastic. It worked. Very much appreciated. You are a life saver. Thank you.
Original Message:
Sent: Fri February 24, 2023 08:24 AM
From: Hugues Juille
Subject: Urgent Help Needed
Hi Tarek,
t1.FSLags
is a set, not an array. It is however considered as an ordered set where elements can be accessed by their index.
For instance, one could write your constraint as follows:
endBeforeStart(task[t1], task[<t2>], item(t1.FSLags, 0));
I hope this can help you.
Best regards,
Hugues
PS: I suppose a better formulation would be: item(t1.FSLags, t2)
. However, I'm not sure to understand the values for FSSucc in your data. The later formulation will result in errors if executed with your data.
------------------------------
Hugues Juille
Original Message:
Sent: Fri February 24, 2023 01:43 AM
From: Tarek Hegazy
Subject: Urgent Help Needed
Hi,
I appreciate very much if you help me resolve the error in the following simple example. Here are the mod and dat files:
// mod file
using CP;
tuple Task {
key int id;
int duration;
{int} FSSuccs;
{int} FSLags;
}
{Task} Tasks = ...;
dvar interval task[t in Tasks] size t.duration;
minimize max(tt in Tasks) endOf(task[tt]);
subject to {
//Gives error "Not an Array" on the Lag t1.FSLags[<t2>]
//but works if I put any constant value, like 0 or any other value
forall (t1 in Tasks, t2 in t1.FSSuccs) endBeforeStart(task[t1], task[<t2>], t1.FSLags[<t2>]);
}
execute {
}
//.dat File
Tasks = {
< 1, 8, {6},{6}>,
< 2, 8, {5,3,4},{2,0,3}>,
< 3, 7, {5},{0} >,
< 4, 4, {5,6},{0,0} >,
< 5, 9, {8},{8} >,
< 6, 6, {},{}>,
< 7, 12, {},{} >,
< 8, 4, {},{} >,
};
------------------------------
Tarek Hegazy
------------------------------