Solver: do not use a hint if its fuels are no longer valid #3848
+22
−8
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.
When recording a hint, we also store the fuels at which the query succeeded, so we can tr to replay it in that configuration. However, we are not checking that these fuels are still allowed in the current configuration, so if we stored a hint for a query that required large fuels, and then add
#set-options "--fuel 0 --ifuel 0"
at the top of the file, it will still pass. This is undesirable since, when the hint breaks, it will require significant debugging to find out what's wrong.This fixes by ignoring a hint when its recorded fuels are out of bounds. This is again a bit heuristic (e.g. if min/max fuels are 1/8 and we recorded a 5, the fuel-increasing logic will just try 1,2,4,8 whenever there is no hint), but I think will catch most common situations.
Note: the fuel settings are already included in the query hash string, so no change is needed there.
Thanks to @msprotz for noticing this.