Hi Guido, You says: "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."
But how you can use a channel constraint with different argument size? A few weeks ago I had the same problem and finally I implemented the problem with reified constraints. Thanks a lot. BR, -- Daniel On Mon, May 30, 2011 at 10:32 AM, Guido Tack <t...@gecode.org> wrote: > On 30 May 2011, at 16:08, Alin wrote: > > > Guido Tack <tack@...> 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/ > > > > > > _______________________________________________ > Gecode users mailing list > users@gecode.org > https://www.gecode.org/mailman/listinfo/gecode-users >
_______________________________________________ Gecode users mailing list users@gecode.org https://www.gecode.org/mailman/listinfo/gecode-users