fix: relax decimal resolution in constraint validation #731
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.
This PR fixes the following bug fix request by @Flix6x:
I have the below bug fix request for 0.14.1. Would you have time to take it up?
I'm also seeing this error in production. I'll probably reinstall
fm==0.13.3
for now.On inspection, line 191 has a comment preceding it with a todo. Let's first implement the todo. Secondly, upon printing the constraint_violations, I get (locally):
This leads me to believe we should relax the constraint validation by some margin. Perhaps the default margin should correspond to the margin we use for rounding schedules:
See the Scheduler class In data/models/planning/init.py:
round_to_decimals: Optional[int] = 6,
The workaround is to split the LHS, RHS and inequality sign into different arguments arguments of the
validate_constraint
function. Then, use that to evaluate each expressions, rounding it.