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.
dekker-phd-thesis/assets/listing/inc_round_robin.mzn
2021-07-21 14:27:06 +10:00

13 lines
345 B
MiniZinc

predicate round_robin(array[int] of var bool: nbhs) =
let {
int: N = length(nbhs);
var -1..N-1: select; % Neighbourhood selection
} in if status()=START then
select = -1
else
select = (last_val(select) + 1) mod N
endif
/\ forall(i in 1..N) (
(select = i-1) -> nbhs[i] % <-- Post Neighbourhood@\Vlabel{line:6:roundrobin:post}@
);