[gecode-users] Scheduling

Guido Tack tack at gecode.org
Mon May 30 16:32:18 CEST 2011


On 30 May 2011, at 16:08, Alin wrote:

> Guido Tack <tack at ...> writes:
> 
>> 
>> Did you use the version of unary with optional tasks?  Otherwise, the same
> start time up in different
>> unary constends raints, which is quite likely to be unsatisfiable.
>> 
>> Guido
>> 
> 
> I've tried to use the unary version with optional tasks,
> but I don't quite understand how it would help
> why should I set a certain task to be optional if I have reification ?

How should the unary constraint know about the reification otherwise?

Given your example, I think you need something like this:

BoolVarArgs _m(home, n_tasks*n_resources);
Matrix<BoolVarArgs> m(m, n_tasks, n_resources);

for (int i=0; i<n_resources; i++) {
  for (int j=0; j<n_tasks; j++) {
    rel(home, m(j,i)  == (resource[j] == i));
    dom(home, start_time[j], set_possible_values, m(i,j));
  }
  unary(home, startTimes, durations, m.row(i));
}
for (int i=0; i<n_tasks; i++) {
  linear(home, m.col(i), IRT_EQ, 1); // each task is scheduled on exactly one resource
}

For the m(j,i)  == (resource[j] == i) constraint, you can actually use a channel constraint, which is more efficient, but I thought this is closer to your original code.

Cheers,
	Guido

-- 
Guido Tack, http://people.cs.kuleuven.be/~guido.tack/







More information about the users mailing list