module foo; (*History: jhansell 29 May 91 1PM I think we finished Generate Schedule. We have quite a few undefined functions though. jhansell 28 May 91 3PM added Compact Schedule for Generate Schedule. There are functions called which do not yet exist, and they may not need to exist because the user should not have to deal with them. We should worry about other stuff before dealing with GetHourSpread and CountTeachingDays. jhansell 28 May 91 2PM remove syntax errors nshaw 27 May 91 9AM added operation ChooseBestSchedule with algebraic pre and post and object BestSchedules and a few operations that are required for pre- and post. syntax ok. nshaw 25 May 91 8AM added operation ChooseBestSchedule with algebraic pre- and postconditions. syntax errors: removed additions until checker was fixed by Fisher. nshaw 23 May 91 11AM added operation ChooseBestSchedule with prose pre/post only. gmillett 21 May 91 11PM added hour spread and number of days pre/post conditions to GenerateSchedule. nshaw, 14 May 91 10AM removing inconsistancies jhansell gmillett 13 May 91 11PM new version jhansell 13 May 91 8PM remove syntax errors and unneeded code nshaw 13 May 91 4PM revision of ops nshaw 13 May 91 added new version of ops gmillett 12 May 91 started converting instances to strictly objects gmillett 11 May 91 initial revision *) object squat components: hi, hey, ListofAnnualDatabases; end squat; object hi; object hey; object squat2 extends squat where: hi=AnnualDatabase; end squat2; object squat3 extends squat2 where: hey=AnnualDatabase; end squat3; object ListofAnnualDatabases components: AnnualDatabase*; operations: ViewListofAnnualDatabases (ListofAnnualDatabases,UserSelectInput)->(ListofAnnualDatabases), CreateAnnualDatabase(dude)->(dude), CreatebyCopyAnnualDatabase, OpenAnnualDatabase, SaveAnnualDatabase, DeleteAnnualDatabase; description: (* This contains a list of all of the annual databases.*); end ListofAnnualDatabases; object AnnualDatabase components: Rooms:RoomTable, Times:TimeTable, QuarterDatabases:QuarterDatabases, Instructors:InstructorTable, Courses:CourseTable; operations: AnnualDatabaseOp, QuarterDatabaseOp, ScheduleDatabaseOp; description: (* Only one per year. Fixed information used for schedule generation. Quarter Databases contain information specific for that quarter. *); end AnnualDatabase; object QuarterDatabase components: AvailableRoom:AvailableRoomTable, ScheduleDatabases:ScheduleDatabaseTable, InstructorPreferences:InstructorPreferencesTable; operations: QuarterDatabaseOp; description: (* Only one per quarter. Four per Annual Database. Fixed information used for schedule generation. Schedule Databases contain information specific for that generated schedule.*) ; end QuarterDatabase; object ScheduleDatabase components: Sections:SectionTable, LockRoomSections:LockRoomSectionTable, LockTimeSections:LockTimeSectionTable, LockInstructorSections:LockInstructorSectionTable, WeightedPriorities:WeightedPriorities; operations: ScheduleDatabaseOp; description: (* One per schedule generated. Contains information about the particular schedule being generated. Is updated by the GenerateSchedule operation. GenerateSchedule uses information from Annual Database, Quarter Database, and Schedule Database. *); end ScheduleDatabase; object RoomRow components: Building:string, RoomNumber:string, Capacity:string, SpecialEquipment:string; operations: RoomOp, BuildRoomRow; description: (* Specifies a classroom or laboratory in a building on campus. The special equipment includes, but is not limited to, terminals, p.c.'s, workstations. *); end RoomRow; object RoomTable components: RoomRow*; operations: QueryRoomTable, RoomOp; description: (* List of Rooms. *); end RoomTable; object TimeRow components: Days:string, Hours:string; operations: TimeOp, BuildTimeRow; description: (* Specifies a class meeting time by week. For example: "MWF 11:00-12:00", or "TR 9:30-11:00". *); end TimeRow; object TimeTable components: TimeRow*; operations: QueryTimeTable, TimeOp; description: (* List of Times. *); end TimeTable; object QuarterDatabases components: Fall:QuarterDatabase, Winter:QuarterDatabase, Spring:QuarterDatabase, Summer:QuarterDatabase; operations: ViewListofQuarters; description: (* Specifies each quarter and a database that corresponds with that quarter. *); end QuarterDatabases; object InstructorRow components: Name:string, TargetUnits:string, ReleaseUnits:string; operations: InstructorOp, BuildInstructorRow; description: (* Specifies an instructor along with his or her priority, target units, and release units. *); end InstructorRow; object InstructorTable components: InstructorRow*; operations: QueryInstructorTable, InstructorOp; description: (* List of Instructors. *); end InstructorTable; object CourseRow components: Number:string, Title:string, Description:string, Units:string, LectureHours:string, LabHours:string, Fee:string, MinimumEnrollment:string, Maximumenrollment:string; operations: CourseOp, BuildCourseRow; description: (* Specifies a course and gives a description of it. *); end CourseRow; object CourseTable components: CourseRow*; operations: QueryCourseTable, CourseOp; description: (* List of Courses. *); end CourseTable; object AvailableRoomRow components: AvailableId:string, BuildingRoomNumber:string, DaysHours:string; operations: AvailableRoomOp, BuildAvailableRoomRow; description: (* Associates a room with a time for which the room is available for use. *); end AvailableRoomRow; object AvailableRoomTable components: AvailableRoomRow*; operations: QueryAvailableRoomTable, AvailableRoomOp; description: (* List of Available Rooms. *); end AvailableRoomTable; object ScheduleDatabaseRow components: Name:string, ScheduleDatabase:ScheduleDatabase; description: (* Specifies a schedule name and a schedule database that corresponds with that schedule. *); end ScheduleDatabaseRow; object ScheduleDatabaseTable components: ScheduleDatabaseTable*; operations: ViewListofSchedules; description: (* List of ScheduleDatabases. *); end ScheduleDatabaseTable; object TimePriority components: DaysHours:string, Priority:string; description: (* Combines a time with a priority for preferences. *); end TimePriority; object TimePriorityList components: TimePriority*; description: (* List of TimePriority. *); end TimePriorityList; object CoursePriority components: Course:string, Priority:string; description: (* Combines a course with a priority for preferences. *); end CoursePriority; object CoursePriorityList components: CoursePriority*; description: (* List of CoursePriority. *); end CoursePriorityList; object InstructorPreferencesRow components: Name:string, Priority:integer, PrefHourSpread:integer, PrefNumberDays:integer, PrefNumberPreps:integer, PrefMaxPreps:integer, TimePriorityList, CoursePriorityList, TargetUnits:integer; description: (* Associates an instructor with a number of preferred hour spread for a given day. Associates an instructor with a classroom meeting time and specifies a priority for scheduling that instructor at that meeting time. A high priority would mean that the instructor wants a class at that time, and a low priority would mean that the instructor does not want a class at that time. Associates an instructor with a number of target units for that quarter. Associates an instructor with a course and specifies a priority for scheduling that instructor to teach that course. A high priority would mean that the instructor wants to teach that course, and a low priority would mean that the instructor does not want to teach that course. *); end InstructorPreferencesRow; object InstructorPreferencesTable components: InstructorPreferencesRow*; description: (* List of InstructorPreferences. *); end InstructorPreferencesTable; object SectionRow components: Number:string, Description:string, AvailableId:string, InstructorName:string, CourseNumber:string; operations: SectionOp, BuildSectionRow; description: (* Associates an available room and classroom meeting time with an instructor and a course to create a section. *); end SectionRow; object SectionTable components: SectionRow*; operations: QuerySectionTable, SectionOp; description: (* List of Sections. *); end SectionTable; (* Each of the three Locks specifies a relation between a section and one of a room, time, or instructor. *) object LockRoomSectionRow components: BuildingRoom:string, SectionNumber:string; operations: LockRoomtoSection, BuildLockRoomSectionRow; description: (* Links a room to a section and guarantees that the room will be tied to the section during schedule generation. *); end LockRoomSectionRow; object LockRoomSectionTable components: LockRoomSectionRow*; operations: QueryLockRoomSectionTable, LockRoomtoSection; description: (* List of LockRoomSections. *); end LockRoomSectionTable; object LockTimeSectionRow components: DaysHours:string, SectionNumber:string; operations: LockTimetoSection, BuildLockTimeSectionRow; description: (* Links a class meeting time to a section and guarantees that the class meeting time will be tied to the section during schedule generation. *); end LockTimeSectionRow; object LockTimeSectionTable components: LockTimeSectionRow*; operations: QueryLockTimeSectionTable, LockTimetoSection; description: (* List of LockTimeSections. *); end LockTimeSectionTable; object LockInstructorSectionRow components: InstructorName:string, SectionNumber:string; operations: LockInstructortoSection, BuildLockInstructorSectionRow; description: (* Links an instructor to a section and guarantees that the instructor will be tied to the section during schedule generation. *); end LockInstructorSectionRow; object LockInstructorSectionTable components: LockInstructorSectionRow*; operations: QueryLockInstructorSectionTable, LockInstructortoSection; description: (* List of LockInstructorSections. *); end LockInstructorSectionTable; object WeightedPriorities components: CompactSchedule:string, CoursePreference:string, NumberOfPreps:string, TimeOfDay:string; operations: ModifyWeightedPriorities, QueryWeightedPriorities; description: (* A group of parameters that the schedule generator will use to determine how to schedule classes. *); end WeightedPriorities; object UserWeightInput components: NewPriority:string; operations: ModifyWeightedPriorities; description: (* A new priority to be given to a weighted priority *); end UserWeightInput; object ScheduleReport components: Printout:string; operations: GenerateScheduleReport; description: (* A text version of a generated schedule is available. *); end ScheduleReport; object BestSchedules components: ScheduleDatabaseRow*; operations: ChooseBestSchedule; description: (*List of ScheduleDatabases returned by ChooseBestSchedule*); end BestSchedules; object UserStringInput components: string*; operations: BuildRoomRow, BuildInstructorRow, BuildCourseRow, BuildInstructorPreferencesRow, BuildAvailableRoomRow, BuildSectionRow, BuildLockRoomSectionRow, BuildLockInstructorSectionRow, BuildLockTimeSectionRow; description: (* Input of information for new table entry. *); end UserStringInput; object UserSelectInput components: selection:string; operations: Schedule, AnnualDatabaseOp, CreateAnnualDatabase, CreatebyCopyAnnualDatabase,OpenAnnualDatabase, DeleteAnnualDatabase,QuarterDatabaseOp, OpenQuarterDatabase,ResetQuarterDatabase, ReplaceQuarterDatabase, ScheduleDatabaseOp, DeleteScheduleDatabase, OpenScheduleDatabase, CreateScheduleDatabase, GenerateSchedule, ViewListofAnnualDatabases, DesignateSchedule, ViewListofSchedules; description: (*User makes a selection from a menu.*); end UserSelectInput; object UserLockInput components: LockRoomSectionRow|LockInstructorSectionRow| LockTimeSectionRow; operations: ScheduleDatabaseOp, LockOp; description: (*User inputs information to create a lock.*); end UserLockInput; object QueryResponse components: RoomTable|InstructorTable|CourseOp| InstructorPreferencesTable|AvailableRoomTable| SectionTable| WeightedPriorities|LockRoomSectionTable| LockInstructorSectionTable|LockTimeSectionTable; operations : Schedule, AnnualDatabaseOp, QuarterDatabaseOp, ScheduleDatabaseOp, LockOp; description: (*Table generated in response to a simple query.*); end QueryResponse; (* 5. Operation Specification 5.1 Operation Summary .Schedule .AnnualDatabaseOp .CreateAnnualDatabase .CreatebyCopyAnnualDatabase .OpenAnnualDatabase .DeleteAnnualDatabase .RoomOp .BuildRoomRow .AddRoomRow .DeleteRoomRow .ModifyRoomRow .QueryRoomTable .TimeOp .BuildTimeRow .AddTimeRow .DeleteTimeRow .ModifyTimeRow .QueryTimeTable .InstructorOp .BuildInstructorRow .AddInstructorRow .DeleteInstructorRow .ModifyInstructorRow .QueryInstructorTable .CourseOp .BuildCourseRow .AddCourseRow .DeleteCourseRow .ModifyCourseRow .QueryCourseTable .ViewListofQuarters .QuarterDatabaseOp .OpenQuarterDatabase .ResetQuarterDatabase .ReplaceQuarterDatabase .AvailableRoomOp .BuildAvailableRoomRow .AddAvailableRoomRow .DeleteAvailableRoomRow .ModifyAvailableRoomRow .QueryAvailableRoomTable .InstructorPreferencesOp .BuildInstructorPreferencesRow .AddInstructorPreferencesRow .DeleteInstructorPreferencesRow .ModifyInstructorPreferencesRow .QueryInstructorPreferencesTable .DesignateSchedule .ViewListofSchedules .ChooseBestSchedule .ScheduleDatabaseOp .CreateScheduleDatabase .DeleteScheduleDatabase .OpenScheduleDatabase .SectionOp .BuildSectionRow .AddSectionRow .DeleteSectionRow .ModifySectionRow .QuerySectionTable .WeightedPrioritiesOp .ModifyWeightedPriorities .QueryWeightedPriorities .LockOp .LockRoomtoSection .BuildLockRoomSectionRow .AddLockRoomSectionRow .DeleteLockRoomSectionRow .QueryLockRoomSectionTable .LockInstructortoSection .BuildLockInstructorSectionRow .AddLockInstructorSectionRow .DeleteLockInstructorSectionRow .QueryLockInstructorSectionTable .LockTimetoSection .BuildLockTimeSectionRow .AddLockTimeSectionRow .DeleteLockTimeSectionRow .QueryLockTimeSectionTable .GenerateScheduleReport .GetDaySpreadLevel .GetHourSpreadLevel .GetCoursePreferenceLevel .GetNumberofPrepsLevel .GetTimeofDayLevel .GenerateSchedule .ChooseBestSchedule .ViewListofAnnualDatabases 5.2 Schedule *) operation Schedule components: AnnualDatabaseOp|QuarterDatabaseOp|ScheduleDatabaseOp| |GenerateSchedule; inputs: UserSelectInput, UserWeightInput, UserLockInput, AnnualDatabase, QuarterDatabase, ScheduleDatabase, ListofAnnualDatabases; outputs: QueryResponse, AnnualDatabase, QuarterDatabase, ScheduleDatabase, ListofAnnualDatabases; description: (*Each time the user selects a new year, an AnnualDatabase with four empty QuarterDatabases for Fall, Winter, Spring and Summer and empty ScheduleDatabases for each quarter are linked and provided. Their existence is recorded in the ListofAnnualDatabases. The AnnualDatabase may be a copy from the previous year if this is available or it may be empty. The user may then update the AnnualDatabase and may enter information into the QuarterDatabases by replacing the contents with that of another QuarterDatabase on file, typically from the same quarter of the previous year, or by adding directly. Information may be added to the ScheduleDatabase and additional empty ScheduleDatabases may be created for the same quarter. When a schedule is generated, information from the AnnualDatabase, the QuarterDatabase, and the ScheduleDatabase that is current is used to update the SectionTable of the ScheduleDatabase. A report from this ScheduleDatabase is then a schedule. By creating different ScheduleDatabases and rerunning the scheduler, different versions of a schedule may be generated from the same AnnualDatabase and QuarterDatabase information. *); end Schedule; (* 5.3 Maintain AnnualDatabase *) operation AnnualDatabaseOp components: CreateAnnualDatabase|CreatebyCopyAnnualDatabase| OpenAnnualDatabase|DeleteAnnualDatabase| SaveAnnualDatabase| RoomOp|TimeOp|InstructorOp|CourseOp; inputs: UserSelectInput, AnnualDatabase, ListofAnnualDatabases; outputs: AnnualDatabase, ListofAnnualDatabases,QueryResponse; description: (*The annual database contains information which is not expected to depend upon which quarter schedule is under consideration by the user. A new copy needed for each year, however.*); end AnnualDatabaseOp; operation CreateAnnualDatabase inputs: AnnualDatabase, UserSelectInput, ListofAnnualDatabases; outputs: AnnualDatabase, ListofAnnualDatabases; description: (*User creates an AnnualDatabase. It will be empty. Also created and linked to the AnnualDatabase are four QuarterDatabases and four ScheduleDatabases. The information is added to the ListofAnnualDatabases.*); end CreateAnnualDatabase; operation CreatebyCopyAnnualDatabase inputs: AnnualDatabase, UserSelectInput, ListofAnnualDatabases; outputs: AnnualDatabase, ListofAnnualDatabases; description: (*User creates an AnnualDatabase by making a copy of another AnnualDatabase, typically that of the previous year if it exists and can provide a starting point for the current year's information. Also created and linked to the AnnualDatabase are four QuarterDatabases and four ScheduleDatabases. The information is added to the ListofAnnualDatabases.*); end CreatebyCopyAnnualDatabase; operation OpenAnnualDatabase inputs: AnnualDatabase, UserSelectInput, ListofAnnualDatabases; outputs: ListofAnnualDatabases, AnnualDatabase; description: (*User opens an AnnualDatabase by selecting a year on which to work from the ListofAnnualDatabases. The user may then perform operations on it or proceed to select a particular quarter associated with this AnnualDatabase.*); end OpenAnnualDatabase; operation SaveAnnualDatabase inputs: AnnualDatabase, UserSelectInput, ListofAnnualDatabases; outputs: ListofAnnualDatabases, AnnualDatabase; description: (*Saves an AnnualDatabase*); end SaveAnnualDatabase; operation DeleteAnnualDatabase inputs: AnnualDatabase, UserSelectInput, ListofAnnualDatabases; outputs: ListofAnnualDatabases; description: (*User deletes an AnnualDatabase. Also deleted are the QuarterDatabases and ScheduleDatabases linked with it. The information is also deleted from the ListofAnnualDatabases.*); end DeleteAnnualDatabase; operation AnnualDBOpClass inputs: AnnualDatabase; outputs: AnnualDatabase; description: (*Generic operations class for the AnnualDatabase*); end AnnualDBOpClass; operation RoomOpClass (* extends AnnualDBOpClass *) inputs: RoomRow; end RoomOpClass; operation RoomOp components: AddRoomRow|DeleteRoomRow|ModifyRoomRow; inputs: RoomRow, AnnualDatabase; outputs: AnnualDatabase, RoomTable; end RoomOp; operation BuildRoomRow inputs: UserStringInput; outputs: RoomRow; description: (*User inputs information to fill a row in RoomTable*); end BuildRoomRow; operation AddRoomRow (* extends RoomOpClass *) description: (*A room is added to the list of rooms that may be available during a particular quarter.*); end AddRoomRow; operation DeleteRoomRow (* extends RoomOpClass *) description: (*A room is removed from the list of rooms that may be available during a particular quarter.*); end DeleteRoomRow; operation ModifyRoomRow (* extends RoomOpClass *) description: (*A RoomRow of RoomTable is updated.*); end ModifyRoomRow; operation QueryRoomTable inputs: RoomRow, AnnualDatabase; outputs: RoomTable; description: (*A query facility is used to look at data in RoomTable.*); end QueryRoomTable; operation TimeOpClass -- extends AnnualDBOpClass inputs: TimeRow; end TimeOpClass; operation TimeOp components: AddTimeRow|DeleteTimeRow|ModifyTimeRow; inputs: TimeRow, AnnualDatabase; outputs: AnnualDatabase, TimeTable; end TimeOp; operation BuildTimeRow inputs: UserStringInput; outputs: TimeRow; description: (*User inputs information to fill a row in TimeTable*); end BuildTimeRow; operation AddTimeRow -- extends TimeOpClass description: (*A time is added to the list of times that may be available during a particular quarter.*); end AddTimeRow; operation DeleteTimeRow -- extends TimeOpClass description: (*A time is removed from the list of times that may be available during a particular quarter.*); end DeleteTimeRow; operation ModifyTimeRow -- extends TimeOpClass description: (*A TimeRow of TimeTable is updated.*); end ModifyTimeRow; operation QueryTimeTable inputs: TimeRow, AnnualDatabase; outputs: TimeTable; description: (*A query facility is used to look at data in TimeTable.*); end QueryTimeTable; operation InstructorOpClass -- extends AnnualDBOpClass inputs: InstructorRow; end InstructorOpClass; operation InstructorOp components: AddInstructorRow|DeleteInstructorRow| ModifyInstructorRow; inputs: InstructorRow, AnnualDatabase; outputs: AnnualDatabase, InstructorTable; end InstructorOp; operation BuildInstructorRow inputs: UserStringInput; outputs: InstructorRow; description: (*User inputs information to fill a row in InstructorTable*); end BuildInstructorRow; operation AddInstructorRow -- extends InstructorOpClass description: (*A Instructor is added to the list of those that may be available during a particular quarter.*); end AddInstructorRow; operation DeleteInstructorRow -- extends InstructorOpClass description: (*A Instructor's record is removed from InstructorTable.*); end DeleteInstructorRow; operation ModifyInstructorRow -- extends InstructorOpClass description: (*An InstructorRow of InstructorTable is updated.*); end ModifyInstructorRow; operation QueryInstructorTable inputs: InstructorRow, AnnualDatabase; outputs: InstructorTable; description: (*A query facility is used to look at data in InstructorTable.*); end QueryInstructorTable; operation CourseOpClass -- extends AnnualDBOpClass inputs: CourseRow; end CourseOpClass; operation CourseOp components: AddCourseRow|DeleteCourseRow| ModifyCourseRow; inputs: CourseRow, AnnualDatabase; outputs: AnnualDatabase, CourseTable; end CourseOp; operation BuildCourseRow inputs: UserStringInput; outputs: CourseRow; description: (*User inputs information to fill a row in CourseTable*); end BuildCourseRow; operation AddCourseRow -- extends CourseOpClass description: (*A Course is added to the list of those that may be available during a particular quarter.*); end AddCourseRow; operation DeleteCourseRow -- extends CourseOpClass description: (*A Course's record is removed from CourseTable.*); end DeleteCourseRow; operation ModifyCourseRow -- extends CourseOpClass description: (*A CourseRow of CourseTable is updated.*); end ModifyCourseRow; operation QueryCourseTable inputs: CourseRow, AnnualDatabase; outputs: CourseTable; description: (*A query facility is used to look at data in CourseTable.*); end QueryCourseTable; operation ViewListofQuarters inputs: UserSelectInput, AnnualDatabase; outputs: QuarterDatabases; description: (*User views the list of quarters associated with the current year.*); end ViewListofQuarters; (* 5.4 Maintain QuarterDatabase *) operation QuarterDatabaseOp components: OpenQuarterDatabase|ResetQuarterDatabase| ReplaceQuarterDatabase|SaveQuarterDatabase| AvailableRoomOp| DesignateSchedule|ViewListofSchedules, InstructorPreferencesOp; inputs: UserSelectInput, AnnualDatabase, QuarterDatabase; outputs: QueryResponse, QuarterDatabase; description: (*The quarter database contains information which is expected to depend upon which quarter schedule is under consideration by the user.*); end QuarterDatabaseOp; operation OpenQuarterDatabase inputs: AnnualDatabase, UserSelectInput; outputs: QuarterDatabase; description: (*User opens an QuarterDatabase by selecting a Quarter on which to work after an AnnualDatabase has been created or opened. The user may then choose to perform operations on it or proceed to select a particular ScheduleDatabase associated with this QuarterDatabase.*); end OpenQuarterDatabase; operation ResetQuarterDatabase inputs: UserSelectInput,QuarterDatabase,AnnualDatabase; outputs: QuarterDatabase; description: (*Clears all information from QuarterDatabase. This option might be used if the data has been corrupted, for example.*); end ResetQuarterDatabase; operation ReplaceQuarterDatabase inputs: UserSelectInput,AnnualDatabase, QuarterDatabase; outputs: QuarterDatabase; description: (*Copys all data from another QuarterDatabase into current one. This should be the usual first step in the start of work on the quarter*); end ReplaceQuarterDatabase; operation SaveQuarterDatabase inputs: QuarterDatabase, AnnualDatabase; outputs: QuarterDatabase, AnnualDatabase; description: (*Saves quarter database. *); end SaveQuarterDatabase; operation QuarterDBOpClass inputs: AnnualDatabase, QuarterDatabase; outputs: QuarterDatabase; description: (*Generic operations class for the QuarterDatabase*); end QuarterDBOpClass; operation AvailableRoomOpClass -- extends QuarterDBOpClass inputs: AvailableRoomRow; end AvailableRoomOpClass; operation AvailableRoomOp components: AddAvailableRoomRow| DeleteAvailableRoomRow| ModifyAvailableRoomRow; inputs: AvailableRoomRow, QuarterDatabase; outputs: QuarterDatabase, AvailableRoomTable; end AvailableRoomOp; operation BuildAvailableRoomRow inputs: UserStringInput; outputs: AvailableRoomRow; description: (*User inputs information to fill a row in AvailableRoomTable*); end BuildAvailableRoomRow; operation AddAvailableRoomRow -- extends AvailableRoomOpClass description: (*An available room is added for for a particular quarter.*); end AddAvailableRoomRow; operation DeleteAvailableRoomRow -- extends AvailableRoomOpClass description: (*An AvailableRoom record is removed from AvailableRoomTable.*); end DeleteAvailableRoomRow; operation ModifyAvailableRoomRow -- extends AvailableRoomOpClass description: (*An AvailableRoomRow of AvailableRoomTable is updated.*); end ModifyAvailableRoomRow; operation QueryAvailableRoomTable inputs: AvailableRoomRow, QuarterDatabase; outputs: AvailableRoomTable; description: (*A query facility is used to look at data in AvailableRoomTable.*); end QueryAvailableRoomTable; operation InstructorPreferencesOpClass -- extends QuarterDBOpClass inputs: InstructorPreferencesRow; end InstructorPreferencesOpClass; operation InstructorPreferencesOp components: AddInstructorPreferencesRow| DeleteInstructorPreferencesRow| ModifyInstructorPreferencesRow; inputs: InstructorPreferencesRow, QuarterDatabase; outputs: QuarterDatabase, InstructorPreferencesTable; end InstructorPreferencesOp; operation BuildInstructorPreferencesRow inputs: UserStringInput; outputs: InstructorPreferencesRow; description: (*User inputs information to fill a row in InstructorPreferencesTable*); end BuildInstructorPreferencesRow; operation AddInstructorPreferencesRow -- extends InstructorPreferencesOpClass description: (*Target unit information is added for an Instructor.*); end AddInstructorPreferencesRow; operation DeleteInstructorPreferencesRow -- extends InstructorPreferencesOpClass description: (*An InstructorPreferences record is removed from InstructorPreferencesTable.*); end DeleteInstructorPreferencesRow; operation ModifyInstructorPreferencesRow -- extends InstructorPreferencesOpClass description: (*An InstructorPreferencesRow of InstructorPreferencesTable is updated.*); end ModifyInstructorPreferencesRow; operation QueryInstructorPreferencesTable inputs: InstructorPreferencesRow, QuarterDatabase; outputs: InstructorPreferencesTable; description: (*A query facility is used to look at data in InstructorPreferencesTable.*); end QueryInstructorPreferencesTable; operation DesignateSchedule inputs: UserSelectInput, QuarterDatabase; outputs: QuarterDatabase; description: (*User selects ScheduleDatabase to be final version for the quarter and year.*); end DesignateSchedule; operation ViewListofSchedules inputs: UserSelectInput, QuarterDatabase; outputs: ScheduleDatabaseTable; description: (*User views the list of schedules associated with the current quarter and year.*); end ViewListofSchedules; operation ChooseBestSchedule inputs: adb:AnnualDatabase, qdb:QuarterDatabase, sdbs: ScheduleDatabase; outputs: best:BestSchedules; description: (* All ScheduleDatabases associated with a given QuarterDatabase are examined and those with non-empty SectionTables are compared. Each is assigned a numerical rating which is computed by adding the lowest weighted priority level which each schedule meets for each of the five criteria. The "best" schedule is the one with the lowest total. More that one schedule may be "best" and the name or names are returned to the user. If there is no ScheduleDatabase with a non-empty SectionTable, the operation fails.*); end ChooseBestSchedule; (* 5.5 Maintain ScheduleDatabase *) operation ScheduleDatabaseOp components: CreateScheduleDatabase|DeleteScheduleDatabase| OpenScheduleDatabase|SectionOp|WeightedPrioritiesOp| LockOp|GenerateScheduleReport; inputs: UserSelectInput, UserLockInput, UserWeightInput, ScheduleDatabase, QuarterDatabase, AnnualDatabase; outputs: QueryResponse, QuarterDatabase, ScheduleDatabase; description: (*The ScheduleDatabase contains information which is used to generate a particular version of a quarter schedule. The user may elect to have several linked to a QuarterDatabase. The SectionTable will be rewritten when a new schedule is generated.*); end ScheduleDatabaseOp; operation CreateScheduleDatabase inputs: QuarterDatabase, UserSelectInput; outputs: ScheduleDatabase, QuarterDatabase; description: (*User creates an ScheduleDatabase and it is linked to the AnnualDatabase of the previous year or empty if the current QuarterDatabase. The user may create as many as needed and designate one.*); end CreateScheduleDatabase; operation DeleteScheduleDatabase inputs: ScheduleDatabase, UserSelectInput, QuarterDatabase; outputs: QuarterDatabase; description: (*User deletes a ScheduleDatabase. The information is deleted from the QuarterDatabase.*); end DeleteScheduleDatabase; operation OpenScheduleDatabase inputs: ScheduleDatabase, QuarterDatabase, UserSelectInput; outputs: ScheduleDatabase; description: (*User opens a ScheduleDatabase by selecting from the list associated with the current quarter.*); end OpenScheduleDatabase; operation SectionOpClass -- extends ScheduleDBOpClass inputs: SectionRow, AnnualDatabase; end SectionOpClass; operation SectionOp components: AddSectionRow| DeleteSectionRow| ModifySectionRow; inputs: SectionRow, ScheduleDatabase; outputs: ScheduleDatabase; end SectionOp; operation BuildSectionRow inputs: UserStringInput; outputs: SectionRow; description: (*User inputs information to fill a row in SectionTable. Normally, this operation is done automatically during Generate Schedule but the user may make direct inputs as well.*); end BuildSectionRow; operation AddSectionRow -- extends SectionOpClass description: (*A Section record is added to SectionTable by the user.*); end AddSectionRow; operation DeleteSectionRow -- extends SectionOpClass description: (*An Section record is removed from SectionTable.*); end DeleteSectionRow; operation ModifySectionRow -- extends SectionOpClass description: (*An SectionRow of SectionTable is updated.*); end ModifySectionRow; operation QuerySectionTable inputs: SectionRow, ScheduleDatabase; outputs: SectionTable; description: (*A query facility is used to look at data in SectionTable.*); end QuerySectionTable; operation WeightedPrioritiesOp components: ModifyWeightedPriorities| QueryWeightedPriorities; inputs: UserWeightInput, ScheduleDatabase; outputs: ScheduleDatabase; description: (*When a schedule is created from current databases, it reflects the weighted priorities. Default condition is equal weight to each factor. Many schedules may be generated from the same information by varying the weights of these factors.*); end WeightedPrioritiesOp; operation ModifyWeightedPriorities inputs: ScheduleDatabase, UserWeightInput; outputs: ScheduleDatabase; description: (*WeightedPriorities is updated.*); end ModifyWeightedPriorities; operation QueryWeightedPriorities inputs: ScheduleDatabase, WeightedPriorities; outputs: WeightedPriorities; description: (*A query facility is used to look the WeightedPriorities.*); end QueryWeightedPriorities; operation LockOp components: LockRoomtoSection|LockInstructortoSection| LockTimetoSection; inputs: UserLockInput, ScheduleDatabase, QuarterDatabase, AnnualDatabase; outputs: ScheduleDatabase, QueryResponse; description: (*Locks elements into the schedule prior to generation*); end LockOp; operation LockRoomtoSectionClass -- extends ScheduleDBOpClass inputs: LockRoomSectionRow, AnnualDatabase; end LockRoomtoSectionClass; operation LockRoomtoSection components: AddLockRoomSectionRow| DeleteLockRoomSectionRow; inputs: LockRoomSectionRow, ScheduleDatabase, QuarterDatabase, AnnualDatabase; outputs: ScheduleDatabase; end LockRoomtoSection; operation BuildLockRoomSectionRow inputs: UserStringInput; outputs: LockRoomSectionRow; description: (*User inputs information to fill a row in LockRoomSectionTable. Normally, this operation is done automatically during Generate Schedule but the user may make direct inputs as well.*); end BuildLockRoomSectionRow; operation AddLockRoomSectionRow -- extends LockRoomtoSectionClass description: (*A LockRoomSection record is added to LockRoomSectionTable by the user.*); end AddLockRoomSectionRow; operation DeleteLockRoomSectionRow -- extends LockRoomtoSectionClass description: (*A LockRoomSection record is removed from LockRoomSectionTable.*); end DeleteLockRoomSectionRow; operation QueryLockRoomSectionTable inputs: LockRoomSectionRow, ScheduleDatabase; outputs: LockRoomSectionTable; description: (*A query facility is used to look at data in LockRoomSectionTable.*); end QueryLockRoomSectionTable; operation LockInstructortoSectionClass -- extends ScheduleDBOpClass inputs: LockInstructorSectionRow, AnnualDatabase; end LockInstructortoSectionClass; operation LockInstructortoSection components: AddLockInstructorSectionRow| DeleteLockInstructorSectionRow; inputs: LockInstructorSectionRow, ScheduleDatabase, QuarterDatabase, AnnualDatabase; outputs: ScheduleDatabase; end LockInstructortoSection; operation BuildLockInstructorSectionRow inputs: UserStringInput; outputs: LockInstructorSectionRow; description: (*User inputs information to fill a row in LockInstructorSectionTable. Normally, this operation is done automatically during Generate Schedule but the user may make direct inputs as well.*); end BuildLockInstructorSectionRow; operation AddLockInstructorSectionRow -- extends LockInstructortoSectionClass description: (*A LockInstructorSection record is added to LockInstructorSectionTable by the user.*); end AddLockInstructorSectionRow; operation DeleteLockInstructorSectionRow -- extends LockInstructortoSectionClass description: (*A LockInstructorSection record is removed from LockInstructorSectionTable.*); end DeleteLockInstructorSectionRow; operation QueryLockInstructorSectionTable inputs: LockInstructorSectionRow, ScheduleDatabase; outputs: LockInstructorSectionTable; description: (*A query facility is used to look at data in LockInstructorSectionTable.*); end QueryLockInstructorSectionTable; operation LockTimetoSectionClass -- extends ScheduleDBOpClass inputs: LockTimeSectionRow, AnnualDatabase; end LockTimetoSectionClass; operation LockTimetoSection components: AddLockTimeSectionRow| DeleteLockTimeSectionRow; inputs: LockTimeSectionRow, ScheduleDatabase, QuarterDatabase, AnnualDatabase; outputs: ScheduleDatabase; end LockTimetoSection; operation BuildLockTimeSectionRow inputs: UserStringInput; outputs: LockTimeSectionRow; description: (*User inputs information to fill a row in LockTimeSectionTable. Normally, this operation is done automatically during Generate Schedule but the user may make direct inputs as well.*); end BuildLockTimeSectionRow; operation AddLockTimeSectionRow -- extends LockTimetoSectionClass description: (*A LockTimeSection record is added to LockTimeSectionTable by the user.*); end AddLockTimeSectionRow; operation DeleteLockTimeSectionRow -- extends LockTimetoSectionClass description: (*A LockTimeSection record is removed from LockTimeSectionTable.*); end DeleteLockTimeSectionRow; operation QueryLockTimeSectionTable inputs: LockTimeSectionRow, ScheduleDatabase; outputs: LockTimeSectionTable; description: (*A query facility is used to look at data in LockTimeSectionTable.*); end QueryLockTimeSectionTable; operation GenerateScheduleReport inputs: UserSelectInput, ScheduleDatabase; outputs: ScheduleReport; description: (*Outputs a report of a generated schedule in a format suitable for printing.*); end GenerateScheduleReport; operation GetDaySpreadLevel inputs: AnnualDatabase, QuarterDatabase, ScheduleDatabase; outputs: integer; description: (*Returns the highest weighted priority level (lowest number) which the given schedule meets for DaySpread.*); end GetDaySpreadLevel; operation GetHourSpreadLevel inputs: AnnualDatabase, QuarterDatabase, ScheduleDatabase; outputs: integer; description: (*Returns the highest weighted priority level (lowest number) which the given schedule meets for HourSpread.*); end GetHourSpreadLevel; operation GetCoursePreferenceLevel inputs: AnnualDatabase, QuarterDatabase, ScheduleDatabase; outputs: integer; description: (*Returns the highest weighted priority level (lowest number) which the given schedule meets for CoursePreference.*); end GetCoursePreferenceLevel; operation GetNumberofPrepsLevel inputs: AnnualDatabase, QuarterDatabase, ScheduleDatabase; outputs: integer; description: (*Returns the highest weighted priority level (lowest number) which the given schedule meets for NumberofPreps.*); end GetNumberofPrepsLevel; operation GetTimeofDayLevel inputs: adb:AnnualDatabase, qdb:QuarterDatabase, sdb:ScheduleDatabase; outputs: TimeofDayLevel:integer; description: (*Returns the highest weighted priority level (lowest number) which the given schedule meets for TimeofDay*); end GetTimeofDayLevel; (* 5.6 Schedule Generation *) operation GenerateSchedule inputs: adb:AnnualDatabase, qdb:QuarterDatabase, sdb:ScheduleDatabase; outputs: sdb':ScheduleDatabase; (* Per 29May disc. with Gene, the aux ops used in the precond below do not require further defintion. *) precondition: (qdb in adb.QuarterDatabases) and (sdb in qdb.ScheduleDatabases); (* There are Annual, Quarter and Schedule Databases which are current and the SDB is listed in QDB and the QBD is in the ADB.*) postcondition: (* if sdb.WeightedPriorities.CompactSchedule = 1 then forall (i in qdb.InstructorPreferences) (GetHourSpread(i.Name, sdb') <= i.PrefHourSpread) and (CountTeachingDays(i.Name, sdb') <= i.PrefNumDays) else if sdb.WeightedPriorities.CompactSchedule = 2 then forall (i in qdb.InstructorPreferences) if i.Priority <= 3 then (GetHourSpread(i.Name, sdb') <= i.PrefHourSpread) and (CountTeachingDays(i.Name, sdb') <= i.PrefNumDays) else (GetHourSpread(i.Name, sdb') <= i.PrefHourSpread + 2) and (CountTeachingDays(i.Name, sdb') <= i.PrefNumDays + 1) else if sdb.WeightedPriorities.CompactSchedule = 3 then forall (i in qdb.InstructorPreferences) if i.Priority <= 3 then (GetHourSpread(i.Name, sdb') <= i.PrefHourSpread + 1) and (CountTeachingDays(i.Name, sdb') <= i.PrefNumDays + 1) and (CountTeachingDays(i.Name, sdb') <= 4) else (GetHourSpread(i.Name, sdb') <= i.PrefHourSpread + 3) and (CountTeachingDays(i.Name, sdb') <= i.PrefNumDays + 1) else if sdb.WeightedPriorities.CompactSchedule = 4 then forall (i in qdb.InstructorPreferences) if i.Priority = 1 then (GetHourSpread(i.Name, sdb') <= i.PrefHourSpread + 2) and (CountTeachingDays(i.Name, sdb') <= i.PrefNumDays + 1) else GetHourSpread(i.Name, sdb') <= i.PrefHourSpread + 4 and if sdb.WeightedPriorities.NumberOfPreps = 1 then forall (i in qdb.InstructorPreferences) (GetNumberOfPreps(i.Name, sdb') <= i.PrefNumberPreps) else if sdb.WeightedPriorities.NumberOfPreps = 2 then forall (i in qdb.InstructorPreferences) if i.Priority <= 3 then (GetNumberOfPreps(i.Name, sdb') <= i.PrefNumberPreps) else (GetNumberOfPreps(i.Name, sdb') <= i.PrefNumberPreps+1) else if sdb.WeightedPriorities.NumberOfPreps = 3 then forall (i in qdb.InstructorPreferences) if i.Priority <= 2 then (GetNumberOfPreps(i.Name, sdb') <= i.PrefNumberPreps+1) else (GetNumberOfPreps(i.Name, sdb') <= i.PrefNumberPreps+2) else if sdb.WeightedPriorities.NumberOfPreps = 4 then forall (i in qdb.InstructorPreferences) if i.Priority = 1 then (GetNumberOfPreps(i.Name, sdb') <= i.PrefNumberPreps+2) else (GetNumberOfPreps(i.Name, sdb') <= i.PrefNumberPreps+3) and forall (i in qdb.InstructorPreferences) (GetNumberOfPreps(i.Name, sdb') <= qdb.InstructorPreferences.MaxNumberOfPreps) and if sdb.WeightedPriorities.CoursePreference = 1 then forall (c in sdb'.SectionTable) forall (i in qdb.InstructorPreferences) GetCoursePref(c.InstructorName, c.Course) <= GetCoursePref(i.Name, c.Course) else if sdb.WeightedPriorities.CoursePreference = 2 then forall (c in sdb'.SectionTable) forall (i in qdb.InstructorPreferences) GetCoursePref(c.InstructorName, c.Course) + 1 <= GetCoursePref(i.Name, c.Course) else if sdb.WeightedPriorities.CoursePreference = 3 then forall (c in sdb'.SectionTable) forall (i in qdb.InstructorPreferences) GetCoursePref(c.InstructorName, c.Course) + 2 <= GetCoursePref(i.Name, c.Course) else if sdb.WeightedPriorities.CoursePreference = 4 then forall (c in sdb'.SectionTable) forall (i in qdb.InstructorPreferences) GetCoursePref(c.InstructorName, c.Course) + 3 <= GetCoursePref(i.Name, c.Course) and if sdb.WeightedPriorities.TimeofDay = 1 then forall (c in sdb'.SectionTable) if GetPriority(c.InstructorName) <= 3 then GetTimePref(c.InstructorName, c.Time) = 1 else GetTimePref(c.InstructorName, c.Time) <= 2 else if sdb.WeightedPriorities.TimeofDay = 2 then forall (c in sdb'.SectionTable) if GetPriority(c.InstructorName) <= 3 then GetTimePref(c.InstructorName, c.Time) <= 2 else GetTimePref(c.InstructorName, c.Time) <= 3 else if sdb.WeightedPriorities.TimeofDay = 3 then forall (c in sdb'.SectionTable) if GetPriority(c.InstructorName) <= 3 then GetTimePref(c.InstructorName, c.Time) <= 3 else GetTimePref(c.InstructorName, c.Time) <= 4 else if sdb.WeightedPriorities.TimeofDay = 4 then forall (c in sdb'.SectionTable) GetTimePref(c.InstructorName, c.Time) <= 4 ; All of the weighted priorities are met at their selected levels (1-4, duplication allowed) else GenerateSchedule fails and the user should change either the weighted priorities or the instructor constraints in the Annual and Quarter Databases or the Locks. Meeting Weighted Priorities: CompactSchedule if (qdb.WeightedPriorities.CompactSchedule == 1) If assigned 1, for all instructors their maxhourspread <= their InstructorPrefHourSpread and number of teaching days <= InstructorPrefNumberDays. If assigned 2, for all instructors with priorities 1,2 or 3 their hourspread<= their InstructorPrefHourSpread and number of teaching days <= InstructorPrefNumberDays. For others, their hourspread<= their InstructorPrefHourSpread + 2. and number of teaching days <= InstructorPrefNumberDays + 1 and <= 5; If assigned 3, for all instructors with priorities 1,2 or 3 their hourspread<= their InstructorPrefHourSpread+1 and number of teaching days <= InstructorPrefNumberDays+1 and <= 4. For others, their hourspread<= their InstructorPrefHourSpread + 3. and number of teaching days <= InstructorPrefNumberDays + 1 and <= 5; If assigned 4, for all instructors with priorities 1 their hourspread<= their InstructorPrefHourSpread + 2 and number of teaching days <= InstructorPrefNumberDays + 1 and <= 5; For Instructors with priorities 2 or 3 hourspread<= their InstructorPrefHourSpread + 4. and number of teaching days <= InstructorPrefNumberDays + 1 and <= 5; For all other Instructors hourspread <= their InstructorPrefHourSpread + 4. *); description: (*The SectionTable is overwritten as a schedule is created from the information is the Annual, Quarter, and ScheduleDatabases. Each section of each course offered is linked to an available room, a meeting time and an instructor. *); end GenerateSchedule; (*function GetMaxHourSpread(s:InstructorName): integer = (*max(forall(days )(startoflastclass - startoffirstclass + length of lastclass)) *) (* 5.7 View List of Saved Annual Databases *) operation ViewListofAnnualDatabases inputs: ListofAnnualDatabases, UserSelectInput; outputs: ListofAnnualDatabases; description: (*User browses list of the saved AnnualDatabases and has the option of opening or deleting any of them or of creating a new AnnualDatabase.*); end ViewListofAnnualDatabases; end foo;