Repository navigation
Wrap the local time of day in the baseline schedule policy into 0 to 24 hours - #205
Open
burgulvedant wants to merge 1 commit into
Open
burgulvedant wants to merge 1 commit into
burgulvedant wants to merge 1 commit into
Conversation
Author
|
CI note: the failing check on this PR does not come from the change. The test (ubuntu-latest, 3.10.15) job fails at setup because Python 3.10.15 is not available on the Ubuntu 26.04 runner that ubuntu-latest now points to. The other three matrix jobs were then cancelled by the matrix fail fast. No tests ran, so the 8 new tests in schedule_policy_test.py have not been checked by CI yet. Happy to rebase or adjust once the workflow is fixed. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #201
The baseline SchedulePolicy builds its lookup time as Timedelta(hod) + local_start_time.utcoffset(), where hod is the UTC hour of day. At UTC-7 the UTC hours 0 to 6 give a negative time. No schedule event starts before 0, so get_active_setpoint falls back to the last event of the day, the 19:00 night setpoint. For two hours every evening (17:00 to 19:00 Pacific) the schedule uses night setpoints while the comfort window is still active.
This adds a small helper, local_schedule_time, that wraps the sum into 0 to 24 hours, and uses it in SchedulePolicy._get_action_map.
I added schedule_policy_test.py with 8 tests: the wrap itself (negative offset, no wrap, local midnight, positive offset) and the day and night setpoint at UTC hours 0, 1, 2, 6, 7, 13 and 23 at UTC-7. Three of them fail without the wrap.
Not covered here: the offset is read once from the start time, so daylight saving changes during a run are not handled. That is a separate issue.
How I tested: I could not install the full TensorFlow 2.15 environment on my machine (Python 3.14), so I ran the new tests locally with the tf_agents and tensorflow imports stubbed out. They pass. The full pytest run on Python 3.10 and 3.11 will be done by CI.