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.
on-restart-benchmarks/share/minizinc/std/weighted_spanning_tree.mzn
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

46 lines
2.3 KiB
MiniZinc

include "fzn_wst.mzn";
include "fzn_wst_reif.mzn";
include "fzn_dwst.mzn";
include "fzn_dwst_reif.mzn";
/** @group globals.graph
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.
@param N: the number of nodes in the given graph
@param E: the number of edges in the given graph
@param from: the leaving node 1..\a N for each edge
@param to: the entering node 1..\a N for each edge
@param w: the weight of each edge
@param r: the root node (which may be variable)
@param es: a Boolean for each edge whether it is in the subgraph
@param K: the weight of the tree
*/
predicate d_weighted_spanning_tree(int: N, int: E, array[int] of int: from, array[int] of int: to, array[int] of int: w,
var int: r, array[int] of var bool: es, var int: K) =
assert(index_set(from) = 1..E,"dwst: index set of from must be 1..\(E)") /\
assert(index_set(to) = 1..E,"dwst: index set of to must be 1..\(E)") /\
assert(index_set(es) = 1..E,"dwst: index set of es must be 1..\(E)") /\
assert(index_set(w) = 1..E,"dwst: index set of w must be 1..\(E)") /\
fzn_dwst(N,E,from,to,w,r,es,K);
/** @group globals.graph
Constrains the set of edges \a es of a given undirected graph to be a weighted spanning tree of weight \a W.
@param N: the number of nodes in the given graph
@param E: the number of edges in the given graph
@param from: the leaving node 1..\a N for each edge
@param to: the entering node 1..\a N for each edge
@param w: the weight of each edge
@param es: a Boolean for each edge whether it is in the subgraph
@param K: the weight of the tree
**/
predicate weighted_spanning_tree(int: N, int: E, array[int] of int: from, array[int] of int: to, array[int] of int: w,
array[int] of var bool: es, var int: K) =
assert(index_set(from) = 1..E,"wst: index set of from must be 1..\(E)") /\
assert(index_set(to) = 1..E,"wst: index set of to must be 1..\(E)") /\
assert(index_set(es) = 1..E,"wst: index set of es must be 1..\(E)") /\
assert(index_set(w) = 1..E,"dwst: index set of w must be 1..\(E)") /\
fzn_wst(N,E,from,to,w,es,K);
%-----------------------------------------------------------------------------%