@@ -65,7 +65,7 @@ duration/location of the slots we know some of them are unavailable for a given
6565
6666 >>> events = [Event(name='Talk 1', duration=30, tags=['beginner'], unavailability=outside_slots[:], demand=50),
6767 ... Event(name='Talk 2', duration=30, tags=['beginner'], unavailability=outside_slots[:], demand=130),
68- ... Event(name='Talk 3', duration=30, tags=['beginner'], unavailability=outside_slots[:], demand=500 ),
68+ ... Event(name='Talk 3', duration=30, tags=['beginner'], unavailability=outside_slots[:], demand=3000 ),
6969 ... Event(name='Talk 4', duration=30, tags=['beginner'], unavailability=outside_slots[:], demand=30),
7070 ... Event(name='Talk 5', duration=30, tags=['intermediate'], unavailability=outside_slots[:], demand=60),
7171 ... Event(name='Talk 6', duration=30, tags=['intermediate'], unavailability=outside_slots[:], demand=30),
@@ -107,20 +107,20 @@ event::
107107 >>> schedule.sort(key=lambda item: item.slot.starts_at)
108108 >>> for item in schedule:
109109 ... print(f"{item.event.name} at {item.slot.starts_at} in {item.slot.venue}")
110- Talk 3 at 15-Sep-2016 09:30 in Small
110+ Talk 5 at 15-Sep-2016 09:30 in Small
111111 Talk 11 at 15-Sep-2016 09:30 in Big
112112 Talk 4 at 15-Sep-2016 10:00 in Small
113- Talk 8 at 15-Sep-2016 10:00 in Big
113+ Talk 10 at 15-Sep-2016 10:00 in Big
114114 Talk 1 at 15-Sep-2016 12:30 in Small
115- Talk 5 at 15-Sep-2016 12:30 in Big
116- Talk 2 at 15-Sep-2016 13:00 in Small
117- Talk 6 at 15-Sep-2016 13:00 in Big
118- Talk 9 at 16-Sep-2016 09:30 in Big
115+ Talk 6 at 15-Sep-2016 12:30 in Big
116+ Talk 3 at 15-Sep-2016 13:00 in Small
117+ Talk 8 at 15-Sep-2016 13:00 in Big
118+ Talk 2 at 16-Sep-2016 09:30 in Big
119119 Workshop 2 at 16-Sep-2016 09:30 in Small
120- Talk 10 at 16-Sep-2016 10:00 in Big
121- Talk 7 at 16-Sep-2016 12:30 in Big
120+ Talk 9 at 16-Sep-2016 10:00 in Big
121+ Talk 12 at 16-Sep-2016 12:30 in Big
122122 Boardgames at 16-Sep-2016 12:30 in Outside
123- Talk 12 at 16-Sep-2016 13:00 in Big
123+ Talk 7 at 16-Sep-2016 13:00 in Big
124124 Workshop 1 at 16-Sep-2016 13:00 in Small
125125 City tour at 16-Sep-2016 13:00 in Outside
126126
@@ -129,10 +129,8 @@ the unavailability attribute for the events). Also we have that :code:`Talk 1`
129129doesn't clash with :code: `Workshop 1 `.
130130Similarly, the :code: `Boardgame ` does not clash with :code: `Workshop 2 `.
131131
132- You will also note that in any given session, talks share at least one tag. This
133- is another constraint of the model; if you find that your schedule has no
134- solutions you can adjust it by re-categorising your talks (or giving them all a
135- single category).
132+ You will also note that no two events with the same tags are on at the same time.
133+ Tags allow for a quick way to batch define unavailability.
136134
137135Avoiding room overcrowding
138136--------------------------
@@ -150,18 +148,18 @@ our scheduler to minimise the difference between room capacity and demand::
150148 >>> schedule.sort(key=lambda item: item.slot.starts_at)
151149 >>> for item in schedule:
152150 ... print(f"{item.event.name} at {item.slot.starts_at} in {item.slot.venue}")
153- Talk 4 at 15-Sep-2016 09:30 in Big
154- Talk 7 at 15-Sep-2016 09:30 in Small
155- Talk 1 at 15-Sep-2016 10:00 in Big
151+ Talk 1 at 15-Sep-2016 09:30 in Big
152+ Talk 12 at 15-Sep-2016 09:30 in Small
153+ Talk 2 at 15-Sep-2016 10:00 in Big
156154 Talk 6 at 15-Sep-2016 10:00 in Small
157- Talk 8 at 15-Sep-2016 12:30 in Big
158- Talk 12 at 15-Sep-2016 12:30 in Small
159- Talk 5 at 15-Sep-2016 13:00 in Big
160- Talk 10 at 15-Sep-2016 13:00 in Small
161- Talk 3 at 16-Sep-2016 09:30 in Big
155+ Talk 4 at 15-Sep-2016 12:30 in Small
156+ Talk 11 at 15-Sep-2016 12:30 in Big
157+ Talk 5 at 15-Sep-2016 13:00 in Small
158+ Talk 10 at 15-Sep-2016 13:00 in Big
159+ Talk 7 at 16-Sep-2016 09:30 in Big
162160 Workshop 2 at 16-Sep-2016 09:30 in Small
163- Talk 2 at 16-Sep-2016 10:00 in Big
164- Talk 11 at 16-Sep-2016 12:30 in Big
161+ Talk 8 at 16-Sep-2016 10:00 in Big
162+ Talk 3 at 16-Sep-2016 12:30 in Big
165163 Boardgames at 16-Sep-2016 12:30 in Outside
166164 Talk 9 at 16-Sep-2016 13:00 in Big
167165 Workshop 1 at 16-Sep-2016 13:00 in Small
@@ -181,7 +179,7 @@ informs us of a particular new constraints. For example, the speaker for
181179
182180We can enter this new constraint::
183181
184- >>> events[10].add_unavailability(*slots[9: ])
182+ >>> events[10].add_unavailability(*slots[:9 ])
185183
186184We can now solve the problem one more time from scratch just as before::
187185
@@ -190,20 +188,20 @@ We can now solve the problem one more time from scratch just as before::
190188 >>> alt_schedule.sort(key=lambda item: item.slot.starts_at)
191189 >>> for item in alt_schedule:
192190 ... print(f"{item.event.name} at {item.slot.starts_at} in {item.slot.venue}")
193- Talk 1 at 15-Sep-2016 09:30 in Big
194- Talk 8 at 15-Sep-2016 09:30 in Small
195- Talk 4 at 15-Sep-2016 10:00 in Big
196- Talk 5 at 15-Sep-2016 10:00 in Small
197- Talk 3 at 15-Sep-2016 12:30 in Small
198- Talk 9 at 15-Sep-2016 12:30 in Big
199- Talk 2 at 15-Sep-2016 13:00 in Small
200- Talk 12 at 15-Sep-2016 13:00 in Big
201- Talk 11 at 16-Sep-2016 09:30 in Big
191+ Talk 1 at 15-Sep-2016 09:30 in Small
192+ Talk 9 at 15-Sep-2016 09:30 in Big
193+ Talk 5 at 15-Sep-2016 10:00 in Big
194+ Talk 10 at 15-Sep-2016 10:00 in Small
195+ Talk 4 at 15-Sep-2016 12:30 in Big
196+ Talk 7 at 15-Sep-2016 12:30 in Small
197+ Talk 6 at 15-Sep-2016 13:00 in Big
198+ Talk 12 at 15-Sep-2016 13:00 in Small
199+ Talk 2 at 16-Sep-2016 09:30 in Big
202200 Workshop 2 at 16-Sep-2016 09:30 in Small
203- Talk 10 at 16-Sep-2016 10:00 in Big
204- Talk 6 at 16-Sep-2016 12:30 in Big
201+ Talk 8 at 16-Sep-2016 10:00 in Big
202+ Talk 3 at 16-Sep-2016 12:30 in Big
205203 Boardgames at 16-Sep-2016 12:30 in Outside
206- Talk 7 at 16-Sep-2016 13:00 in Big
204+ Talk 11 at 16-Sep-2016 13:00 in Big
207205 Workshop 1 at 16-Sep-2016 13:00 in Small
208206 City tour at 16-Sep-2016 13:00 in Outside
209207
@@ -219,20 +217,20 @@ old schedule::
219217 >>> similar_schedule.sort(key=lambda item: item.slot.starts_at)
220218 >>> for item in similar_schedule:
221219 ... print(f"{item.event.name} at {item.slot.starts_at} in {item.slot.venue}")
222- Talk 4 at 15-Sep-2016 09:30 in Big
223- Talk 7 at 15-Sep-2016 09:30 in Small
224- Talk 1 at 15-Sep-2016 10:00 in Big
220+ Talk 1 at 15-Sep-2016 09:30 in Big
221+ Talk 12 at 15-Sep-2016 09:30 in Small
222+ Talk 2 at 15-Sep-2016 10:00 in Big
225223 Talk 6 at 15-Sep-2016 10:00 in Small
226- Talk 8 at 15-Sep-2016 12:30 in Big
227- Talk 11 at 15-Sep-2016 12:30 in Small
228- Talk 5 at 15-Sep-2016 13:00 in Big
229- Talk 10 at 15-Sep-2016 13:00 in Small
230- Talk 3 at 16-Sep-2016 09:30 in Big
224+ Talk 4 at 15-Sep-2016 12:30 in Small
225+ Talk 9 at 15-Sep-2016 12:30 in Big
226+ Talk 5 at 15-Sep-2016 13:00 in Small
227+ Talk 10 at 15-Sep-2016 13:00 in Big
228+ Talk 7 at 16-Sep-2016 09:30 in Big
231229 Workshop 2 at 16-Sep-2016 09:30 in Small
232- Talk 2 at 16-Sep-2016 10:00 in Big
233- Talk 12 at 16-Sep-2016 12:30 in Big
230+ Talk 8 at 16-Sep-2016 10:00 in Big
231+ Talk 3 at 16-Sep-2016 12:30 in Big
234232 Boardgames at 16-Sep-2016 12:30 in Outside
235- Talk 9 at 16-Sep-2016 13:00 in Big
233+ Talk 11 at 16-Sep-2016 13:00 in Big
236234 Workshop 1 at 16-Sep-2016 13:00 in Small
237235 City tour at 16-Sep-2016 13:00 in Outside
238236
@@ -248,37 +246,34 @@ with the original. Firstly, we can see which events moved to different slots::
248246 >>> event_diff = scheduler.event_schedule_difference(schedule, alt_schedule)
249247 >>> for item in event_diff:
250248 ... print(f"{item.event.name} has moved from {item.old_slot.venue} at {item.old_slot.starts_at} to {item.new_slot.venue} at {item.new_slot.starts_at}")
251- Talk 1 has moved from Big at 15-Sep-2016 10:00 to Big at 15-Sep-2016 09:30
252- Talk 10 has moved from Small at 15-Sep-2016 13:00 to Big at 16-Sep-2016 10:00
253- Talk 11 has moved from Big at 16-Sep-2016 12:30 to Big at 16-Sep-2016 09:30
254- Talk 12 has moved from Small at 15-Sep-2016 12:30 to Big at 15-Sep-2016 13:00
255- Talk 2 has moved from Big at 16-Sep-2016 10:00 to Small at 15-Sep-2016 13:00
256- Talk 3 has moved from Big at 16-Sep-2016 09:30 to Small at 15-Sep-2016 12:30
257- Talk 4 has moved from Big at 15-Sep-2016 09:30 to Big at 15-Sep-2016 10:00
258- Talk 5 has moved from Big at 15-Sep-2016 13:00 to Small at 15-Sep-2016 10:00
259- Talk 6 has moved from Small at 15-Sep-2016 10:00 to Big at 16-Sep-2016 12:30
260- Talk 7 has moved from Small at 15-Sep-2016 09:30 to Big at 16-Sep-2016 13:00
261- Talk 8 has moved from Big at 15-Sep-2016 12:30 to Small at 15-Sep-2016 09:30
262- Talk 9 has moved from Big at 16-Sep-2016 13:00 to Big at 15-Sep-2016 12:30
249+ Talk 1 has moved from Big at 15-Sep-2016 09:30 to Small at 15-Sep-2016 09:30
250+ Talk 10 has moved from Big at 15-Sep-2016 13:00 to Small at 15-Sep-2016 10:00
251+ Talk 11 has moved from Big at 15-Sep-2016 12:30 to Big at 16-Sep-2016 13:00
252+ Talk 12 has moved from Small at 15-Sep-2016 09:30 to Small at 15-Sep-2016 13:00
253+ Talk 2 has moved from Big at 15-Sep-2016 10:00 to Big at 16-Sep-2016 09:30
254+ Talk 4 has moved from Small at 15-Sep-2016 12:30 to Big at 15-Sep-2016 12:30
255+ Talk 5 has moved from Small at 15-Sep-2016 13:00 to Big at 15-Sep-2016 10:00
256+ Talk 6 has moved from Small at 15-Sep-2016 10:00 to Big at 15-Sep-2016 13:00
257+ Talk 7 has moved from Big at 16-Sep-2016 09:30 to Small at 15-Sep-2016 12:30
258+ Talk 9 has moved from Big at 16-Sep-2016 13:00 to Big at 15-Sep-2016 09:30
263259
264260
265261We can also look at slots to see which now have a different event scheduled::
266262
267263 >>> slot_diff = scheduler.slot_schedule_difference(schedule, alt_schedule)
268264 >>> for item in slot_diff:
269265 ... print(f"{item.slot.venue} at {item.slot.starts_at} will now host {item.new_event.name} rather than {item.old_event.name}" )
270- Big at 15-Sep-2016 09:30 will now host Talk 1 rather than Talk 4
271- Big at 15-Sep-2016 10:00 will now host Talk 4 rather than Talk 1
272- Big at 15-Sep-2016 12:30 will now host Talk 9 rather than Talk 8
273- Big at 15-Sep-2016 13:00 will now host Talk 12 rather than Talk 5
274- Big at 16-Sep-2016 09:30 will now host Talk 11 rather than Talk 3
275- Big at 16-Sep-2016 10:00 will now host Talk 10 rather than Talk 2
276- Big at 16-Sep-2016 12:30 will now host Talk 6 rather than Talk 11
277- Big at 16-Sep-2016 13:00 will now host Talk 7 rather than Talk 9
278- Small at 15-Sep-2016 09:30 will now host Talk 8 rather than Talk 7
279- Small at 15-Sep-2016 10:00 will now host Talk 5 rather than Talk 6
280- Small at 15-Sep-2016 12:30 will now host Talk 3 rather than Talk 12
281- Small at 15-Sep-2016 13:00 will now host Talk 2 rather than Talk 10
266+ Big at 15-Sep-2016 09:30 will now host Talk 9 rather than Talk 1
267+ Big at 15-Sep-2016 10:00 will now host Talk 5 rather than Talk 2
268+ Big at 15-Sep-2016 12:30 will now host Talk 4 rather than Talk 11
269+ Big at 15-Sep-2016 13:00 will now host Talk 6 rather than Talk 10
270+ Big at 16-Sep-2016 09:30 will now host Talk 2 rather than Talk 7
271+ Big at 16-Sep-2016 13:00 will now host Talk 11 rather than Talk 9
272+ Small at 15-Sep-2016 09:30 will now host Talk 1 rather than Talk 12
273+ Small at 15-Sep-2016 10:00 will now host Talk 10 rather than Talk 6
274+ Small at 15-Sep-2016 12:30 will now host Talk 7 rather than Talk 4
275+ Small at 15-Sep-2016 13:00 will now host Talk 12 rather than Talk 5
276+
282277
283278
284279We can use this facility to show how using :code: `number_of_changes ` as our objective function
@@ -287,8 +282,9 @@ resulted in far fewer changes::
287282 >>> event_diff = scheduler.event_schedule_difference(schedule, similar_schedule)
288283 >>> for item in event_diff:
289284 ... print(f"{item.event.name} has moved from {item.old_slot.venue} at {item.old_slot.starts_at} to {item.new_slot.venue} at {item.new_slot.starts_at}")
290- Talk 11 has moved from Big at 16-Sep-2016 12:30 to Small at 15-Sep-2016 12:30
291- Talk 12 has moved from Small at 15-Sep-2016 12:30 to Big at 16-Sep-2016 12:30
285+ Talk 11 has moved from Big at 15-Sep-2016 12:30 to Big at 16-Sep-2016 13:00
286+ Talk 9 has moved from Big at 16-Sep-2016 13:00 to Big at 15-Sep-2016 12:30
287+
292288
293289
294290Scheduling chairs
0 commit comments