this repo has no description
1/***
2!Test
3solvers: [gecode, cbc]
4expected:
5- !Result
6 solution: !Solution
7 inc_avf: [1.0, 2.0, 2.0]
8 min_vf1: !Approx 0.0
9 min_vf2: !Approx 0.0
10 max_vf1: !Approx 9.9
11 max_vf2: !Approx 0.0
12- !Result
13 solution: !Solution
14 inc_avf: [1.0, 2.0, 2.0]
15 min_vf1: !Approx 0.0
16 min_vf2: !Approx 0.0
17 max_vf1: !Approx 9.9
18 max_vf2: !Approx 9.9
19***/
20
21%-----------------------------------------------------------------------------%
22% This file tests the global constraints in globals.mzn that involve
23% variables of type `var float'.
24%-----------------------------------------------------------------------------%
25
26include "globals.mzn";
27
28% Variable naming scheme: all variables for a constraint get a common
29% prefix based on the constraint name, eg. "alldiff".
30
31%-----------------------------------------------------------------------------%
32% increasing
33%-----------------------------------------------------------------------------%
34
35 % test satisfaction
36array[1..3] of var float: inc_avf :: add_to_output = [1.0, 2.0, _];
37
38constraint increasing(inc_avf);
39
40%-----------------------------------------------------------------------------%
41% minimum, maximum
42%-----------------------------------------------------------------------------%
43
44var 0.0..20.0: min_vf1 :: add_to_output;
45var 0.0..20.0: min_vf2 :: add_to_output;
46
47var 0.0..20.0: max_vf1 :: add_to_output;
48var 0.0..20.0: max_vf2 :: add_to_output;
49
50% XXX: min/2 for floats not yet handled
51constraint minimum(min_vf1, [5.5, 3.3, 8.8, 0.0, 4.4]);
52constraint minimum(0.0, [5.5, 3.3, 8.8, min_vf2, 4.4]);
53
54% XXX: max/2 for floats not yet handled
55constraint maximum(max_vf1, [5.5, 3.3, 8.8, 9.9, 4.4]);
56constraint maximum(9.9, [5.5, 3.3, 8.8, max_vf2, 4.4]);
57
58%-----------------------------------------------------------------------------%
59solve satisfy;