this repo has no description
at develop 2.1 kB view raw
1include "fzn_connected.mzn"; 2include "fzn_connected_reif.mzn"; 3include "fzn_dconnected.mzn"; 4include "fzn_dconnected_reif.mzn"; 5 6/** @group globals.graph 7 Constrains the subgraph \a ns and \a es of a given directed graph to be connected. 8 9 \a from is the leaving node for each edge 10 \a to is the entering node for each edge 11 \a ns is a Boolean for each node whether it is in the subgraph 12 \a es is a Boolean for each edge whether it is in the subgraph 13*/ 14predicate dconnected(array[int] of $$N: from, array[int] of $$N: to, 15 array[$$N] of var bool: ns, array[int] of var bool: es) = 16 assert(index_set(from) = index_set(to),"dconnected: index set of from and to must be identical") /\ 17 assert(index_set(from) = index_set(es),"dconnected: index set of from and es must be identical") /\ 18 assert(dom_array(from) subset index_set(ns),"dconnected: nodes in from must be in index set of ns") /\ 19 assert(dom_array(from) subset index_set(ns),"dconnected: nodes in to must be in index set of ns") /\ 20 fzn_dconnected(from,to,ns,es); 21 22%-----------------------------------------------------------------------------% 23 24/** @group globals.graph 25 Constrains the subgraph \a ns and \a es of a given undirected graph to be connected. 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 connected(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),"connected: index set of from and to must be identical") /\ 35 assert(index_set(from) = index_set(es),"connected: index set of from and es must be identical") /\ 36 assert(dom_array(from) subset index_set(ns),"connected: nodes in from must be in index set of ns") /\ 37 assert(dom_array(from) subset index_set(ns),"connected: nodes in to must be in index set of ns") /\ 38 fzn_connected(from,to,ns,es); 39