Wednesday, June 11, 2008
Inticas 032: Fixed Room-Not-Full Bug
Fixed the Room-Not-Full Bug.
All Rooms are fully slotted before going to next room.
However, the algorithm created a new bug - notice the circled
red above where CSC100 is allocated twice in a day - but
in different rooms. LR100 Wednesday is a 2-hour slot
(8 am -10 am) whiltst LR200 is a single slot (12 noon - 1pm).
This violates the constraint that a subject should not have
more than 2 slots in a single day. Another serious bug
is the possiblility that the 2-hour slot may be slotted at the
same times as its corresponding 1-hour slot but in different
rooms. Note the Purple circled slots for CSC250.
I call this the "Multi-slot Overlap Bug".
To Do:
Fix the Multi-Slot Overlap Bug.
One possible way to solve it might be to modify the
Subject Class
to include attributes that store Days data, using a simple
array:
private int day[] = new int[7];
If a subject has already been allocated to
a Wednesday at 2pm, we do this:
day[3] = 14;
public boolean isDayDone(int day){
//Day checking code here
}
Before a Room Object allocates, it could perform a check
as follows:
if(!room[3].isDayDone(3)){
//Allocation code here
}
Till then...