Optimise timetables

The Optimise selection in the Tools menu allows you to create timetables automatically, copy scheduled periods from one week to other weeks or remove scheduled periods. You can also optimise timetables by letting the application automatically compact them by minimising gaps with respect to the constraints you have set. Note that creating workable or perfect timetables completely automatically without any manual adjustments takes place only in rare occasions, due to the many constraints that often become visible during the scheduling process.

The optimisation rules you want to apply vary by events, and while others may prefer compact timetables, others like to have space between events and so on. There can be many instances where you want the optimisation work differently than how you think. Since Mimosa is not a mind reader, we recommend you to manually schedule all critical events in Timetables view and lock them before optimisation. If you are scheduling for the first time with Mimosa, you may also consider to schedule ALL events manually, just to become familiar what kind of rules you may want to apply for each event when optimising.

With Mimosa you can schedule the periods of events in timetables in several alternative ways, depending on your preferences and requirements. Most important tools are presented below:

Timetables view is the most common way to schedule periods interactively and easily. In this view you can also simultaneously view all the related timetables and also Undo and Redo all the actions you have made.
If the start and end dates and the time periods for event schedules are known beforhand, Edit|Bulk schedule in Events view is a recommended selection.
If you prefer to schedule events when attaching resources to events, select Instant scheduling in Events view.
You can also import schedules from your spreadsheet application by using the appropriate Clipboard selection in Events view.
You can also import schedules as all other Mimosa data from other applications by using the Import/export with text files tools and the File|File Import or File|File Add selections.

You can select the appropriate action from the Tools tab. Then you select the events and set the constraints from the Selections tab. This enables the user to restrict the operation only to a predefined set of events and time-frame, and also to take into account some other factors, such as locking of the events.

List of available selections:

Initial solution

If you have allocated the periods of the events to weeks in Weeks view you can let Initial solution create the timetables automatically. If you have only one week, the periods are automatically allocated to this week and you can use this tool immediately.

Since Initial solution produces in most cases an approximate starting solution for your timetables, you may like to schedule some critical events manually in Timetables view beforehand to be sure about the exact locations of periods. If you have done this, you may have protected those events by locking them with [Ctrl+U] in this window. It is also a good practice to save this solution on disk before you invoke Initial solution or you begin to optimise the current solution, since you can always open this file again, if something unpredicted happens.

After selecting the Initial solution you go then to the next tab to pick those events, week range and time range in the timetable where you want to limit the automatic scheduling.

Select events

When you select events to be scheduled, consider which events you have to schedule first. To select the order how the events are scheduled, you may

  • sort the events in decreasing order by PLANNED or LINKS in Events view to get them on top of list
  • use the event categories to pick only the events that you want to include in scheduling
  • lock those events which you do not want to get scheduled with this application

Note that when you create an initial solution, the same settings (Week range, Time range, Block range) cannot be applied to all events. Some events are more difficult to schedule than others and/or they have more stricter scheduling requirements. In those cases it is often simpler to schedule them manually and possible lock these events. Initial solution is typically run many times with different sets of events, starting from the most demanding and ending with least demanding events. You may consider to save your file after each critical step to enable rolling back to a previous stage when needed.

It is often natural to select the events to schedule by resources. This is done as follows:

Click the Clear button on top of the selection window.
Click the Links button to select the resource(s) you want to use.
Check the resources which are going to be included and click [OK] to accept the selection.

Select week range and time range

In Week range select the minimum and maximum weeks or terms to be included. If your file contains only one week, this selection is not enabled.

In Time range select the area of slots from the timetables to be included in the solution. If you want to select all available slots in the timetable, click Select all slots.

Change the numbers in Min and Max to select the permissibe scheduling range in the timetables. This area cannot exceed the area defined in Options|Limits.

Block individual slots

