-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Constraint propagation solver and new hole types (4 PRs) #25
Conversation
…h_with_hole`, and `_rulenode_match` with `pattern_match`
@@ -0,0 +1,56 @@ | |||
""" | |||
Forbidden <: GrammarConstraint |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is not clear from the naming what Forbidden actually is. Maybe rename to ForbiddenConstraint
?
src/solver/solver.jl
Outdated
|
||
|
||
""" | ||
Solver(grammar::Grammar, sym::Symbol) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not add with_statistics
to docs?
track!(solver.statistics, "schedule!") | ||
track!(solver.statistics, "schedule! $(typeof(constraint))") | ||
if constraint ∉ keys(solver.schedule) | ||
enqueue!(solver.schedule, constraint, 99) #TODO: replace `99` with `get_priority(c)` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to fix this asap before the hackathon.
end | ||
|
||
#TODO: remove the scope of `HerbCore`? | ||
function HerbCore.get_node_at_location(solver::Solver, location::Vector{Int})::AbstractRuleNode |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's keep this, as it provides some module separation.
src/solver/solver.jl
Outdated
empty!(dict[event_path]) | ||
end | ||
end | ||
# Always propagate all constraints: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove comments.
include("test_treemanipulations.jl") | ||
include("test_varnode.jl") | ||
include("test_pattern_match.jl") | ||
#include("test_pattern_match_edgecases.jl") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should re-include this in the hackathon.
Large PR involving 4 repositories:
HerbSearch
@solverHerbConstraints
@solverHerbCore
@holes-typesHerbGrammar
@holes-types (small changes)On these respective branches, I am worked on two new major components:
A constraint propagation solver
New hole types
I am replacing
propagate_constraints
with a new constraintSolver
struct. The goal is to increase the inference of constraint propagators while reducing the number of propagations needed. Currently constraint solving is integrated in the top down iterator, but the new solver should also be compatible with any type of program iterator. This means that all program iterators should be rewritten to be compatible with the constraint solver. The idea is that iterators must manipulate program trees through the solver’s API so the propagation of the constraints can happen under the hood. For example:Hole
struct will be split up into two new concrete hole structs:FixedShapedHole
andVariableShapedHole
. The main difference between these two structs is that the domain of a fixed shaped hole contains only rules of exactly the same child types (e.g.A -> A + B
andA -> A * B
have the same childtypes.A -> A + A
has different childtypes). The advantage of fixed shaped holes is that child nodes can already be instantiated before the concrete rule of the parent is known. This reduces the amount of trees that need to be stored in memory and can be exploited for stronger inference during constraint propagation.