this repo has no description
at develop 2.3 kB view raw
1include "fzn_wst.mzn"; 2include "fzn_wst_reif.mzn"; 3include "fzn_dwst.mzn"; 4include "fzn_dwst_reif.mzn"; 5 6/** @group globals.graph 7 Constrains the set of edges \a es of a given directed graph to be a weighted spanning tree rooted at \a r of weight \a W. 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 w is the weight of each edge 14 \a r is the root node (which may be variable) 15 \a es is a Boolean for each edge whether it is in the subgraph 16 \a K is the weight of the tree 17*/ 18predicate d_weighted_spanning_tree(int: N, int: E, array[int] of int: from, array[int] of int: to, array[int] of int: w, 19 var int: r, array[int] of var bool: es, var int: K) = 20 assert(index_set(from) = 1..E,"dwst: index set of from must be 1..\(E)") /\ 21 assert(index_set(to) = 1..E,"dwst: index set of to must be 1..\(E)") /\ 22 assert(index_set(es) = 1..E,"dwst: index set of es must be 1..\(E)") /\ 23 assert(index_set(w) = 1..E,"dwst: index set of w must be 1..\(E)") /\ 24 fzn_dwst(N,E,from,to,w,r,es,K); 25 26/** @group globals.graph 27 Constrains the set of edges \a es of a given undirected graph to be a weighted spanning tree of weight \a W. 28 29 \a N is the number of nodes in the given graph 30 \a E is the number of edges in the given graph 31 \a from is the leaving node 1..\a N for each edge 32 \a to is the entering node 1..\a N for each edge 33 \a w is the weight of each edge 34 \a es is a Boolean for each edge whether it is in the subgraph 35 \a K is the weight of the tree 36**/ 37predicate weighted_spanning_tree(int: N, int: E, array[int] of int: from, array[int] of int: to, array[int] of int: w, 38 array[int] of var bool: es, var int: K) = 39 assert(index_set(from) = 1..E,"wst: index set of from must be 1..\(E)") /\ 40 assert(index_set(to) = 1..E,"wst: index set of to must be 1..\(E)") /\ 41 assert(index_set(es) = 1..E,"wst: index set of es must be 1..\(E)") /\ 42 assert(index_set(w) = 1..E,"dwst: index set of w must be 1..\(E)") /\ 43 fzn_wst(N,E,from,to,w,es,K); 44 45%-----------------------------------------------------------------------------%