Check LHS size before inserting into FDTree - #714
Open
wildsor wants to merge 1 commit into
Open
Conversation
wildsor
marked this pull request as ready for review
April 3, 2026 18:38
wildsor
commented
Apr 4, 2026
| result.ComparisonSuggestions().begin(), | ||
| result.ComparisonSuggestions().end()); | ||
| if (current_level_number_ >= fds_->GetNumAttributes()) { | ||
| if (current_level_number_ == max_lhs) { |
Collaborator
Author
There was a problem hiding this comment.
The invalidated FDs get removed during validation above
wildsor
force-pushed
the
hyfd-max-lhs
branch
2 times, most recently
from
July 12, 2026 15:50
dff1cab to
3e01d02
Compare
This helps cut runtime and memory if the max LHS option is specified. Before, FDs with LHSs that are too large were only removed at the point of result construction. The result is constructed by traversing an internal trie (FDTree). The trie has an invariant that no nodes corresponding to an FD that generalizes some other FD that is in the tree ever exist in it. This is achieved by checking for that condition before adding a new node. A FD with a larger LHS by definition never generalizes a FD with a smaller LHS. The only way FDs are added to the trie is by adding one new attribute to the LHS of a FD that was already in the trie. Thus, if we stop all FDs with LHSs beyond a certain size from being added, then the trie's invariant would still hold, and the FDs with LHSs that are too large would not end up in the trie (and in the answer). We will not miss any FDs with a smaller size either, because the checks for the FDs with smaller LHSs are not affected in any manner by the FDs with larger LHSs. The situation is exactly the same as in HyMD, and it's being done there already. I suspect it's true for all the Hy* algorithms too.
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.
Merging #798 first is preferred
This helps cut runtime and memory if the max LHS option is specified. Before, FDs with LHSs that are too large were only removed at the point of result construction.
The result is constructed by traversing an internal trie (FDTree). The trie has an invariant that no nodes corresponding to an FD that generalizes some other FD that is in the tree ever exist in it. This is achieved by checking for that condition before adding a new node.
A FD with a larger LHS by definition never generalizes a FD with a smaller LHS. The only way FDs are added to the trie is by adding one new attribute to the LHS of a FD that was already in the trie.
Thus, if we stop all FDs with LHSs beyond a certain size from being added, then the trie's invariant would still hold, and the FDs with LHSs that are too large would not end up in the trie (and in the answer).
We will not miss any FDs with a smaller size either, because the checks for the FDs with smaller LHSs are not affected in any manner by the FDs with larger LHSs.
The situation is exactly the same as in HyMD, and it's being done there already. I suspect it's true for all the Hy* algorithms too.