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

Invalid set literal type when used with string type #735

Open
GonzaloHernandez opened this issue Oct 17, 2023 · 1 comment
Open

Invalid set literal type when used with string type #735

GonzaloHernandez opened this issue Oct 17, 2023 · 1 comment

Comments

@GonzaloHernandez
Copy link

I found a problem when I try to define a set of strings like the following example:

set of string : s = {"Mary","Dylan","Jhon"};

MiniZinc displays the below message in the output:

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: 
"invalid set literal type"
Process finished with non-zero exit code 1.

Thanks team.

@Dekker1
Copy link
Member

Dekker1 commented Oct 17, 2023

I'm afraid that, although we should probably improve the error message, this is just a limitation in MiniZinc. The compiler does not support set of string objects.

Please have a look at the MiniZinc enumerated types. You will likely be able to use them to solve your problem. docs

Otherwise you can use an array[int] of string and then use a set of int to index into the array.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants