How to make a function return an array in Minizinc

Asked

Viewed 16 times

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. Does anyone know how to do this?

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

Browser other questions tagged

You are not signed in. Login or sign up in order to post.