this repo has no description
at develop 627 B view raw
1predicate fzn_dag(array[int] of $$N: from, array[int] of $$N: to, 2 array[$$N] of var bool: ns, array[int] of var bool: es) = 3 let { 4 set of int: EDGE = index_set(es); 5 array[index_set(ns)] of var 0..length(ns)-1: dist; /* distance of longest path */ 6 7 } in 8 forall(n in index_set(ns))(not ns[n] -> dist[n] = 0) /\ 9 forall(e in EDGE) 10 (es[e] -> dist[from[e]] + 1 <= dist[to[e]]) 11 /\ 12 % redundant constraint to ensure all distances are fixed 13 forall(n in index_set(ns)) 14 (dist[n] = max( [0] ++ [ (dist[from[e]] + 1)*es[e] | e in EDGE where to[e] = n ])) 15 ;