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/fzn_network_flow_reif.mzn
Jip J. Dekker f2a1c4e389 Squashed 'software/mza/' content from commit f970a59b17
git-subtree-dir: software/mza
git-subtree-split: f970a59b177c13ca3dd8aaef8cc6681d83b7e813
2021-07-11 16:34:30 +10:00

16 lines
564 B
MiniZinc

predicate fzn_network_flow_reif(array[int,1..2] of int: arc,
array[int] of int: balance,
array[int] of var int: flow,
var bool: b) =
let { int: source_node = 1;
int: sink_node = 2;
set of int: ARCS = index_set_1of2(arc);
set of int: NODES = index_set(balance);
} in
b <-> forall (i in NODES) (
sum (j in ARCS where i == arc[j,source_node]) (flow[j]) -
sum (j in ARCS where i == arc[j,sink_node]) (flow[j])
= balance[i]
);