20.03.2013 Views

II. Notes on Data Structuring * - Cornell University

II. Notes on Data Structuring * - Cornell University

II. Notes on Data Structuring * - Cornell University

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

end;<br />

end gensupersets;<br />

NOTES ON DATA STRUCTURING 163<br />

untried: v save 2;<br />

trial: - (e)<br />

untried: = save 1<br />

The main program is as follows:<br />

for st: student do<br />

for e in load (st) do<br />

begin examcount (e): + 1; incompat (e): v (load (st) - (e)) end;<br />

while remaining -¢ ( ) do<br />

end;<br />

print timetable<br />

begin s" sessi<strong>on</strong>;<br />

s: = suitable;<br />

timetable: v {s);<br />

remaining: __ s<br />

Before spending any more efforl~ <strong>on</strong> developing this program, it would be<br />

advisable to subject it to a critical examinati<strong>on</strong>, to ensure that it will be<br />

successful. Now the most obvious reas<strong>on</strong>s why the program might fail are:<br />

(1) The size of the timetable turns out to be unacceptably large; we have<br />

agreed that nothing can be d<strong>on</strong>e about this, until we know more about the<br />

data.<br />

(2) The amount of time taken to generate all trials at each step is excessive.<br />

This will be particularly serious when the remainder is still large at the<br />

beginning of the program, and if the untried set remains large <strong>on</strong> every<br />

recursi<strong>on</strong> of gensupersets. The main way in which the untried set is reduced<br />

is by removing all exams incompatible with the trial. This suggests that we<br />

should always prefer to add first to the trial those exams which have the<br />

largest incompatible sets, so that untried is reduced as quickly as possible.<br />

Am<strong>on</strong>g sets equal according to this criteri<strong>on</strong>, the exam with the largest<br />

examcount would be selected first. The exact weighting between these criteria<br />

.<br />

may have to be adjusted later in the light of experience; meanwhile, the<br />

simplest implementati<strong>on</strong> of this policy is to presort the exams in accordance<br />

with the criteri<strong>on</strong>, and implement e from untried by selecting the first<br />

member.<br />

If it turns out that this elementary strategy is insufficient we may have to<br />

artificially curtail the number of iterati<strong>on</strong>s of the loop in gensupersets. But<br />

we would probably need some practical experience in order to select a suitable<br />

strategy; and for the time being, let us hope it will not be necessary.<br />

i

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!