Estabilishing a college timetable
{ Exmpl14.3-1_SchoolTimetable.mpl }
{ Applications of Optimization with Xpress-MP }
{ Chapter 14.3, Establishing a College Timetable, Size: 357x360, Page 297 }
TITLE
SchoolTimetable;
DATA
Np := 4;
Nd := 5;
INDEX
teacher := (cheese,insulin,map,effofecks,derivate,electron,wise,muscle,biceps);
class := 1..2;
slot := 0..Np*Nd;
DATA
Course[teacher,class] := (1,1,
3,3,
2,2,
0,4,
4,0,
3,3,
1,1,
1,0,
0,1);
Dslot[slot] := slot * Np + 1;
Eslot[slot] := Np * slot + Np;
VARIABLE
Teach[teacher,class,slot>0];
MODEL
MIN Hole = SUM(teacher,class,slot=0..Nd-1: Teach[slot:=Dslot] + Teach[slot:=Eslot]);
SUBJECT TO
PlanAllCOurses[teacher,class] -> PAC:
SUM(slot: Teach) = Course;
EveryClassOneCourse[class,slot] -> ECOC:
SUM(teacher: Teach) <= 1;
TeachOneCourseAtaTime[teacher,slot] -> TOCT:
SUM(class: Teach) <= 1;
EverySubjectOnlyOnceaDay[teacher,class,slot=0..Nd-1] -> EVTO:
SUM(slot=Dslot..Eslot: Teach) <= 1;
SportThursdayAfternoon[slot=15] -> TSA:
Teach[teacher:=muscle,class:=1] + Teach[teacher:=biceps,class:=2] =2;
EmptyDuring1stperiodMonday[teacher,class] -> EFP:
Teach[slot:=1] = 0;
NoCourseEffofeckMonMorn[slot=1..2]:
Teach[teacher:=effofecks,class:=2] = 0;
NoBioOnWednesday[class,slot=2*Np+1..3*Np] -> NBW:
Teach[teacher:=insulin] = 0;
BINARY
Teach;
END
Back To Top
|
Maximal Home Page
|
List of Models |
Previous Page
|
Next Page