include "globals.mzn"; %--------------- %%PARAMETRES %--------------- int: Nt = 13; set of int: T = 1..Nt; int: Ns = 20; %horizon array[1..Ns]of int: weeks = [i | i in 1..Ns]; array[1..Ns] of int: lbound = [0 | i in 1..Ns]; array[1..Ns] of int: ubound = [2 | i in 1..Ns]; %--------------- %%VARIABLES %--------------- array[1..Nt, 1..Nt] of var 0..Ns: x; %--------------- %%FONCTION OBJECTIF %--------------- var int: w_max; constraint w_max = max(i in 1..Nt, j in 1..Nt where i < j)(x[i,j]); %--------------- %%CONTRAINTES %--------------- % on joue pas contre soi-même constraint forall(i in 1..Nt)(x[i, i] = 0); % on doit rencontrer toutes les équipes constraint forall(i in T, j in T where i != j)(x[i,j] >= 1); %2 matchs max par equipe par semaine constraint forall(i in T)(global_cardinality_low_up([x[i,j] | j in 1..Nt], weeks, lbound, ubound)); % x doit être symétrique constraint forall(i, j in T)(x[i,j] = x[j,i]); % équipe 1 rencontre les autres équipes dans l'ordre constraint forall(j in 2..Nt)(x[1,j-1] <= x[1,j]); solve minimize w_max;