[gecode-users] inforation on count constraints

Guido Tack tack at gecode.org
Tue May 3 18:36:01 CEST 2011


Kish Shen wrote:

> Hi,
> 
> I am trying to figure out if some of the versions of the count constraints corresponds to constraints in other places (e.g. the global constraint catalog, in other constraint systems, or in papers).
> One of the count variants maps to the count constraint of the global constraint catalog (and SICStus), while another maps to (one version) of the global cardinality constraint. However, I was not able to determine if the other versions of count have any equivalent to constraints defined elsewhere, can anyone help by pointing me to any equivalent constraints that might be defined elsewhere for the following (these descriptions are based on the ones in the MPG):
> 
> 
> count(home, x, c, IRT_EQ, z):
> 
> where x is an array of integer variables and c is an array of integers of the same array size as x, and z is an integer variable (or value).
> 
> which constrains z to how often xi = cl.

I don't know if this version is used anywhere else.

> count(home, x, y)
> 
> where x and y are integer variable arrays.
> 
> which constraints the number of variables in x that are equal to a value j is yj.
> 
> This seems to be a restricted version of the global cardinality constraint. Is the reason for providing this more restricted form because this restriction allows for a more efficient implementation of the constraint?

No, it's just for convenience, so that you don't have to write
count(home,x,y,IntArgs::create(y.size(),0,1));

> On a slightly different topic, in the MPG description of the count constraints, there is a reference to
> 
> count(home, x IntSet(0,1), IntSet(0,n))
> 
> which seems to be an example of using
> 
> count(home, x, d, c)
> 
> where x is an array of integer variables, d is an integer set, and c an array of integer values -- but the last argument (IntSet(0,n)) is also an integer set. I also cannot find the description of count with two IntSet in the reference documentation (in doc-latest, I assume for 3.5.0?) Am I missing something?

That's a bug in the documentation, thanks.  Will be fixed in the next version.

Cheers,
	Guido

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








More information about the users mailing list