Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions smart_control/simulator/stochastic_occupancy.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,22 @@ def __init__(
random_state: np.random.RandomState,
time_zone: Union[datetime.tzinfo, str] = "UTC",
):
assert (
# Validate that the time bounds are in chronological order
if not (
earliest_expected_arrival_hour
< latest_expected_arrival_hour
< earliest_expected_departure_hour
< latest_expected_departure_hour
)
assert lunch_start_hour < lunch_end_hour
):
raise ValueError(
"Time bounds must be in chronological order i.e., "
"expected arrival/departure hours must be strictly increasing:" "earliest_expected_arrival_hour < latest_expected_arrival_hour "
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we want the second string on its own line, to avoid line-too-long errors.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's consider using more natural language in the error message, like "earliest expected arrival must come before latest expected arrival, earliest expected departure must come before latest expected departure", etc.

"< earliest_expected_departure_hour < latest_expected_departure_hour."
)

# Validate lunch time bounds
if lunch_start_hour >= lunch_end_hour:
raise ValueError("lunch_start_hour must be before lunch_end_hour.")

self._earliest_expected_arrival_hour = earliest_expected_arrival_hour
self._latest_expected_arrival_hour = latest_expected_arrival_hour
Expand Down
Loading