Skip to content

Commit

Permalink
get_node_path to get_path
Browse files Browse the repository at this point in the history
  • Loading branch information
THinnerichs committed Apr 16, 2024
1 parent b3fdd02 commit 2690e72
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/stochastic_iterator.jl
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ function Base.iterate(iter::StochasticSearchIterator, iterator_state::IteratorSt

# remove the rule node by substituting it with a hole of the same symbol
original_node = get(current_program, neighbourhood_node_location)
path = get_node_path(current_program, original_node)
path = get_path(current_program, original_node)
original_state = save_state!(solver)

remove_node!(solver, path)
Expand Down
6 changes: 3 additions & 3 deletions test/test_forbidden.jl
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ using HerbCore, HerbGrammar, HerbConstraints
RuleNode(1),
RuleNode(1)
]),
FixedShapedAbstractHole(BitVector((1, 1, 0, 0)), [])
UniformHole(BitVector((1, 1, 0, 0)), [])
]),
FixedShapedAbstractHole(BitVector((0, 0, 1, 1)), [
UniformHole(BitVector((0, 0, 1, 1)), [
RuleNode(3, [
RuleNode(1),
RuleNode(1)
Expand All @@ -82,7 +82,7 @@ using HerbCore, HerbGrammar, HerbConstraints
iter = BFSIterator(grammar, :Number, solver=solver)
new_state!(solver, partial_tree)
trees = collect(iter)
@test length(trees) == 3 # 3 out of the 4 combinations to fill the FixedShapedHoles are valid
@test length(trees) == 3 # 3 out of the 4 combinations to fill the UniformHole are valid
end

@testset "DomainRuleNode" begin
Expand Down
4 changes: 2 additions & 2 deletions test/test_sampling.jl
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,11 @@ using Random
end
for remaining_depth in 1:10

skeleton = AbstractHole(BitVector((true,true,true,true,true)))
skeleton = Hole(BitVector((true,true,true,true,true)))
rulenode = RuleNode(
5,[RuleNode(1), skeleton]
)
path_to_skeleton = get_node_path(rulenode,skeleton)
path_to_skeleton = get_path(rulenode,skeleton)
constraint = Contains(3)

addconstraint!(grammar, constraint)
Expand Down

0 comments on commit 2690e72

Please sign in to comment.