libminizinc
libminizinc copied to clipboard
Invalid set literal type when used with string type
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.
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.