Originally posted by: SystemAdmin
hello,
i will present the code and explain you the problem
int nbemp=6;
int nbch=6;
int nbroul=9;
range I=1..nbemp;
range K=1..nbch;
range J=1..nbroul ;
tuple emp_data {
int num_emp;// Numéro employé
string n_entrep;//nom entrepreneur
string cat ;// catégorie d'employé={ homme, femme, jour, nuit, cadre, non cadre}
int DA; // date d'arrivée de l'employé
int DD; // date de départ de l'employé
}
emp_data emp[I]=...;
tuple roul_data{
int num_R; // numéro roulette(unité d'hébergement)
string cat; // catégorie roulette
int num_ch[K]; // numéro chambre
int DA[K]; // date d'affectation de la chambre
int DL[K]; // date de libération de la chambre
}
roul_data roul[J]=...;
in .dat we have
emp=[<1 , "Marie" , "H" ,15, 23>,
<2 , "Richard" , "H" ,15, 23>,
<3 , "Marie" , "F" ,15, 23>,
<4 , "Marie" , "F" ,15, 23>,
<5 , "Richard" , "F" ,15, 23>,
<6 , "Richard" , "F" ,15, 23>];
roul= [<1, "C",
1,2,3,4,5,6,
3,3,3,3,3,3,
12,12,12,12,12,12>,
<2, "NC",
1,2,3,4,5,6,
3,3,3,3,3,3,
12,12,12,12,12,12>,
<3, "J",
1,2,3,4,5,6,
3,3,3,3,3,3,
12,12,12,12,12,12>,
<4, "N",
1,2,3,4,5,6,
3,3,3,3,3,3,
12,12,12,12,12,12>,
<5, "F",
1,2,3,4,5,6,
5,5,3,3,3,3,
17,17,12,12,12,12>,
<6, "F",
1,2,3,4,5,6,
5,5,5,3,3,3,
17,17,17,12,12,12>,
<7, "H",
1,2,3,4,5,6,
5,5,5,5,5,5,
17,17,17,17,17,17>,
<8, "H",
1,2,3,4,5,6,
5,5,3,3,3,3,
17,17,12,12,12,12>,
<9, "H",
1,2,3,4,5,6,
3,3,3,3,3,3,
12,12,12,12,12,12]>;
when i compile, i usually found all x[i][j]==0 (false result)
because with this .dat we musn't have all x[i][j]==0
for example we must forbiden the assignment of employee 1 with categorie "H" to unit of accomodation 1,2,3,4,5 and 6
so X[1][1]=X[1][2]=X[1][3]=X[1][4]=X[1][5]=X[1][6]==0
but X[1][7],X[1][8]and X[1][9] mustn't ==0
i will more explain
in constraint1: we mustn't assign (affect) the employee with categorie "Homme"
(emp[i].cat) to the unit of accomodation with catégorie "Femme"(roul[j].cat)
and we can't write if (emp[i].cat == roul[j].cat) X[i][j]==1;
because we have others constraints to do the assignement(affectation).
taht's why i tried
1/ forall(i in I) forall(j in J)
if (emp[i].cat != roul[j].cat)
X[i][j]==0;
2/ forall(i in I,j in J :emp[i].cat != roul[j].cat ) X[i][j]==0;
but it's false
what can I do,so ?
tahnks alex for your patience and help
#DecisionOptimization#OPLusingCPLEXOptimizer