this repo has no description
1include "fzn_path_int.mzn";
2include "fzn_path_int_reif.mzn";
3include "fzn_path_enum.mzn";
4include "fzn_path_enum_reif.mzn";
5include "fzn_dpath_int.mzn";
6include "fzn_dpath_int_reif.mzn";
7include "fzn_dpath_enum.mzn";
8include "fzn_dpath_enum_reif.mzn";
9
10/** @group globals.graph
11 Constrains the subgraph \a ns and \a es of a given directed graph to be a path from \a s to \a t.
12
13 \a N is the number of nodes in the given graph
14 \a E is the number of edges in the given graph
15 \a from is the leaving node 1..\a N for each edge
16 \a to is the entering node 1..\a N for each edge
17 \a s is the source node (which may be variable)
18 \a t is the dest node (which may be variable)
19 \a ns is a Boolean for each node whether it is in the subgraph
20 \a es is a Boolean for each edge whether it is in the subgraph
21*/
22predicate dpath(int: N, int: E, array[int] of int: from, array[int] of int: to,
23 var int: s, var int: t, array[int] of var bool: ns, array[int] of var bool: es) =
24 assert(index_set(from) = 1..E,"dpath: index set of from must be 1..\(E)") /\
25 assert(index_set(to) = 1..E,"dpath: index set of to must be 1..\(E)") /\
26 assert(index_set(ns) = 1..N,"dpath: index set of ns must be 1..\(N)") /\
27 assert(index_set(es) = 1..E,"dpath: index set of es must be 1..\(E)") /\
28 fzn_dpath(N,E,from,to,s,t,ns,es);
29
30/** @group globals.graph
31 Constrains the subgraph \a ns and \a es of a given directed graph to be a path from \a s to \a t.
32
33 \a from is the leaving node for each edge
34 \a to is the entering node for each edge
35 \a s is the source node (which may be variable)
36 \a t is the dest node (which may be variable)
37 \a ns is a Boolean for each node whether it is in the subgraph
38 \a es is a Boolean for each edge whether it is in the subgraph
39*/
40predicate dpath(array[int] of $$N: from, array[int] of $$N: to,
41 var $$N: s, var $$N: t, array[$$N] of var bool: ns, array[int] of var bool: es) =
42 assert(index_set(from) = index_set(to),"dpath: index set of from and to must be identical") /\
43 assert(index_set(from) = index_set(es),"dpath: index set of from and es must be identical") /\
44 assert(dom_array(from) subset index_set(ns),"dpath: nodes in from must be in index set of ns") /\
45 assert(dom_array(from) subset index_set(ns),"dpath: nodes in to must be in index set of ns") /\
46 fzn_dpath(from,to,s,t,ns,es);
47
48%-----------------------------------------------------------------------------%
49
50/** @group globals.graph
51 Constrains the subgraph \a ns and \a es of a given undirected graph to be a path from \a s to \a t.
52
53 \a N is the number of nodes in the given graph
54 \a E is the number of edges in the given graph
55 \a from is the leaving node 1..\a N for each edge
56 \a to is the entering node 1..\a N for each edge
57 \a s is the source node (which may be variable)
58 \a t is the dest node (which may be variable)
59 \a ns is a Boolean for each node whether it is in the subgraph
60 \a es is a Boolean for each edge whether it is in the subgraph
61*/
62predicate path(int: N, int: E, array[int] of int: from, array[int] of int: to,
63 var int: s, var int: t, array[int] of var bool: ns, array[int] of var bool: es) =
64 assert(index_set(from) = 1..E,"path: index set of from must be 1..\(E)") /\
65 assert(index_set(to) = 1..E,"path: index set of to must be 1..\(E)") /\
66 assert(index_set(ns) = 1..N,"path: index set of ns must be 1..\(N)") /\
67 assert(index_set(es) = 1..E,"path: index set of es must be 1..\(E)") /\
68 fzn_path(N,E,from,to,s,t,ns,es);
69
70/** @group globals.graph
71 Constrains the subgraph \a ns and \a es of a given undirected graph to be a path from \a s to \a t.
72
73 \a from is the leaving node for each edge
74 \a to is the entering node for each edge
75 \a s is the source node (which may be variable)
76 \a t is the dest node (which may be variable)
77 \a ns is a Boolean for each node whether it is in the subgraph
78 \a es is a Boolean for each edge whether it is in the subgraph
79*/
80predicate path(array[int] of $$N: from, array[int] of $$N: to,
81 var $$N: s, var $$N: t, array[$$N] of var bool: ns, array[int] of var bool: es) =
82 assert(index_set(from) = index_set(to),"path: index set of from and to must be identical") /\
83 assert(index_set(from) = index_set(es),"path: index set of from and es must be identical") /\
84 assert(dom_array(from) subset index_set(ns),"path: nodes in from must be in index set of ns") /\
85 assert(dom_array(from) subset index_set(ns),"path: nodes in to must be in index set of ns") /\
86 fzn_path(from,to,s,t,ns,es);