"Error: syntax error, unexpected ':', expecting FZ_INT_LIT in line no. 20"

245 views
Skip to first unread message

Chav Likit

unread,
Oct 21, 2018, 5:43:20 PM10/21/18
to MiniZinc
This error occurs whenever I run the following program with n=10 (entered through the pop-up window in the IDE)


int: n;
array [1..n] of var 0..9: x;
constraint sum(x) = product(x);
solve satisfy;

Smaller values of n are fine, but larger values (>=10) also generate the same error. I can't make sense why the value of n would matter here.

I'm using Minizinc 2.2.1

Guido Tack

unread,
Oct 21, 2018, 5:51:52 PM10/21/18
to MiniZinc
The error message is coming from the solver you are using (probably Gecode), because the MiniZinc compiler generates an intermediate variable whose domain is too large (it computes the upper bound of the product, which is 3486784401). There's no easy workaround for this at the moment, you will have to split up the product yourself into individual binary products whose domain is bounded by the sum.

Cheers,
Guido
Reply all
Reply to author
Forward
0 new messages