Search code examples
minizinc

Having trouble using a function of a var set twice in an output statement in minizinc


The following program runs with no problem.

array[1..2] of var set of 5..8: ar = [{5, 6}, {6, 7}];

function string: format_set_1( var set of int: s ) = "\(fix(s))\t";  
function string: format_set_2( var set of int: s ) = "\(fix(s))\t";  

output
   [format_set_1(ar[1]) ++ format_set_2(ar[2])];

But when I replace format_set_2 with format_set_1 (or vice versa) in the output array I get the following error message.

MiniZinc: type error: 
function with the same type already defined in C:/Users/rabbott/AppData/Local/Temp/MiniZinc IDE (bundled)-SEkuWd/untitled_model.mzn:4.1

What's going on?


Solution

  • This issue is caused by a bug in MiniZinc 2.3.2. The issue was recently raised on GitHub and has been fixed on the MiniZinc develop branch. The next release of MiniZinc should again work as expected.