Debian Codegraph @

tests/spec/unit/regression/github_997.mzn

raw
1 /***
2 !Test
3 solvers: [gecode]
4 expected: !Result
5 solution: !Solution
6 ***/
7
8 % GitHub #997
9 % Reified maximum_arg could not be used in reified context if a solver had only the non-reified as a builtin.
10
11 include "alldifferent.mzn";
12 include "arg_max.mzn";
13
14 array[1..10] of 0..1 : test_bool = [ 0, 0, 1, 0, 0, 0, 1, 1, 1, 1];
15 array[1..10] of var 0..1 : test_bool_2;
16
17 array[1..10] of var 1..20 : test_int;
18 array[1..10] of var 0..20 : test_int_2;
19
20 constraint (sum(i in 1..10) (test_bool_2[i])) = 6;
21
22 constraint alldifferent([ test_int[i] | i in 1..10 where test_bool[i] == 1]);
23
24 constraint forall(i in 1..10) (
25 (test_bool_2[i] == 1) -> maximum_arg([test_int[j] | j in 1..i], test_int_2[i])
26 );