[gecode-users] semantics for count(Home home, const IntVarArgs &x, IntVar y, IntRelType r, IntVar z)
Kish Shen
kisshen at cisco.com
Tue Nov 22 08:09:27 CET 2011
Hi,
I have been looking at the behaviour of
count(Home home, const IntVarArgs &x, IntVar y, IntRelType r, IntVar z)
and cannot understand what is happening when IntVar y has more than one
value in its domain. Until now, I have only tested this constraint with
y having a singleton value in its domain, and in this case, the
constraint behaves the same as the case where y is Int, i.e. the number
of occurrences of the value y in x is counted.
However, one of my user wanted to use the constraint where y has
multiple values (i.e. the counts constraint in the global constraint
catalog). I know this constraint is provided with y being an IntSet, but
my user did not know about this constraint, so he used the version where
y is a IntVar instead.
I had expected that mulitple domain values in y would behave like
multiple values in the IntSet for this constraint, but this does not
seem to be the case. For example, the constraint succeeds with the
following (in ECLiPSe syntax, but the argument order of Gecode's
constraint):
Y :: [3,4], count([3,0,3,3,4], Y, =, 2)
where [3,0,3,3,4] is x, IntRelType is IRT_EQ.
I don't understand why this succeeds -- the count for 3 is 3, and for 4
is 1, and for both 3 and 4 is 4, none of which is equal to 2. So what is
the semantics?
The equivalent call using y as an IntSet [3,4] fails as expected. Also,
for the same count constraint, if y has a single domain value (e.g. 3 or
4), then the constraint behave as I expected, i.e. z = 3 for y = 3, and
z = 1 for y = 1.
Thanks and cheers,
Kish
--
This e-mail may contain confidential and privileged material for the
sole use of the intended recipient. Any review, use, distribution or
disclosure by others is strictly prohibited. If you are not the intended
recipient (or authorized to receive for the recipient), please contact
the sender by reply e-mail and delete all copies of this message.
Cisco Systems Limited (Company Number: 02558939), is registered in
England and Wales with its registered office at 1 Callaghan Square,
Cardiff, South Glamorgan CF10 5BT.
More information about the users
mailing list