[gecode-users] question about channeling intvars<->set
Guido Tack
tack at gecode.org
Tue Feb 22 10:29:34 CET 2011
Marco Correia wrote:
> In the reference manual,
>
> http://www.gecode.org/doc-
> latest/reference/group__TaskModelSetConnect.html#ga1bde4fb2947a0b93cf248e75e078969e
>
> it says that channel(IntVarArgs x, SetVar s) posts the propagator for
>
> { x_1,...,x_{n-1} } = y and x_i < x_{i-1}
>
> 1. I'm not sure I'm getting the correct meaning. This means that the
> propagator also forces x to be sorted in increasing order, right?
Yes, that's correct.
> 2. If 1 is correct, then what is the most efficient way of enforcing a similar
> constraint but without the requirement that x is sorted? Should I use the sort
> global constraint on x to map it to an xsorted and then channel xsorted
> instead?
That would be possible. Be careful though that it will also force all x to be distinct.
Depending on the semantics you need, a more efficient version could be
rel(home, SOT_UNION, x, y)
I changed the name of channel to channelSorted in the trunk, and added channel as an alias to rel in the minimodel.hh header. I think it's more intuitive that way.
> 3. I guess there is a typo in the reference manual. In the latex expression it
> refers to y, where the constraint says the SetVar arg is called s.
Thanks, I fixed it in the svn trunk.
Cheers,
Guido
--
Guido Tack, http://people.cs.kuleuven.be/~guido.tack/
More information about the users
mailing list