I am trying to build a model with a parameter n = 5 which represent the length of an array. The model also have a decision variable that takes the range 0..9 and involves two constraints. The first of all is that the sum of the values of the array must be equal to the product of values of this array and the last one must be that the order of the values should be sorted increasing.
I attach the code:
int: n = 5; % Array length
var 0..9: x;
array[1..n] of var 1..n: V;
% Constraints
constraint sum(V) = product(V);
constraint increasing(array[1..n] of var 1..n: V); % Sort problem
solve satisfy;
output[show(V)];