Hello guys,

I need your help.

My project is on booklet optimization for exams, it is a timetabling problem.

Here my sets, variables, equ. and obj. :

SETS

o sessions /1*4/

k booklets /1*31/

i courses / course1 * coursen/

s students/student1*studentm/;

VARIABLES

x(i,k) if course i assing to booklet k

z(i,o) if course i assing to session o

y(k,o) if booklet k assing to session o

q(k) if booklet k created

a obj;

BINARY VARIABLES

x(i,k)

z(i,o)

y(k,o)

q(k);

PARAMETER NCs(s) -it is a parameter that gives number of courses for every student

TABLE P(s,i) student- course matrix(0-1 matrix)

EQUATIONS

obj obj. function

cons2 a booklet has to include max. 6 courses

cons21 a booklet has to include min. 4 courses

cons3 a course must be assigned to only one session

cons4 a booklet must be assigned to only one session

cons5 all courses must be assigned and they can be assigned to more than one booklets as long as being one session

cons6 a student must be assigned max 5 lessons in one session

cons9 correlation cons. with y(ko) and q(k)

cons91 correlation cons. with y(ko) and q(k)

cons12 correlation cons. with x(ik) and q(k)

cons13 correlation cons. with x(ik) and q(k)

cons15 equality that counts the courses of students for every student and session ;

obj… a =e= sum(k,q(k));

cons2(k)… sum(i, x(i,k)) =l=6;

cons21(k)… sum(i, x(i,k)) =g=4;

cons3(i)… sum(o, z(i,o)) =e= 1;

cons4(k)… sum(o, y(k,o)) =e= 1;

cons5(i)… sum(k, x(i,k)) =g= 1;

cons6(s,o)…sum(i, P(s,i)*z(i,o))=l= 5;
cons15(s)…NCs(s) =e= sum ((i,o),P(s,i)* z(i,o)) ;

cons9(k)…sum(o, y(k,o)) =l= M* q(k);

cons91(k)…sum(o, y(k,o)) =g= q(k);

cons12(k)…sum((i), x(i,k)) =g= q(k) ;

cons13(k)…sum((i), x(i,k)) =l= M* q(k);

MODEL oturum /all/;

SOLVE oturum using mip minimizing a;

I choosed CPLEX as solver, i reached optimal solution for 31 booklets but my problem is the session of z(i,o) and y(k,o) is not the same.

For example, math is assigned to booklet 1, x11=1 (i1=math and k1=booklet1).

But booklet1’s session is 2, while math’s session is 3.

I want that when x11 is equal to 1 (i1=math and k1=booklet1), z1**1** is equal to y1**1** or z1**2** is equal to y1**2** or z1**3** is equal to y1**3** or z1**4** is equal to y1**4**.

I tried lot of things, but didn’t work, i will be really appriciated, if you help.

Thank you!

Emine.