Enhance model validation with maximum time horizon check #77
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.
Description
Warning
The check for maximum time horizon is technically breaking. The default configured maximum of 1 month (30 days) should not reject any inputs, as the validation only means to detect erroneous inputs.
However, if you are using nextroute for inputs > 1 month planning horizon, we urge you to configure
-model.properties.maximumtimehorizon
(given inint
seconds) to a sufficiently large value. E.g., set it to5184000
(60 * 24 * 60 * 60), if planning in a 60 day time horizon.Important
The limit was bumped to 6 months in a follow-up PR to mitigate impact on existing use-cases (#79 ).
Introduced a new option to specify a maximum time horizon for models and added validation to ensure the input data adheres to this constraint.
Changes
MaximumTimeHorizon
option inmodel.go
to specify the maximum time horizon for the model.-model.properties.maximumtimehorizon
option.2592000
s / 30 days.validateTimeHorizon
function invalidate.go
to check if the input data's time horizon exceeds the specified maximum.validate
function to include the time horizon validation step.