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.
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.4 KiB
MiniZinc

%-----------------------------------------------------------------------------%
% This file tests the global constraints in globals.mzn that involve
% variables of type `var float'.
%-----------------------------------------------------------------------------%
include "globals.mzn";
% Variable naming scheme: all variables for a constraint get a common
% prefix based on the constraint name, eg. "alldiff".
%-----------------------------------------------------------------------------%
% increasing
%-----------------------------------------------------------------------------%
% test satisfaction
array[1..3] of var float: inc_avf :: is_output = [1.0, 2.0, _];
constraint increasing(inc_avf);
%-----------------------------------------------------------------------------%
% minimum, maximum
%-----------------------------------------------------------------------------%
var 0.0..20.0: min_vf1 :: is_output;
var 0.0..20.0: min_vf2 :: is_output;
var 0.0..20.0: max_vf1 :: is_output;
var 0.0..20.0: max_vf2 :: is_output;
% XXX: min/2 for floats not yet handled
constraint minimum(min_vf1, [5.5, 3.3, 8.8, 0.0, 4.4]);
constraint minimum(0.0, [5.5, 3.3, 8.8, min_vf2, 4.4]);
% XXX: max/2 for floats not yet handled
constraint maximum(max_vf1, [5.5, 3.3, 8.8, 9.9, 4.4]);
constraint maximum(9.9, [5.5, 3.3, 8.8, max_vf2, 4.4]);
%-----------------------------------------------------------------------------%
solve satisfy;