1
0
This repository has been archived on 2025-03-06. You can view files and clone it, but cannot push or open issues or pull requests.
Jip J. Dekker fad1b07018 Squashed 'software/minizinc/' content from commit 4f10c8205
git-subtree-dir: software/minizinc
git-subtree-split: 4f10c82056ffcb1041d7ffef29d77a7eef92cf76
2021-06-16 14:06:46 +10:00

19 lines
975 B
MiniZinc

include "fzn_dag.mzn";
include "fzn_dag_reif.mzn";
/** @group globals.graph
Constrains the subgraph \a ns and \a es of a given directed graph to be a DAG.
@param from: the leaving node for each edge
@param to: the entering node for each edge
@param ns: a Boolean for each node whether it is in the subgraph
@param es: a Boolean for each edge whether it is in the subgraph
*/
predicate dag(array[int] of $$N: from, array[int] of $$N: to,
array[$$N] of var bool: ns, array[int] of var bool: es) =
assert(index_set(from) = index_set(to),"dreachable: index set of from and to must be identical") /\
assert(index_set(from) = index_set(es),"dreachable: index set of from and es must be identical") /\
assert(dom_array(from) subset index_set(ns),"dreachable: nodes in from must be in index set of ns") /\
assert(dom_array(from) subset index_set(ns),"dreachable: nodes in to must be in index set of ns") /\
fzn_dag(from,to,ns,es);