Departmental ballancing constraint.
The new implementation of the balancing times for departments works as
follows: Initially, there is a histogram for each department computed. For
each time slot, it says how many placements of all classes (of the
department) include this time slot. Each such placement has the weight of 1 /
number of placements of the class, so the total sum of all values in the
histogram (i.e., for all time slots) is equal to the total sum of half-hours
required by the given set of classes.
On the other hand, each class splits its number of half-hours (e.g., 2x50 has
4 half-hours, "4 points") into the time slots which it can occupy, according
to the frequencies of the utilization of each time slots (i.e., number of
placements containing the time slots divided by the number of all placements
of the class).
For example, a histogram for department 1286:
1: [0.10,0.00,0.10,0.00,0.10] ← 7:30 [Mon, Tue, Wed, Thu, Fri]
2: [0.10,0.00,0.10,0.00,0.10] ← 8:00 [Mon, Tue, Wed, Thu, Fri]
3: [0.35,0.62,0.48,0.62,0.10] ... and so on
You can easily see, that the time slots which are prohibited for all of the
classes of the department have zero values, also some time slots are used
much often than the others. Note that there are no preferences involved in
this computation, only prohibited / not used times are less involved.
The idea is to setup the initial limits for each of the time slots according
to the above values. The reason for doing so is to take the requirements
(time patterns, required/prohibited times) of all classes of the department
into account. For instance, take two classes A and B of type MWF 2x100 with
two available locations starting from 7:30 and 8:30. Note that the time slot
Monday 8:30-9:00 will be always used by both of the classes and for instance
the time slot Monday 7:30-8:00 (or Friday 9:30-10:00) can be used by none of
them, only one of them or both of them. From the balancing point of the view,
I believe it should be preferred to have one class starting from 7:30 and the
other one from 8:30.
So, after the histogram is computed, its values are increased by the given
percentage (same reason as before, to allow some space between the actual
value and the limit, also not to make the limits for a department with 21
time slots less strict than a department with 20 time slots etc.). The
initial limits are than computed as these values rounded upwards (1.90
results in 2).
Moreover, the value is increased only when the histogram value of a time slot
is below the following value: spread factor * (number of used time slots /
number of all time slots). Is assures a department of at least the given
percentage more time slots than required, but does not provide an additional
reward for above average use of time slots based on 'required' times.
For example, the department 1286 will have the following limits (histogram
increased by 20% (i.e., each value is 20% higher) and rounded upwards):
The maximal penalty (i.e., the maximal number of half-hours which can be used
above the pre-computed limits by a department) of a constraint is used.
Initially, the maximal penalty is set to zero. It is increased by one after
each time when the constraint causes the given number (e.g., 100) of
Also, the balancing penalty (the total number of half-hours over the initial
limits) is computed and it can be minimized during the search (soft
|Initial allowance of the slots for a particular time (factor)
Allowed slots = ROUND(SpreadFactor * (number of requested slots / number of
slots per day))
|Increase the initial allowance when it causes the given number of