this repo has no description
1% cars.mzn 2include "globals.mzn"; 3 4int: n_cars; int: n_options; int: n_classes; 5 6set of int: steps = 1..n_cars; 7set of int: options = 1..n_options; 8set of int: classes = 1..n_classes; 9 10array [options] of int: max_per_block; 11array [options] of int: block_size; 12array [classes] of int: cars_in_class; 13array [classes, options] of 0..1: need; 14 15% The class of car being started at each step. 16array [steps] of var classes: class; 17 18% Which options are required by the car started at each step. 19array [steps, options] of var 0..1: used; 20 21% Block p must be used at step s if the class of the car to be 22% produced at step s needs it. 23constraint forall (s in steps, p in options) (used[s, p]=need[class[s], p]); 24 25% For each option p with block size b and maximum limit m, no consecutive 26% sequence of b cars contains more than m that require option p. 27constraint 28 forall (p in options, i in 1..(n_cars - (block_size[p] - 1))) ( 29 sum (j in 0..(block_size[p] - 1)) (used[i + j, p]) 30 <= max_per_block[p]); 31 32% Require that the right number of cars in each class are produced. 33constraint forall (c in classes) (count(class, c, cars_in_class[c])); 34 35solve satisfy; % Find any solution.