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_geost_smallest_bb_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

40 lines
1.3 KiB
MiniZinc

include "fzn_geost_bb.mzn";
include "fzn_geost_bb_reif.mzn";
predicate fzn_geost_smallest_bb_reif(
int : k ,
array[int,int] of int : rect_size ,
array[int,int] of int : rect_offset ,
array[int ] of set of int : shape ,
array[int,int] of var int : x ,
array[int ] of var int : kind ,
array[int ] of var int : l ,
array[int ] of var int : u ,
var bool: b
) =
% Two useful definitions
let {
set of int: DIMS = 1..k;
set of int: OBJECTS = index_set(kind);
} in b <-> (
% Posting the geost constraint
fzn_geost_bb(k, rect_size, rect_offset, shape, x, kind, l, u)
/\ % Posting the smallest bounding box constraints
forall(j in DIMS)(
% Lower boundary
exists(o in OBJECTS, s in dom(kind[o]))(
kind[o] = s
/\ exists(r in shape[s])(
x[o,j] + rect_offset[r,j] == l[j]
)
)
/\ % Upper boundary
exists(o in OBJECTS, s in dom(kind[o]))(
kind[o] = s
/\ exists(r in shape[s])(
x[o,j] + rect_offset[r,j] + rect_size[r,j] == u[j]
)
)
)
);