Skip to content

Commit 77537cd

Browse files
committed
Add diff option
1 parent f7d4be8 commit 77537cd

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/scheduler/cli.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,15 @@ def scheduler(verbosity):
3636
'--objective', '-o', default=None,
3737
type=click.Choice(['efficiency', 'equity', 'consistency']),
3838
help='Objective Function')
39+
@click.option('--diff/--no-diff', default=False, help='Show schedule diff')
3940
@click.option(
4041
'--input_dir', '-i', default=None, help='Directory for input files')
4142
@click.option(
4243
'--solution_dir', '-s', default=None, help='Directory for solution files')
4344
@click.option(
4445
'--build_dir', '-b', default=None, help='Directory for output yaml files')
4546
@timed
46-
def build(algorithm, objective, input_dir, solution_dir, build_dir):
47+
def build(algorithm, objective, diff, input_dir, solution_dir, build_dir):
4748
if input_dir:
4849
session.folders['input'] = Path(input_dir)
4950

@@ -66,16 +67,19 @@ def build(algorithm, objective, input_dir, solution_dir, build_dir):
6667
defn.add_unsuitability_to_events(events, slots, unsuitability)
6768

6869
kwargs = {}
69-
if objective == 'consistency':
70+
if objective == 'consistency' or diff:
7071
original_solution = io.import_solution()
7172
defn.add_allocations(events, slots, original_solution, allocations)
7273
original_schedule = solution_to_schedule(
7374
original_solution, events, slots)
75+
76+
if objective == 'consistency':
77+
diff = True
7478
kwargs['original_schedule'] = original_schedule
7579

7680
solution = calc.solution(events, slots, algorithm, objective, **kwargs)
7781

78-
if objective == 'consistency':
82+
if diff:
7983
schedule = solution_to_schedule(solution, events, slots)
8084
event_diff = event_schedule_difference(schedule, original_schedule)
8185
logger.debug(f'\nevent_diff:')

0 commit comments

Comments
 (0)