this repo has no description
at develop 2.1 kB view raw
1include "fzn_subgraph_int.mzn"; 2include "fzn_subgraph_int_reif.mzn"; 3include "fzn_subgraph_enum.mzn"; 4include "fzn_subgraph_enum_reif.mzn"; 5 6/** @group globals.graph 7 Constrains that \a ns and \a es is a subgraph of a given directed graph. 8 9 \a N is the number of nodes in the given graph 10 \a E is the number of edges in the given graph 11 \a from is the leaving node 1..\a N for each edge 12 \a to is the entering node 1..\a N for each edge 13 \a ns is a Boolean for each node whether it is in the subgraph 14 \a es is a Boolean for each edge whether it is in the subgraph 15*/ 16predicate subgraph(int: N, int: E, array[int] of int: from, array[int] of int: to, 17 array[int] of var bool: ns, array[int] of var bool: es) = 18 assert(index_set(from) = 1..E,"subgraph: index set of from must be 1..\(E)") /\ 19 assert(index_set(to) = 1..E,"subgraph: index set of to must be 1..\(E)") /\ 20 assert(index_set(ns) = 1..N,"subgraph: index set of ns must be 1..\(N)") /\ 21 assert(index_set(es) = 1..E,"subgraph: index set of es must be 1..\(E)") /\ 22 fzn_subgraph(N,E,from,to,ns,es); 23 24/** @group globals.graph 25 Constrains that \a ns and \a es is a subgraph of a given directed graph. 26 27 \a from is the leaving node for each edge 28 \a to is the entering node for each edge 29 \a ns is a Boolean for each node whether it is in the subgraph 30 \a es is a Boolean for each edge whether it is in the subgraph 31*/ 32predicate subgraph(array[int] of $$N: from, array[int] of $$N: to, 33 array[$$N] of var bool: ns, array[int] of var bool: es) = 34 assert(index_set(from) = index_set(to),"subgraph: index set of from and to must be identical") /\ 35 assert(index_set(from) = index_set(es),"subgraph: index set of from and es must be identical") /\ 36 assert(dom_array(from) subset index_set(ns),"subgraph: elements in from must be in index set of ns") /\ 37 assert(dom_array(to) subset index_set(ns),"subgraph: elements in to must be in index set of ns") /\ 38 fzn_subgraph(from,to,ns,es); 39 40%-----------------------------------------------------------------------------%