[gecode-users] AllDiff_except_0

Guido Tack guido.tack at monash.edu
Tue Oct 27 10:54:45 CET 2015


Hi,

you don’t need a loop.  Look for the count constraint that takes an IntVarArgs and an IntSetArgs as arguments, that does exactly what you need in a single constraint.  It propagates bounds and domain consistency (depending on the IntConLevel argument) so it’s a perfect replacement for alldifferent_except_0.

Cheers,
Guido

-- 
Guido Tack
http://www.csse.monash.edu/~guidot/ <http://www.csse.monash.edu/~guidot/>



> On 27 Oct 2015, at 8:18 PM, mehdi m <medistif at hotmail.fr <mailto:medistif at hotmail.fr>> wrote:
> 
> Hi,
> 
> Ok.
> For the moment i did it with cardinality constraint (count) with an upper bound of 1, but i do not know how far the propagator is really strong since i put it in a loop for every possible value except 0 !
> 
> It will be useful to put the AllDiff_except_value constraint in the Gecode’s wishlist.
> 
> Cheers,
> Mehdi M
> --------------
> To: users at gecode.org <mailto:users at gecode.org>
> From: jean-noel.monette at it.uu.se <mailto:jean-noel.monette at it.uu.se>
> Date: Tue, 27 Oct 2015 09:44:30 +0100
> Subject: Re: [gecode-users] AllDiff_except_0
> 
> Hi,
> 
> Another way to do it is to use a global cardinality constraint (called "count" in Gecode) with an upper bound of 1 for all values, except 0 for which you put any suitable large value. This requires to know the list of possible values in advance.
> 
> Cheers,
> 
> JN
> 
> On 2015-10-27 09:38, Christian Schulte wrote:
> Hi,
>  
> No, unfortunately not. If you need it really badly, I could put it on Gecode’s wishlist.
>  
> For the time being, you would have to resort to using reification.
>  
> Cheers
> Christian
>  
> --
> Christian Schulte, www.gecode.org/~schulte <http://www.gecode.org/~schulte>
> Professor of Computer Science, KTH, cschulte at kth.se <mailto:cschulte at kth.se>
> Expert Researcher, SICS, cschulte at sics.se <mailto:cschulte at sics.se>
>  
> From: users-bounces at gecode.org <mailto:users-bounces at gecode.org> [mailto:users-bounces at gecode.org <mailto:users-bounces at gecode.org>] On Behalf Of mehdi m
> Sent: Monday, October 26, 2015 08:26 PM
> To: users at gecode.org <mailto:users at gecode.org>
> Subject: [gecode-users] AllDiff_except_0
>  
> Hi everyone,
>  
> Is there the constraint (AllDiff_except_0) in gecode ? 
>  
> Thanks. 
> 
> 
> _______________________________________________
> Gecode users mailing list
> users at gecode.org <mailto:users at gecode.org>
> https://www.gecode.org/mailman/listinfo/gecode-users <https://www.gecode.org/mailman/listinfo/gecode-users>
> 
> 
> _______________________________________________ Gecode users mailing list users at gecode.org <mailto:users at gecode.org> https://www.gecode.org/mailman/listinfo/gecode-users <https://www.gecode.org/mailman/listinfo/gecode-users>_______________________________________________
> Gecode users mailing list
> users at gecode.org <mailto:users at gecode.org>
> https://www.gecode.org/mailman/listinfo/gecode-users <https://www.gecode.org/mailman/listinfo/gecode-users>


-- 
Guido Tack,
http://www.csse.monash.edu/~guidot/



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.gecode.org/pipermail/users/attachments/20151027/4e002234/attachment.html>


More information about the users mailing list