Base.show
— MethodBase.show(io::IO, node::MatchNode; separator=",", last_child::Bool=true)
Prints a found MatchNode
given an and the respective children to IO
.
diff --git a/dev/HerbConstraints/index.html b/dev/HerbConstraints/index.html
index 2811cda..09deb43 100644
--- a/dev/HerbConstraints/index.html
+++ b/dev/HerbConstraints/index.html
@@ -18,4 +18,4 @@
forbidden_path([:addition, :one]) || forbidden_path([:one, :variable])
)
multiplication:: Element = Element * Element := (commutative, transitive)
-end Prints a found Prints a matching variable assignment described by Internal function for Internal function for Internal function for Internal function for Tries to match Matching Matches the Tries to match If the match is unsuccessful, it returns: Tries to match Matches two rulenodes. Returns how to fill in the hole in rn₁ to make it match rn₂ if: If the match fails, it returns whether it is a softfail or a hardfail (see MatchFail docstring) Adds a parent to the context. The parent is defined by the grammar rule id. Converts an annotation to a constraint. commutative: creates an Ordered constraint transitive: creates an (incorrect) Forbidden constraint forbidden_path(path::Vector{Union{Symbol, Int}}): creates a ForbiddenPath constraint with the original rule included ... || ...: creates a OneOf constraint (also works with ... || ... || ... et cetera, though not very performant) Checks if the given tree abides the constraint. Checks if the given Checks if the given tree abides the constraint. Checks if the given tree abides the constraint. Checks if the given tree abides the constraint. Checks if the given Checks if the given tree abides the constraint. Copies the given context and insert the parent in the node location. Filters the Converts a MatchNode tree into a Julia expression. This is primarily useful for pretty-printing a pattern. Returns the corresponding expression. Converts a MatchVar into an expression by returning the variable directly. This is primarily useful for pretty-printing a pattern. Propagates the The Propagates the Propagates the LocalOneOf constraint. It enforces that at least one of its given constraints hold. Propagates the LocalForbidden constraint. It removes rules from the domain that would make the RuleNode at the given path match the pattern defined by the MatchNode. Propagates the LocalOrdered constraint. It removes rules from the domain that would violate the order of variables as defined in the constraint. Propagates the OneOf constraint. It enforces that at least one of its given constraints hold. Propagates the The Propagates the RequireOnLeft constraint. It removes every element from the domain that does not have a necessary predecessor in the left subtree.Base.show
— MethodBase.show(io::IO, node::MatchNode; separator=",", last_child::Bool=true)
MatchNode
given an and the respective children to IO
. Base.show
— MethodBase.show(io::IO, node::MatchVar; separator=",", last_child::Bool=true)
MatchVar
to IO
.HerbConstraints._matchnode2expr
— Function_matchnode2expr(typ::Symbol, pattern::MatchVar, grammar::Grammar, j=0)
matchnode2expr
. This is primarily useful for pretty-printing a pattern. Returns the corresponding expression, i.e. the variable name and the current child index.HerbConstraints._matchnode2expr
— Function_matchnode2expr(expr::Expr, pattern::MatchVar, grammar::Grammar, j=0)
matchnode2expr
, recursively iterating over a matched variable and converting it to an expression. This is primarily useful for pretty-printing a pattern. Returns the corresponding expression and the current child index.HerbConstraints._matchnode2expr
— Function_matchnode2expr(expr::Expr, pattern::MatchNode, grammar::Grammar, j=0)
matchnode2expr
, recursively iterating over a matched pattern and converting it to an expression. This is primarily useful for pretty-printing a pattern. Returns the corresponding expression and the current child index.HerbConstraints._matchnode2expr
— Function_matchnode2expr(typ::Symbol, pattern::MatchNode, grammar::Grammar, j=0)
matchnode2expr
, returning the matched translated symbol. This is primarily useful for pretty-printing a pattern. Returns the corresponding expression, i.e. the variable name and the current child index.HerbConstraints._pattern_match
— Method_pattern_match(rn::RuleNode, mn::MatchNode, vars::Dict{Symbol, AbstractRuleNode})::Union{Nothing, MatchFail}
RuleNode
rn
with MatchNode
mn
. Modifies the variable assignment dictionary vars
. Returns nothing
if the match is successful. If the match is unsuccessful, it returns whether it is a softfail or hardfail (see MatchFail
docstring)HerbConstraints._pattern_match
— Method_pattern_match(rn::RuleNode, mv::MatchVar, vars::Dict{Symbol, AbstractRuleNode})::Union{Nothing, MatchFail}
RuleNode
rn
with MatchVar
mv
. If the variable is already assigned, the rulenode is matched with the specific variable value. Returns nothing
if the match is succesful. If the match is unsuccessful, it returns whether it is a softfail or hardfail (see MatchFail
docstring)HerbConstraints._pattern_match_with_hole
— MethodHerbConstraints._pattern_match_with_hole
— Method_pattern_match_with_hole(::Hole, mn::MatchNode, hole_location::Vector{Int}, ::Dict{Symbol, AbstractRuleNode})::Union{Int, Symbol, MatchFail, Tuple{Symbol, Vector{Int}}}
Hole
with the given MatchVar
, similar to _pattern_match_with_hole
.HerbConstraints._pattern_match_with_hole
— Method_pattern_match_with_hole(rn::RuleNode, mn::MatchNode, hole_location::Vector{Int}, vars::Dict{Symbol, AbstractRuleNode})::Union{Int, Symbol, MatchFail, Tuple{Symbol, Vector{Int}}}
RuleNode
rn
with MatchNode
mn
and fill in the domain of the hole at hole_location
. Returns if match is successful either:HerbConstraints._pattern_match_with_hole
— Method_pattern_match_with_hole(rn::RuleNode, mv::MatchVar, hole_location::Vector{Int}, vars::Dict{Symbol, AbstractRuleNode})::Union{Int, Symbol, MatchFail, Tuple{Symbol, Vector{Int}}}
RuleNode
rn
with MatchVar
mv
and fill in the domain of the hole at hole_location
. If the variable name is already assigned in vars
, the rulenode is matched with the hole. Otherwise the variable and the hole location are returned.HerbConstraints._rulenode_compare
— MethodHerbConstraints._rulenode_match_with_hole
— Method_rulenode_match_with_hole(rn₁::RuleNode, rn₂::RuleNode, hole_location::Vector{Int})::Union{Int, MatchFail}
HerbConstraints.addparent!
— Methodaddparent!(context::GrammarContext, parent::Int)
HerbConstraints.annotation2constraint
— MethodHerbConstraints.check_tree
— MethodHerbConstraints.check_tree
— Methodcheck_tree(c::Forbidden, g::Grammar, tree::RuleNode)::Bool
AbstractRuleNode
tree abides the Forbidden
constraint.HerbConstraints.check_tree
— MethodHerbConstraints.check_tree
— MethodHerbConstraints.check_tree
— MethodHerbConstraints.check_tree
— Methodcheck_tree(c::Ordered, g::Grammar, tree::RuleNode)::Bool
AbstractRuleNode
tree abides the Ordered
constraint.HerbConstraints.check_tree
— MethodHerbConstraints.copy_and_insert
— Methodcopy_and_insert(old_context::GrammarContext, parent::Int)
HerbConstraints.make_smaller_or_equal
— Methoddomain
of the hole at hole_location
in rn₁
to make rn₁
be ordered before rn₂
. Returns the filtered domain, and a boolean indicating if this constraint can be deleted.HerbConstraints.matchnode2expr
— Methodmatchnode2expr(pattern::MatchNode, grammar::Grammar)
HerbConstraints.matchnode2expr
— Methodmatchnode2expr(pattern::MatchVar, grammar::Grammar)
HerbConstraints.propagate
— Methodpropagate(c::Forbidden, g::Grammar, context::GrammarContext, domain::Vector{Int})::Tuple{Vector{Int}, Vector{LocalConstraint}}
Forbidden
constraint. It removes the rules from the domain
that would complete the forbidden tree.Forbidden
constraint makes use of LocalConstraint
s to make sure that constraints are also enforced in the future when the context of a Hole
changes. Therefore, Forbidden
can only be used in implementations that keep track of the LocalConstraint
s and propagate them at the right moments.HerbConstraints.propagate
— MethodForbiddenPath
constraint. It removes the elements from the domain that would complete the forbidden sequence.HerbConstraints.propagate
— MethodHerbConstraints.propagate
— MethodHerbConstraints.propagate
— MethodHerbConstraints.propagate
— MethodHerbConstraints.propagate
— Methodpropagate(c::Ordered, g::Grammar, context::GrammarContext, domain::Vector{Int})::Tuple{Vector{Int}, Vector{LocalConstraint}}
Ordered
constraint. Any rule that violates the order as defined by the contraint is removed from the domain
.Ordered
constraint makes use of LocalConstraint
s to make sure that constraints are also enforced in the future when the context of a Hole
changes. Therefore, Ordered
can only be used in implementations that keep track of the LocalConstraint
s and propagate them at the right moments.HerbConstraints.propagate
— Method
HerbConstraints.AbstractMatchNode
HerbConstraints.ComesAfter
HerbConstraints.ComesAfter
HerbConstraints.Forbidden
HerbConstraints.ForbiddenPath
HerbConstraints.GrammarContext
HerbConstraints.LocalConstraint
HerbConstraints.LocalForbidden
HerbConstraints.LocalOneOf
HerbConstraints.LocalOrdered
HerbConstraints.MatchFail
HerbConstraints.MatchNode
HerbConstraints.MatchVar
HerbConstraints.OneOf
HerbConstraints.Ordered
HerbConstraints.PropagatorConstraint
HerbConstraints.RequireOnLeft
HerbCore.AbstractRuleNode
HerbCore.Constraint
HerbCore.Grammar
HerbCore.Hole
HerbCore.HoleReference
HerbCore.RuleNode
HerbCore.RuleNode
HerbCore.RuleNode
HerbData.IOExample
HerbData.IOPExample
HerbData.Problem
HerbGrammar.ContextFreeGrammar
HerbGrammar.ContextSensitiveGrammar
HerbGrammar.NodeLoc
HerbGrammar.SymbolTable
HerbGrammar.SymbolTable
HerbSearch.ContextSensitivePriorityEnumerator
HerbSearch.ExpandFailureReason
HerbSearch.ExpressionIterator
HerbSearch.GeneticSearchIterator
HerbSearch.PriorityQueueItem
HerbSearch.PriorityQueueItem
HerbSearch.PropagateResult
HerbSearch.StochasticSearchEnumerator
Base.get
Base.insert!
Base.isless
Base.iterate
Base.iterate
Base.iterate
Base.iterate
Base.iterate
Base.length
Base.length
Base.rand
Base.rand
Base.rand
Base.show
Base.show
HerbConstraints._matchnode2expr
HerbConstraints._matchnode2expr
HerbConstraints._matchnode2expr
HerbConstraints._matchnode2expr
HerbConstraints._pattern_match
HerbConstraints._pattern_match
HerbConstraints._pattern_match_with_hole
HerbConstraints._pattern_match_with_hole
HerbConstraints._pattern_match_with_hole
HerbConstraints._pattern_match_with_hole
HerbConstraints._rulenode_compare
HerbConstraints._rulenode_match_with_hole
HerbConstraints.addparent!
HerbConstraints.annotation2constraint
HerbConstraints.check_tree
HerbConstraints.check_tree
HerbConstraints.check_tree
HerbConstraints.check_tree
HerbConstraints.check_tree
HerbConstraints.check_tree
HerbConstraints.check_tree
HerbConstraints.copy_and_insert
HerbConstraints.make_smaller_or_equal
HerbConstraints.matchnode2expr
HerbConstraints.matchnode2expr
HerbConstraints.propagate
HerbConstraints.propagate
HerbConstraints.propagate
HerbConstraints.propagate
HerbConstraints.propagate
HerbConstraints.propagate
HerbConstraints.propagate
HerbConstraints.propagate
HerbCore.contains_hole
HerbCore.depth
HerbCore.get_node_at_location
HerbCore.get_rulesequence
HerbCore.node_depth
HerbCore.rulesoftype
HerbCore.rulesonleft
HerbCore.swap_node
HerbCore.swap_node
HerbData.read_IOPexamples
HerbData.read_IOexamples
HerbData.readdata
HerbData.readfile
HerbData.write_IOPexamples
HerbData.write_IOexamples
HerbGrammar.add_rule!
HerbGrammar.addconstraint!
HerbGrammar.cfg2csg
HerbGrammar.child_types
HerbGrammar.child_types
HerbGrammar.cleanup_removed_rules!
HerbGrammar.clearconstraints!
HerbGrammar.containedin
HerbGrammar.contains_returntype
HerbGrammar.expr2cfgrammar
HerbGrammar.expr2csgrammar
HerbGrammar.expr2pcfgrammar
HerbGrammar.expr2pcsgrammar
HerbGrammar.get_childtypes
HerbGrammar.get_domain
HerbGrammar.get_domain
HerbGrammar.get_node_at_location
HerbGrammar.get_rulesequence
HerbGrammar.has_children
HerbGrammar.iscomplete
HerbGrammar.iseval
HerbGrammar.iseval
HerbGrammar.iseval
HerbGrammar.isprobabilistic
HerbGrammar.isterminal
HerbGrammar.isterminal
HerbGrammar.isterminal
HerbGrammar.isvariable
HerbGrammar.log_probability
HerbGrammar.max_arity
HerbGrammar.mindepth
HerbGrammar.mindepth_map
HerbGrammar.nchildren
HerbGrammar.nchildren
HerbGrammar.nonterminals
HerbGrammar.probability
HerbGrammar.read_cfg
HerbGrammar.read_csg
HerbGrammar.read_pcfg
HerbGrammar.read_pcsg
HerbGrammar.remove_rule!
HerbGrammar.return_type
HerbGrammar.return_type
HerbGrammar.root_node_loc
HerbGrammar.rulenode2expr
HerbGrammar.rulenode_log_probability
HerbGrammar.rulesoftype
HerbGrammar.rulesoftype
HerbGrammar.rulesoftype
HerbGrammar.rulesonleft
HerbGrammar.store_cfg
HerbGrammar.store_csg
HerbGrammar.subsequenceof
HerbGrammar.swap_node
HerbGrammar.swap_node
HerbInterpret.evaluate_program
HerbInterpret.execute_on_examples
HerbInterpret.interpret
HerbInterpret.test_all_examples
HerbInterpret.test_examples
HerbInterpret.test_with_input
HerbSearch._expand
HerbSearch._expand
HerbSearch._find_next_complete_tree
HerbSearch.best_accept
HerbSearch.calculate_cost
HerbSearch.const_temperature
HerbSearch.constructNeighbourhood
HerbSearch.constructNeighbourhoodRuleSubset
HerbSearch.count_expressions
HerbSearch.count_expressions
HerbSearch.crossover_swap_children_1
HerbSearch.crossover_swap_children_2
HerbSearch.decreasing_temperature
HerbSearch.default_error_function
HerbSearch.default_fitness
HerbSearch.enumerate_neighbours_propose
HerbSearch.get_best_program
HerbSearch.get_bfs_enumerator
HerbSearch.get_bfs_enumerator
HerbSearch.get_dfs_enumerator
HerbSearch.get_dfs_enumerator
HerbSearch.get_genetic_enumerator
HerbSearch.get_mh_enumerator
HerbSearch.get_most_likely_first_enumerator
HerbSearch.get_most_likely_first_enumerator
HerbSearch.get_sa_enumerator
HerbSearch.get_vlsn_enumerator
HerbSearch.heuristic_leftmost
HerbSearch.heuristic_random
HerbSearch.heuristic_rightmost
HerbSearch.heuristic_smallest_domain
HerbSearch.mean_squared_error
HerbSearch.misclassification
HerbSearch.most_likely_priority_function
HerbSearch.mse_error_function
HerbSearch.mutate_random!
HerbSearch.probabilistic_accept
HerbSearch.probabilistic_accept_with_temperature
HerbSearch.probabilistic_accept_with_temperature_fraction
HerbSearch.propagate_constraints
HerbSearch.random_fill_propose
HerbSearch.search
HerbSearch.search_best
HerbSearch.search_rulenode
HerbSearch.select_chromosome
HerbSearch.select_fitness_proportional_parents
HerbSearch.validate_iterator
StatsBase.sample
StatsBase.sample
StatsBase.sample
StatsBase.sample
HerbConstraints.@csgrammar_annotated
HerbGrammar.@cfgrammar
HerbGrammar.@csgrammar
HerbGrammar.@pcfgrammar
HerbGrammar.@pcsgrammar
Settings
This document was generated with Documenter.jl version 0.27.25 on Thursday 18 January 2024. Using Julia version 1.8.5.