You can block out selected slots or days of the week from the Initial solution and you can define up to 15 different blocking patterns to use for different purposes. For instance, you can use one blocking pattern to limit the initial solution for one set of events so that the events are only scheduled on Mondays, Wednesdays and Fridays and then use another pattern for different events to schedule them on Tuesdays and Thursdays or you can use even more complicated selections. Remember that you can also define different time periods for the slots in each day in Options|Time.

Select a pattern number (Slot block #1, Slot block #2, ..., Slot block #15) from the drop-down list (initially [No slot blocks]) and then double-click the slots in the timetable where you do not want to allow scheduling. The blocked slots are marked in red colour with the pattern number you initially selected.

You may need different patterns for different events and restrictions. For example, you may want to prevent certain events to be scheduled late on Friday or early on Monday. When you select a pattern number from the dropdown list that blocking pattern is applied next time you run the Initial solution. If you select [No slot blocks] none of the slots are blocked.

Blocking of slots has no effect when you select to Optimise the timetables or Remove periods from the timetables, only when you are scheduling with Initial solution. Note that bookings can also be used to prevent scheduling of periods in unwanted slots.

Example 1: Blocking of certain slots or days of the week:

Example 2: Blocking of Tuesdays and Thursdays or Mondays, Wednesdays and Fridays:

Block range

In Block range you can also determine the minimum and maximum lengths of blocks that are used in connection with the event selection. For instance, you may want to delimit the events to have only block lengths of 2 periods (two consecutive periods of the same event). In this case you have to set this number (2) to the minimum and maximum of block lengths, i.e. Min=2 and Max=2. If you want to give more degrees of freedom, you can set Min=1 and Max=3 to generate block lengths of 1-3 lessons.

In the last case, the event of 8 periods may generate blocks like 3+3+2 or 3+2+2+1, for example. If you have set Min=1 and Max=2 the application may result in block distributions like 2+2+2+1+1 or 2+2+2+2.

If you want to set additional rules to blocks, use the parameter Repeat Max at most # times, which is enabled in cases when Min<Max. It sets the maximum number of blocks of length Max that are generated for each week. If you have set Min=1 and Max=2 and you allow at most three double periods, set Repeat Max=3. Using these restrictions, you can obtain from the events of 8 periods only the distributions of periods per day as 2+2+2+1+1, if all 8 periods can be scheduled (since the maximum number of double periods is set to 3, and periods are assumed to be scheduled in 5 days).

The application starts always with the longest given block length and if that block length cannot be fitted into the timetables, the next longest is tried instead, until the minimum length is reached or the periods have been successfully scheduled. The previously scheduled periods are never changed in timetables when Initial solution is run.

Note that the limits that you input here are dependent on the number of periods. The higher the number of periods in a week, the higher the values of Min and Max should be set to produce wanted results. For the number of weekly periods of 16, you could set Min=5 and Max=7, whereas the number of periods of 3 would apply limits Min=1 and Max=3, for instance.

You can also let the application change these limits according to the number of periods automatically:

If you select from Apply ranges as specified

() Below

the application will apply the parameters (Min, Max and Repeat Max) in Block range for all events when creating the initial solution.

The choice

() By application

adjusts the parameters (Min, Max and Repeat Max) automatically, based on the number of the periods of the other events scheduled. It applies the examples taken from the current file, and if they are not available, it uses rules that have been collected from a set of previous Mimosa files you have used.

If you select

() Below and by application

the parameters (Min, Max and Repeat Max) are selected automatically as before, but the Min and Max parameters are always within the given limits you have set for them in Block range.

Instead of Block range, you can also be much more specific in rules of creating the initial solution and use some of the previously scheduled events as examples when scheduling of other events. In some schools part of the events are always scheduled in specific slots, and here you can select events that this application will imitate (or use as examples) during the automatic scheduling process.

If you select [x] Imitate single event you will be prompted to selected a single already scheduled event with the Select event button. This single event will be used as an example for the selected events that you are going to create timetables for. The periods are scheduled only in those slots where this selected imitated event already has its lessons, and excluding all those slots that would cause conflicts.

Once you have made all selections, click Start button to let the application schedule periods automatically. It is a good hint to progress slowly by selecting only those events or event categories you want to have automatically scheduled and then change your selection criteria in following rounds.

The events are processed in their current order. If you want to give higher priority to some of the events - like those having more periods or links than others and being more difficult than others - it can be a good hint to sort the events according to some appropriate criteria, for example in ascending order of ALLOCATED or LINKS. See Tools|Sort events. After the process has stopped, the changed events re displayed.

Exam scheduling

Exam scheduling is an additional option to restrict scheduling of specific events to the timetables of specific resources only once in a day. Since "exams" are typically events that are allowed to be scheduled only once in a day in the timetables of "students", this function is called "Exam scheduling", although it can be applied to any other events as well. You can select a category from events and from resources where this rule is applied. All events of the selected category are scheduled at most once per day in the timetables of the selected resource category. Note that by default Initial solution never schedules the same event twice in the same day, unless they are scheduled as a block of several consecutive periods.

When you click the Exam scheduling button, you should next select the appropriate categories in events and resources where this restriction is applied. When you click this button another time or when you invoke Mimosa again, the previously set restrictions do not apply anymore.

If you want to extend the restriction to schedule the exams in days with at least one day between, reply with [Yes] to the following question:

Note that Initial solution never
- moves or removes the previously scheduled periods
- schedules the same event twice in the same day (unless they are scheduled in blocks)
- schedules events and resources from the selected categories in the same day, if Exam scheduling is selected.

Optimise timetables

After the periods (of at least two events) have been scheduled - either manually (in Timetables view) or with the above Initial solution you can improve the current solution with this selection. The optimisation criteria are to minimise the number of gaps in timetables (primary) and to move periods to an earlier time in timetables (secondary). Both goals aim at more compact timetables.

Optimisation alone cannot guarantee that the result is optimal in all aspects. Its functionality is in similar to a robot vacuum. Although these gadgets work restless, they are not always very clever, since they may clean the same spot twice and miss spots that humans have to clean with other means. Humans have to move tables, chairs and other obstacles in order to control the area where robot vacuum can traverse. Similarly, when optimising timetables, it is important to use tools like Bookings, Locking, Event selection and optimisation rules to control the optimisation flow. Most important is to perform changes also manually in Timetables view or other scheduling tools in order to check and polish the work what is done by optimisation. On the other hand, optimisation can remarkably save time when used properly for events which allow optimisation.

Due to default rules (Disable multiple event blocks and Maintain balanced daily schedules) of the optimisation algorithm, there are some obvious cases where timetables could be easily improved manually, but optimisation is not allow to make the same changes.

Example 1. Optimisation algorithm cannot fill the gap, since it would require that an event block (3x "9") would be cut to blocks (2x "9" & 2x "9"):

Example 2. Optimisation algorithm cannot move the event "5" from Friday to any other day, since it would make then Friday shorter (4 periods) than the currently shortest day (4 periods):

There are many different factors which characterise a "good" or "bad" timetable, and they vary between institutions and users of the timetables, for instance:

  • range of the lengths of days
  • range of the earliest and latest slot in a week
  • gaps in timetables
  • numbers of free days in a week

In general, an "ideal" timetable does not contain any gaps, all days have an even number of periods and the first and last slots of each day are the same. This goal can never been achieved in practice and Mimosa calculates the parameters measuring the deviations from the ideal case and attempts to minimise them.

Some users may prefer to have gaps in their timetables to allow a suitable break, whereas for others gaps are not preferable. The cost of eliminating a gap in the timetable results in some cases that a user must sacrify a free day. When optimising timetables, Mimosa attempts to take all these factors into account and to create timetables which are as acceptable as possible.

In Options|Timetables|Count gaps for you have selected those resource categories where you want to associate gaps counting. Typically the timetable quality is measured by the number of gaps in categories like classes, teachers or students. In Selections you can give emphasis to the importance of each category by associating a coefficient from range 0-9 to each gap in their timetables. The objective is to minimise the total sum of gaps, and so the application tries to avoid gaps more active in those categories which have a greater weight.

For example, if it is extremely important to avoid gaps in the timetables of classes comparing to those of the teachers, set the weight to 9 for the class category and 1 for the teacher category (gaps in the timetables of classes are 9 times more severe than teacher gaps). If you use categories like rooms and other similar facilities, which do not mind about gaps, you can set their weights to 0, since it gives more degrees of freedom for the application to improve the timetables for humans.

There are two simple operations that are NOT permitted in optimisation: blocks (subsequent lessons of the same event) are never split or joined. Although these operations are often appropriate and they can also speed up the optimisation, they must be performed manually in Timetables view, to give a better control of all consequences of this operation.

Select also the block range you want to include in optimisation and check

[x] Treat bookings like events

if you assume that the bookings are interpreted as periods when counting gaps (holes in the timetables). If this option is selected, the application tries to schedule periods into those gaps, which are defined as empty cells between the cells, which contain either bookings or periods. Otherwise, the gaps are empty cells between cells containing periods. This selection may slightly change the style of the optimisation since its primary goal is to fill the gaps in the timetables.

Checking the selection

[x] Disable multiple event blocks

prevents from moving periods of the same event in the same day during optimisation. If you initially have a sequence of periods of some event in a certain day, moving a sequence or a single period of the same event to this day is forbidden during the optimisation.

If the proposed move is discarded for this reason, it is accumulated and displayed in the Undone field during the optimisation process.

When checked,

[x] Maintain balanced daily schedules

does not allow moving of periods in those cases, when the number of daily periods would be less or more in this category than it was before the optimisation started. To take an example, suppose that the number of the daily periods in classes is always in the range 5...7. All moves caused by the optimisation that would result in less than 5 daily periods or more than 7 daily periods for some class, would be discarded.

If the intended move is discarded for this reason, it is accumulated and displayed in the Undone field during the optimisation process.

The selection

Optimisation algorithm

enables you to choose the main optimisation algorithms (1 and 2). Selecting Both apply these algorithms mixed, and this selection is recommended because of its efficiency among the data sets that have been analysed.

Click the Optimise button to start optimisation and Stop button to stop the process. The initial number and the current number of gaps is displayed plus graph showing the progress of the optimisation. Wait a couple of minutes to monitor the speed of the optimisation and consider if it needs more time or do the parameters need to be adjusted. If not interrupted, the optimisation stops automatically after 24 hours or when it considers its task hopeless.

During optimisation you can view the changes of the avarage numbers of Gaps in timetables in each category, the Day length range and the First and last slot range. These numbers normally decrease when optimisation progesses, although the goal in optimisation is to minimise the number of gaps.

After you have finished optimisation, the list of all affected (changed) timetables are displayed:

Optimise timetables
- never schedules new periods into the timetables
- never unschedules previously scheduled periods
- moves previously scheduled periods to other locations in the timetables to improve the current solution.

Remove scheduled periods from timetables

This is the reverse operation to the Initial solution selection. When you click START, Mimosa removes - or unschedules - all periods from the timetables set in the week and time ranges and in the events that you have selected. You can also unschedule timetables in the selection Tools|Clear|2 Scheduled periods.

Copy timetables across weeks

If you have scheduled some of the periods, you can copy them to the following weeks in the selected range of weeks. From the week range, choose the first week for the "source week" which is used as an example for copying and the last week to final week where the scheduled periods are copied. You have to supply a range of at least two weeks and the first week must have at least one scheduled period.

When you click START, Mimosa tries to copy the scheduled periods from the source week to the destination week if it can be performed without conflicts. Copying is limited to the set of events that you have included in the copy operation. In many cases, the successive weeks have many events in common, so that the manual scheduling task can be remarkably reduced with this copy option.

Show unscheduled periods

This selection lists all resources and events in a tree view, which have at least one or more periods not yet scheduled. Clicking Select button shows a detailed view of the activated resource or event.