MiniZinc Documentation - Standard Library

These functions help debug models and check that input data conforms to the expectations.

Functions and Predicates
test abort(string: msg)

Abort evaluation and print message msg.

function $T: assert(bool: b, string: msg, $T: x)

If b is true, return x, otherwise abort with message msg.

function var $T: assert(bool: b, string: msg, var $T: x)

If b is true, return x, otherwise abort with message msg.

function var opt $T: assert(bool: b, string: msg, var opt $T: x)

If b is true, return x, otherwise abort with message msg.

function array [$U] of $T: assert(bool: b, string: msg, array [$U] of $T: x)

If b is true, return x, otherwise abort with message msg.

function array [$U] of var $T: assert(bool: b, string: msg, array [$U] of var $T: x)

If b is true, return x, otherwise abort with message msg.

function array [$U] of var opt $T: assert(bool: b, string: msg, array [$U] of var opt $T: x)

If b is true, return x, otherwise abort with message msg.

test assert(bool: b, string: msg)

If b is true, return true, otherwise abort with message msg.

function $T: trace(string: msg, $T: x)

Return x, and print message msg.

function var $T: trace(string: msg, var $T: x)

Return x, and print message msg.

function var opt $T: trace(string: msg, var opt $T: x)

Return x, and print message msg.

test trace(string: msg)

Return true, and print message msg.

function $T: trace_stdout(string: msg, $T: x)

Return x, and print message msg.

function var $T: trace_stdout(string: msg, var $T: x)

Return x, and print message msg.

function var opt $T: trace_stdout(string: msg, var opt $T: x)

Return x, and print message msg.

test trace_stdout(string: msg)

Return true, and print message msg.