libminizinc icon indicating copy to clipboard operation
libminizinc copied to clipboard

Invalid set literal type when used with string type

Open GonzaloHernandez opened this issue 2 years ago • 1 comments

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.

GonzaloHernandez avatar Oct 17 '23 05:10 GonzaloHernandez

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.

Dekker1 avatar Oct 17 '23 05:10 Dekker1