How to make a function return an array in Minizinc

0

I have the following function in Minizinc:

function var int: DefinitelyVisited(array[int] of var int: S) = forall( i in index_set(S) ) ( S[i] == 1 );

This function is returning an integer, but I need it to return an array. Anyone know how I do this?

    
asked by anonymous 24.05.2018 / 23:59

1 answer

0
function array [int] of int: DefinitelyVisited(array[int] of int: x) =
let {array [int] of int: xx = array1d(x), 
} in (arrayXd(x, [ xx[i] == 1 | i in index_set(xx) ] ) )

This function returns an array

    
25.05.2018 / 20:17