MiniZinc Documentation - Standard Library

Functions and Predicates
function $$E: enum_next(set of $$E: e, $$E: x)

Return next greater enum value of x

function var $$E: enum_next(set of $$E: e, var $$E: x) =
let {constraint x < max(e),} in (x+1)
(standard decomposition from builtins.mzn:1400)

Return next greater enum value of x

function $$E: enum_prev(set of $$E: e, $$E: x)

Return next smaller enum value of x

function var $$E: enum_prev(set of $$E: e, var $$E: x) =
let {constraint x > min(e),} in (x-1)
(standard decomposition from builtins.mzn:1406)

Return next smaller enum value of x

function $$E: to_enum(set of $$E: X, int: x)

Convert x to enum type X

function var $$E: to_enum(set of $$E: X, var int: x) =
let {constraint x in X,} in (x)
(standard decomposition from builtins.mzn:1412)

Convert x to enum type X