Skip to content
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

FixedShapedSolver #29

Merged
merged 49 commits into from
Apr 3, 2024
Merged

FixedShapedSolver #29

merged 49 commits into from
Apr 3, 2024

Conversation

Whebon
Copy link
Contributor

@Whebon Whebon commented Mar 28, 2024

Adds two types of solvers:

  • FixedShapedSolver. This solver is more memory efficient, but only works on fixed shaped trees. It enumerates all solutions of a fixed shaped tree by (re)assigning the values of holes. To achieve this, it uses a new fixed shaped hole type with stateful domains.
  • GenericSolver. This solver has more flexible state management. It treats each state as an independent propagation program. Iterators can use save_state! and load_state! to switch between states at any time.

…h_with_hole`, and `_rulenode_match` with `pattern_match`
@Whebon Whebon requested a review from THinnerichs March 28, 2024 19:29
@THinnerichs
Copy link
Member

When runnning the tests, I get

Warning: `top` is deprecated, use `first` instead.
│   caller = next_solution!(solver::FixedShapedSolver) at fixed_shaped_solver.jl:284
└ @ HerbConstraints ~/.julia/dev/HerbConstraints/src/solver/fixed_shaped_solver/fixed_shaped_solver.jl:284

@THinnerichs
Copy link
Member

We agreed to merge for now, as everything seems to work fine and tests are very thorough. I'll try to do a more in-depth review of the 4500 added lines during the Hackathon.

@THinnerichs THinnerichs merged commit 3dd9dce into dev Apr 3, 2024
0 of 2 checks passed
@@ -38,7 +38,7 @@ end
```
"""
macro csgrammar_annotated(expression)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is still necessary?

Contains <: GrammarConstraint
This [`GrammarConstraint`] enforces that a given `rule` appears in the program tree at least once.
"""
struct Contains <: GrammarConstraint
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Contains is a verb and should hence not be used as a struct name; also not very descriptive. Better use ContainsConstraint

src/HerbConstraints.jl Show resolved Hide resolved
src/HerbConstraints.jl Show resolved Hide resolved
Therefore, [`Forbidden`](@ref) can only be used in implementations that keep track of the
[`LocalConstraint`](@ref)s and propagate them at the right moments.
"""
struct Forbidden <: GrammarConstraint
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Name is a Verb, hence sub-optimal for struct name. Better use ForbiddenConstraint

src/grammarconstraints/forbidden.jl Show resolved Hide resolved
src/solver/generic_solver/state.jl Show resolved Hide resolved
test/test_contains.jl Show resolved Hide resolved
test/test_domain_utils.jl Show resolved Hide resolved
test/test_pattern_match.jl Show resolved Hide resolved
@THinnerichs THinnerichs deleted the dfs-solver branch July 15, 2024 10:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants