% % Filename: dyck4.mzn % Usage: % minizinc -a --soln-sep "" --search-complete-msg "" -D "n=4;" dyck4.mzn 2>/dev/null | awk 'NF' | sort % % see also http://www.minizinc.org % include "globals.mzn"; int: n; array[int] of string: sym = ["R", "L"]; array[1..4*n] of var {-1,1}: x; array[1..4*n] of var 0..n: height; constraint height[1] == x[1]; constraint forall([height[k] - height[k-1] == x[k] | k in 2..4*n]); constraint height[4*n] == 0; constraint exists([height[k] == n | k in 1..4*n]); solve satisfy; output [sym[1 + (1+fix(x[i])) div 2]| i in 1..4*n];