II. Notes on Data Structuring * - Cornell University
II. Notes on Data Structuring * - Cornell University
II. Notes on Data Structuring * - Cornell University
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
The c<strong>on</strong>diti<strong>on</strong> may be formalised:<br />
NOTES ON DATA STRUCTURING 157<br />
s in timetable ~ sessi<strong>on</strong>count (s) ~< hallsize.<br />
(6) No student takes more than <strong>on</strong>e exam in a sessi<strong>on</strong>. To formalise this<br />
we introduce the c<strong>on</strong>cept of incompatibility of exams: two exams are in-<br />
compatible if some student is taking both of them. For each exam el there is<br />
a set incompat (el) of exams which are incompatible with it:<br />
incompat (el) = {e2:exam I e2 -¢- el & 3 st:student (el in load (st)<br />
& e2 in load (st))}<br />
Now we can define that every pair of exams in a sessi<strong>on</strong> must be compatible:<br />
s in timetable & el, e2 in s D -l el in incompat (e2).<br />
These six c<strong>on</strong>diti<strong>on</strong>s, defined in terms of load, hallsize, and k, must be<br />
possessed by any successful timetable in the real world, and by any successful<br />
computer representati<strong>on</strong> of the timetable. They serve to define the objectives<br />
and criteri<strong>on</strong> of correctness of our timetabling program.<br />
11.1 THE ABSTRACT PROGRAM<br />
Inspecti<strong>on</strong> of the c<strong>on</strong>diti<strong>on</strong>s reveals that c<strong>on</strong>structi<strong>on</strong> of the timetable does<br />
not require full knowledge of the load of each student. All that is needed is<br />
the examcount of each exam, and for each exam the set of other exams<br />
which are incompatible with it:<br />
examcount: array exam of integer;<br />
incompat: array exam of powerset exam.<br />
These two arrays embody an abstracti<strong>on</strong> from the real life data, which<br />
c<strong>on</strong>centrate attenti<strong>on</strong> <strong>on</strong> exactly those features which are for the present<br />
purpose relevant, and permitting us to ignore for the time being the other<br />
features of the situati<strong>on</strong>. It is plain that these two arrays can be readily<br />
c<strong>on</strong>structed from a single scan of the student load data:<br />
examcount: = all (0);<br />
incompat:= all ( { } );<br />
for st: student do<br />
for e in load (st) do<br />
begin examcount (e)" + 1;<br />
end;<br />
incompat (e): v (load (st) - {e})<br />
One of the simplifying factors in the search for a soluti<strong>on</strong> to the given<br />
problem is that the c<strong>on</strong>diti<strong>on</strong>s fall readily into two classes: (1) (2) and (3)<br />
relate to the timetable as a whole, whereas (4) (5) and (6) relate <strong>on</strong>ly to