Uh oh!
There was an error while loading. Please reload this page.
Refactor Real Life Challenges simulator - #373
Draft
j-atkins wants to merge 30 commits into
Draft
Conversation
…m core checkpoint model, move away from reliance on problem-specific tracking via json tmp files
…m core checkpoint model, move away from reliance on problem-specific tracking via json tmp files
…e single source of truth for resolved status
… allow None type wp_i
…lship into refactor-problem-sim
9 tasks
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 freeto 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.
Summary of Changes
This PR refactors the problems/Real Life Challenges simulation module, execution loop, and checkpoint verification logic. Primary objectives are:
ScheduledProblemandActiveProblemobjects as the single source of truth for problem states and resolution.ProblemSimulatorclass rather than spreading the logic across_run.py.Checkpointverification checks, whereas before there was too much problems module associated logic handled byCheckpoint.Portwaypoints (see Timedeltas and arrival/departure ports from MFP export #372) when communicating waypoint numbers to the user via a new helper utility_get_public_wp()_run.py: more helper functions, clean up.Detailed Changes
problems/simulator.py
ScheduledProblemdataclass (pairs a problem with its waypoint index and resolution state) andSelectedProblemsdataclass as a container for managing problem states and iteration through problems.execute_for_instrument(),verify_problem_resolution(), andcreate_post_expedition_report()methods directly toProblemSimulator._get_public_wp().problem_<hash>.jsonfiles per problem occurrence. Replaced with structured caching ofSelectedProblemsin theProblemSimulator._run.py
_run()function by extracting steps into helper methods.ProblemSimulator.checkpoint.py
ActiveProblemto track runtime problem states (delay duration, problem waypoint index, and resolution status).Checkpoint.verify()intoverify_past_schedule(), focusing solely on ensuring past waypoints are untouched and decoupling from problems logic.expedition.py & utils.py
_get_public_wp()inutils.pyto translate raw/internal schedules into user-facing waypoint numbers. Helps ensure consistency and over-reliance on plus-one indexing in all cases.expedition.pyto use public waypoint numbers correctly.Closes#283, closes#303