|
2 | 2 | from pathlib import Path |
3 | 3 |
|
4 | 4 | import click |
| 5 | +from conference_scheduler.scheduler import event_schedule_difference |
| 6 | +from conference_scheduler.converter import solution_to_schedule |
5 | 7 | from conference_scheduler.validator import ( |
6 | 8 | is_valid_solution, solution_violations) |
7 | 9 | import daiquiri |
@@ -65,10 +67,21 @@ def build(algorithm, objective, input_dir, solution_dir, build_dir): |
65 | 67 |
|
66 | 68 | kwargs = {} |
67 | 69 | if objective == 'consistency': |
68 | | - kwargs['original_solution'] = io.import_solution() |
| 70 | + original_solution = io.import_solution() |
| 71 | + defn.add_allocations(events, slots, original_solution, allocations) |
| 72 | + original_schedule = solution_to_schedule( |
| 73 | + original_solution, events, slots) |
| 74 | + kwargs['original_schedule'] = original_schedule |
69 | 75 |
|
70 | 76 | solution = calc.solution(events, slots, algorithm, objective, **kwargs) |
71 | 77 |
|
| 78 | + if objective == 'consistency': |
| 79 | + schedule = solution_to_schedule(solution, events, slots) |
| 80 | + event_diff = event_schedule_difference(schedule, original_schedule) |
| 81 | + logger.debug(f'\nevent_diff:') |
| 82 | + for item in event_diff: |
| 83 | + logger.debug(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}') |
| 84 | + |
72 | 85 | if solution is not None: |
73 | 86 | defn.add_allocations(events, slots, solution, allocations) |
74 | 87 | logger.debug(convert.schedule_to_text(solution, events, slots)) |
|
0 commit comments