% % Given a set of students produce teams % Each student is one team and one team only % A team must be of size lwb to upb inclusive % There are some pairs of students who must be in the same team together % There are some pairs of students who must not be in the same team together % % There are two parts to the exercise % % (a) Produce T teams, i.e. produce a satisfactory allocation of students to teams % (b) Minimize the number of teams produced % include "globals.mzn"; enum STUDENTS; int: T; % number of teams int: LWB; % minimum number of students in a team int: UPB; % maximum number of students in a team set of int: TEAM = 1..T; array[int,1..2] of STUDENTS: together; % pairs of students who must be together array[int,1..2] of STUDENTS: apart; % pairs of students who must be apart set of int: pairsApart = index_set_1of2(apart); % range of indices set of int: pairsTogether = index_set_1of2(together); % as above % NOTE: the number of students in team t can be zero or in the range LWB..UPB