Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

could not replace binary operator by call to count_eq #728

Closed
jakkanen opened this issue Sep 11, 2023 · 1 comment
Closed

could not replace binary operator by call to count_eq #728

jakkanen opened this issue Sep 11, 2023 · 1 comment
Labels
bug resolved Issue is resolved and the feature or fix will be part of next release

Comments

@jakkanen
Copy link

jakkanen commented Sep 11, 2023

minizinc 2.7.6
The following snippet causes minizinc to suggest I file a radar

enum color = {red, green, blue};
set of int: shirt_ids = 1..5;
array[shirt_ids] of color: shirts = [red, green, blue, red, green];
var set of shirt_ids: wanted;
constraint forall (c in color)(count(i in wanted)(shirts[i] = c) = 1);
solve satisfy;

results in:

$ minizinc  minibug.mzn 
MiniZinc has encountered an internal error. This is a bug.
Please file a bug report using the MiniZinc bug tracker.
The internal error message was: 
"could not replace binary operator by call to count_eq"
@Dekker1
Copy link
Member

Dekker1 commented Sep 12, 2023

It seems the function matching fails, because the comprehension will result in a array of var opt int type, and we currently don't have a definition of count_eq with an argument of this type.

We should either add a definition for this, or disable the rewriting in this case.

@Dekker1 Dekker1 added the bug label Sep 12, 2023
@Dekker1 Dekker1 added the resolved Issue is resolved and the feature or fix will be part of next release label Sep 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug resolved Issue is resolved and the feature or fix will be part of next release
Projects
None yet
Development

No branches or pull requests

2 participants