libminizinc icon indicating copy to clipboard operation
libminizinc copied to clipboard

Standard library does not support set counting

Open informarte opened this issue 1 year ago • 2 comments

I noticed that the standard library does not support set counting. As this might be an inadvertent omission, I thought it might be worth reporting it.

informarte avatar Feb 26 '23 06:02 informarte

I pushed a fix but I'm not 100% sure it's for the issue you're reporting. The fix addresses the problem that the following code didn't work:

var set of 1..10: x;
var int: i ::output = count(j in x)(j <= 5);

Is that the problem you found, or is some other counting function missing?

guidotack avatar Mar 02 '23 04:03 guidotack

Consider this example:

int: N = 10;
array [1..N] of var set of 1..N: x;
var set of 1..N: y;
var 1..N: c;
constraint count_eq(x, y, c);

Running minizinc for Gecode results in this error message:

Error: type error: no function or predicate with this signature found: `count_eq(array[int] of var set of int,var set of int,var int)'

informarte avatar Mar 03 '23 16:03 informarte