HerbConstraints.jl Documentation
HerbConstraints.AbstractGrammarConstraint
— Typeabstract type AbstractGrammarConstraint <: AbstractConstraint
Abstract type representing all user-defined constraints. Each grammar constraint has a related AbstractLocalConstraint that is responsible for propagating the constraint at a specific location in the tree. Grammar constraints should implement on_new_node
to post a AbstractLocalConstraint
at that new node
HerbConstraints.AbstractLocalConstraint
— Typeabstract type AbstractLocalConstraint <: AbstractConstraint
Abstract type representing all local constraints. Each local constraint contains a path
that points to a specific location in the tree at which the constraint applies.
Each local constraint should implement a propagate!
-function. Inside the propagate!
function, the constraint can use the following solver functions:
remove!
: Elementary tree manipulation. Removes a value from a domain. (other tree manipulations are:remove_above!
,remove_below!
,remove_all_but!
)deactivate!
: Prevent repropagation. Call this as soon as the constraint is satisfied.set_infeasible!
: Report a non-trivial inconsistency. Call this if the constraint can never be satisfied. An empty domain is considered a trivial inconsistency, such inconsistencies are already handled by tree manipulations.isfeasible
: Check if the current tree is still feasible. Return from the propagate function, as soon as infeasibility is detected.
HerbConstraints.AbstractStateManager
— TypeManages all changes made to StateInts using StateIntBackups. Support the following functions:
StateInt
Creates a new stateful integersave_state!
Creates a checkpoint for all stateful integersrestore!
Restores the values to the latest checkpoint
HerbConstraints.Contains
— TypeContains <: AbstractGrammarConstraint This [AbstractGrammarConstraint
] enforces that a given rule
appears in the program tree at least once.
HerbConstraints.ContainsSubtree
— TypeContainsSubtree <: AbstractGrammarConstraint
This [AbstractGrammarConstraint
] enforces that a given subtree
appears in the program tree at least once.
!!! warning: This constraint can only be propagated by the UniformSolver
HerbConstraints.DomainRuleNode
— Typestruct DomainRuleNode <: AbstractRuleNode
Matches any 1 rule in its domain. Example usage:
DomainRuleNode(Bitvector((0, 0, 1, 1)), [RuleNode(1), RuleNode(1)])
This matches RuleNode(3, [RuleNode(1), RuleNode(1)])
and RuleNode(4, [RuleNode(1), RuleNode(1)])
and UniformHole({3, 4}, [RuleNode(1), RuleNode(1)])
HerbConstraints.Forbidden
— TypeForbidden <: AbstractGrammarConstraint
This [AbstractGrammarConstraint
] forbids any subtree that matches the pattern given by tree
to be generated. A pattern is a tree of AbstractRuleNode
s. Such a node can either be a RuleNode
, which contains a rule index corresponding to the rule index in the AbstractGrammar
and the appropriate number of children, similar to RuleNode
s. It can also contain a VarNode
, which contains a single identifier symbol. A VarNode
can match any subtree, but if there are multiple instances of the same variable in the pattern, the matched subtrees must be identical. Any rule in the domain that makes the match attempt successful is removed.
For example, consider the tree 1(a, 2(b, 3(c, 4))))
:
Forbidden(RuleNode(3, [RuleNode(5), RuleNode(4)]))
forbidsc
to be filled with5
.Forbidden(RuleNode(3, [VarNode(:v), RuleNode(4)]))
forbidsc
to be filled, since a [VarNode
] can match any rule, thus making the match attempt successful for the entire domain ofc
. Therefore, this tree invalid.Forbidden(RuleNode(3, [VarNode(:v), VarNode(:v)]))
forbidsc
to be filled with4
, since that would make both assignments tov
equal, which causes a successful match.
HerbConstraints.ForbiddenSequence
— TypeForbiddenPath <: AbstractGrammarConstraint
This [AbstractGrammarConstraint
] forbids the given sequence
of rule nodes. Sequences are strictly vertical and may include gaps. Consider the tree 1(a, 2(b, 3(c, d))))
:
[2, 3, d]
is a sequence[1, 3, d]
is a sequence[3, c, d]
is not a sequence
Examples:
ForbiddenSequence([3, 4])
enforces that rule4
cannot be applied atc
ord
.ForbiddenSequence([1, 2, 4])
enforces that rule4
cannot be applied atb
,c
ord
.ForbiddenSequence([1, 4])
enforces that rule4
cannot be applied anywhere.
If any of the rules in ignore_if
appears in the sequence, the constraint is ignored. Suppose the forbidden sequence = [1, 2, 3]
and ignore_if = [99]
Consider the following paths from the root:
[1, 2, 2, 3]
is forbidden, as the sequence does not contain99
[1, 99, 2, 3]
is NOT forbidden, as the sequence does contain99
[1, 99, 1, 2, 3]
is forbidden, as there is a subsequence that does not contain99
HerbConstraints.GenericSolver
— TypeGenericSolver
Maintains a feasible partial program in a SolverState
. A ProgramIterator
may manipulate the partial tree with the following tree manipulations:
substitute!
remove!
remove_below!
remove_above!
remove_all_but!
Each SolverState
holds an independent propagation program. Program iterators can freely move back and forth between states using:
new_state!
save_state!
load_state!
HerbConstraints.GenericSolver
— MethodGenericSolver(grammar::AbstractGrammar, init_node::AbstractRuleNode)
Constructs a new solver, with an initial state of the provided AbstractRuleNode
.
HerbConstraints.GenericSolver
— MethodGenericSolver(grammar::AbstractGrammar, sym::Symbol)
Constructs a new solver, with an initial state using starting symbol sym
HerbConstraints.LessThanOrEqualHardFail
— Typestruct LessThanOrEqualHardFail <: LessThanOrEqualResult end
node1
> node2
is guaranteed under all possible assignments of the holes involved.
HerbConstraints.LessThanOrEqualResult
— Typeabstract type LessThanOrEqualResult end
A result of the less_than_or_equal
function. Can be one of 3 cases:
HerbConstraints.LessThanOrEqualSoftFail
— Typestruct LessThanOrEqualSoftFail <: LessThanOrEqualResult
node1
<= node2
and node1
> node2
are both possible depending on the assignment of hole1
and hole2
. Includes two cases:
- hole2::AbstractHole: A failed
AbstractHole
-AbstractHole
comparison. (e.g. AbstractHole(BitVector((1, 0, 1))) vs AbstractHole(BitVector((0, 1, 1)))) - hole2::Nothing: A failed
AbstractHole
-RuleNode
comparison. (e.g. AbstractHole(BitVector((1, 0, 1))) vs RuleNode(2))
HerbConstraints.LessThanOrEqualSuccess
— Typeabstract type LessThanOrEqualSuccess <: LessThanOrEqualResult
node1
<= node2
is guaranteed under all possible assignments of the holes involved. The strictness of a LessThanOrEqualSuccess is specified by 1 of 2 concrete cases:
LessThanOrEqualSuccessLessThan
:node1
<node2
LessThanOrEqualSuccessEquality
:node1
==node2
LessThanOrEqualSuccessWithHoles
:node1
<=node2
. Unable to specific.
HerbConstraints.LessThanOrEqualSuccessEquality
— Typestruct LessThanOrEqualSuccessEquality <: LessThanOrEqualSuccess end
node1
== node2
is guaranteed under all possible assignments of the holes involved.
HerbConstraints.LessThanOrEqualSuccessLessThan
— Typestruct LessThanOrEqualSuccessEquality <: LessThanOrEqualSuccess end
node1
< node2
is guaranteed under all possible assignments of the holes involved.
HerbConstraints.LessThanOrEqualSuccessWithHoles
— Typestruct LessThanOrEqualSuccessWithHoles <: LessThanOrEqualSuccess end
node1
<= node2
is guaranteed under all possible assignments of the holes involved. Because of the holes involved, it is not possible to specify '<' or '=='.
HerbConstraints.LocalContains
— TypeLocalContains
Enforces that a given rule
appears at or below the given path
at least once.
HerbConstraints.LocalContainsSubtree
— TypeLocalContains
Enforces that a given tree
appears at or below the given path
at least once.
!!! warning: This is a stateful constraint can only be propagated by the UniformSolver. The indices
and candidates
fields should not be set by the user.
HerbConstraints.LocalContainsSubtree
— MethodLocalContainsSubtree(path::Vector{Int}, tree::AbstractRuleNode)
Enforces that a given tree
appears at or below the given path
at least once.
HerbConstraints.LocalForbidden
— TypeLocalForbidden
Forbids the a subtree that matches the tree
to be generated at the location provided by the path. Use a Forbidden
constraint for enforcing this throughout the entire search space.
HerbConstraints.LocalForbiddenSequence
— TypeLocalForbiddenSequence <: AbstractLocalConstraint
Forbids the given sequence
of rule nodes ending at the node at the path
. If any of the rules in ignore_if
appears in the sequence, the constraint is ignored.
HerbConstraints.LocalOrdered
— TypeEnforces an order over two or more subtrees that fill the variables specified in order
when the pattern is applied at the location given by path
. Use an Ordered
constraint for enforcing this throughout the entire search space.
HerbConstraints.LocalUnique
— TypeLocalUnique <: AbstractLocalConstraint
Enforces that a given rule
appears at or below the given path
at most once. In case of the UniformSolver, cache the list of holes
, since no new holes can appear.
HerbConstraints.MakeEqualHardFail
— Typestruct MakeEqualHardFail <: MakeEqualResult end
node1
!= node2
is guaranteed under all possible assignments of the holes involved.
HerbConstraints.MakeEqualResult
— Typeabstract type MakeEqualResult end
A result of the make_equal!
function. Can be one of 3 cases:
HerbConstraints.MakeEqualSoftFail
— Typestruct MakeEqualSoftFail <: MakeEqualResult end
Making node1
== node2
is ambiguous. Examples:
RuleNode(1, [Hole({1, 2, 3})]) == RuleNode(1, [VarNode(:a)])
. The hole can be filled with any rule.Hole({1, 2, 3}) == DomainRuleNode({1, 2, 3})
. The hole can be filled with any rule.
HerbConstraints.MakeEqualSuccess
— Typestruct MakeEqualSuccess <: MakeEqualResult end
node1
== node2
is guaranteed under all possible assignments of the holes involved.
HerbConstraints.Ordered
— TypeOrdered <: AbstractGrammarConstraint
A AbstractGrammarConstraint
that enforces a specific order in MatchVar
assignments in the pattern defined by tree
. Nodes in the pattern can either be a RuleNode
, which contains a rule index corresponding to the rule index in the AbstractGrammar
and the appropriate number of children. It can also contain a VarNode
, which contains a single identifier symbol. A VarNode
can match any subtree. If there are multiple instances of the same variable in the pattern, the matched subtrees must be identical.
The order
defines an order between the variable assignments. For example, if the order is [x, y]
, the constraint will require the assignment to x
to be less than or equal to the assignment to y
. The order is recursively defined by RuleNode
indices. For more information, see Base.isless(rn₁::AbstractRuleNode, rn₂::AbstractRuleNode)
.
For example, consider the tree 1(a, 2(b, 3(c, 4))))
:
Ordered(RuleNode(3, [VarNode(:v), VarNode(:w)]), [:v, :w])
removes every rule with an index of 5 or greater from the domain ofc
, since that would make the index of the assignment tov
greater than the index of the assignment tow
, violating the order.Ordered(RuleNode(3, [VarNode(:v), VarNode(:w)]), [:w, :v])
removes every rule with an index of 4 or less from the domain ofc
, since that would make the index of the assignment tov
less than the index of the assignment tow
, violating the order.
HerbConstraints.PatternMatchHardFail
— TypeThe pattern is not matched and can never be matched by filling in holes
HerbConstraints.PatternMatchResult
— Typeabstract type PatternMatchResult end
A result of the pattern_match
function. Can be one of 4 cases:
HerbConstraints.PatternMatchSoftFail
— TypeThe pattern can still be matched in a non-trivial way. Includes two cases:
- multiple holes are involved. this result stores a reference to one of them
- a single hole is involved, but needs to be filled with a node of size >= 2
HerbConstraints.PatternMatchSuccess
— TypeThe pattern is exactly matched and does not involve any holes at all
HerbConstraints.PatternMatchSuccessWhenHoleAssignedTo
— TypeThe pattern can be matched when the hole
is filled with any of the given ind
(s).
HerbConstraints.Solver
— Typeabstract type Solver
Abstract constraint solver. Each solver should have at least the following fields:
statistics::SolverStatistics
fix_point_running::Bool
schedule::PriorityQueue{AbstractLocalConstraint, Int}
Each solver should implement at least:
post!
get_tree
get_grammar
set_infeasible!
isfeasible
HerbCore.get_node_at_location
get_hole_at_location
notify_tree_manipulation
deactivate!
HerbConstraints.SolverState
— Typemutable struct SolverState
A state to be solved by the GenericSolver
. A state contains of:
tree
: A partial ASTactive_constraints
: The local constraints that apply to this tree. These constraints are enforced each time the tree is modified.isfeasible
: Flag to indicate if this state is still feasible. When a propagator spots an inconsistency, this field will be set to false. Tree manipulations and further propagations are not allowed on infeasible states
HerbConstraints.SolverStatistics
— TypeTemporary struct to track!
the number of several function calls centered around the Solver
HerbConstraints.StateHole
— TypeStateHole <: AbstractUniformHole
StateHole
s are uniform holes used by the UniformSolver
. Domain manipulations are tracked for backpropagation.
domain
: AStateSparseSet
representing the rule nodes this hole can take. If size(domain) == 1, this hole should act like aRuleNode
children
: The children of this hole in the expression tree.
HerbConstraints.StateHole
— MethodHerbConstraints.StateHole
— MethodConverts a UniformHole
to a StateHole
HerbConstraints.StateInt
— TypeStateful integer that can be saved and restored by the StateManager
. Supports the following functions:
get_value
set_value!
increment!
decrement!
HerbConstraints.StateIntBackup
— TypeBackup entry for the given StateInt
HerbConstraints.StateManager
— TypeManages all changes made to StateInts using StateIntBackups
HerbConstraints.StateSparseSet
— MethodConverts a BitVector domain representation to a StateSparseSet Example:
set = StateSparseSet(sm, BitVector((1, 1, 0, 0, 1, 0, 0))) #{1, 2, 5}
HerbConstraints.StateSparseSet
— MethodCreate a new StateSparseSet
with values [1, 2, ..., n]
HerbConstraints.StateStack
— TypeSimple stack that can only increase in size. Supports backtracking by decreasing the size to the saved size.
HerbConstraints.StateStack
— Methodfunction StateStack{T}(sm::AbstractStateManager) where T
Create an empty StateStack supporting elements of type T
HerbConstraints.StateStack
— Methodfunction StateStack{T}(sm::AbstractStateManager, vec::Vector{T}) where T
Create a StateStack for the provided vec
HerbConstraints.UniformSolver
— TypeA DFS-based solver that uses StateHole
s that support backtracking.
HerbConstraints.UniformSolver
— MethodUniformSolver(grammar::AbstractGrammar, fixed_shaped_tree::AbstractRuleNode)
HerbConstraints.Unique
— TypeUnique <: AbstractGrammarConstraint
This [AbstractGrammarConstraint
] enforces that a given rule
appears in the program tree at most once.
HerbConstraints.VarNode
— Typestruct VarNode <: AbstractRuleNode
Matches any subtree and assigns it to a variable name. The LocalForbidden
constraint will not match if identical variable symbols match to different trees. Example usage:
RuleNode(3, [VarNode(:x), VarNode(:x)])
This matches RuleNode(3, [RuleNode(1), RuleNode(1)])
, RuleNode(3, [RuleNode(2), RuleNode(2)])
, etc. but also larger subtrees such as RuleNode(3, [RuleNode(4, [RuleNode(1)]), RuleNode(4, [RuleNode(1)])])
HerbConstraints.@csgrammar_annotated
— Macro@csgrammar_annotated Define an annotated grammar and return it as a ContextSensitiveGrammar. Allows for adding optional annotations per rule. As well as that, allows for adding optional labels per rule, which can be referenced in annotations. Syntax is backwards-compatible with @csgrammar. Examples:
g₁ = @csgrammar_annotated begin
+HerbConstraints.jl · Herb.jl HerbConstraints.jl Documentation
HerbConstraints.AbstractGrammarConstraint
— Typeabstract type AbstractGrammarConstraint <: AbstractConstraint
Abstract type representing all user-defined constraints. Each grammar constraint has a related AbstractLocalConstraint that is responsible for propagating the constraint at a specific location in the tree. Grammar constraints should implement on_new_node
to post a AbstractLocalConstraint
at that new node
sourceHerbConstraints.AbstractLocalConstraint
— Typeabstract type AbstractLocalConstraint <: AbstractConstraint
Abstract type representing all local constraints. Each local constraint contains a path
that points to a specific location in the tree at which the constraint applies.
Each local constraint should implement a propagate!
-function. Inside the propagate!
function, the constraint can use the following solver functions:
remove!
: Elementary tree manipulation. Removes a value from a domain. (other tree manipulations are: remove_above!
, remove_below!
, remove_all_but!
)deactivate!
: Prevent repropagation. Call this as soon as the constraint is satisfied.set_infeasible!
: Report a non-trivial inconsistency. Call this if the constraint can never be satisfied. An empty domain is considered a trivial inconsistency, such inconsistencies are already handled by tree manipulations.isfeasible
: Check if the current tree is still feasible. Return from the propagate function, as soon as infeasibility is detected.
sourceHerbConstraints.AbstractStateManager
— TypeManages all changes made to StateInts using StateIntBackups. Support the following functions:
StateInt
Creates a new stateful integersave_state!
Creates a checkpoint for all stateful integersrestore!
Restores the values to the latest checkpoint
sourceHerbConstraints.Contains
— TypeContains <: AbstractGrammarConstraint This [AbstractGrammarConstraint
] enforces that a given rule
appears in the program tree at least once.
sourceHerbConstraints.ContainsSubtree
— TypeContainsSubtree <: AbstractGrammarConstraint
This [AbstractGrammarConstraint
] enforces that a given subtree
appears in the program tree at least once.
!!! warning: This constraint can only be propagated by the UniformSolver
sourceHerbConstraints.DomainRuleNode
— Typestruct DomainRuleNode <: AbstractRuleNode
Matches any 1 rule in its domain. Example usage:
DomainRuleNode(Bitvector((0, 0, 1, 1)), [RuleNode(1), RuleNode(1)])
This matches RuleNode(3, [RuleNode(1), RuleNode(1)])
and RuleNode(4, [RuleNode(1), RuleNode(1)])
and UniformHole({3, 4}, [RuleNode(1), RuleNode(1)])
sourceHerbConstraints.Forbidden
— TypeForbidden <: AbstractGrammarConstraint
This [AbstractGrammarConstraint
] forbids any subtree that matches the pattern given by tree
to be generated. A pattern is a tree of AbstractRuleNode
s. Such a node can either be a RuleNode
, which contains a rule index corresponding to the rule index in the AbstractGrammar
and the appropriate number of children, similar to RuleNode
s. It can also contain a VarNode
, which contains a single identifier symbol. A VarNode
can match any subtree, but if there are multiple instances of the same variable in the pattern, the matched subtrees must be identical. Any rule in the domain that makes the match attempt successful is removed.
For example, consider the tree 1(a, 2(b, 3(c, 4))))
:
Forbidden(RuleNode(3, [RuleNode(5), RuleNode(4)]))
forbids c
to be filled with 5
.Forbidden(RuleNode(3, [VarNode(:v), RuleNode(4)]))
forbids c
to be filled, since a [VarNode
] can match any rule, thus making the match attempt successful for the entire domain of c
. Therefore, this tree invalid.Forbidden(RuleNode(3, [VarNode(:v), VarNode(:v)]))
forbids c
to be filled with 4
, since that would make both assignments to v
equal, which causes a successful match.
sourceHerbConstraints.ForbiddenSequence
— TypeForbiddenPath <: AbstractGrammarConstraint
This [AbstractGrammarConstraint
] forbids the given sequence
of rule nodes. Sequences are strictly vertical and may include gaps. Consider the tree 1(a, 2(b, 3(c, d))))
:
[2, 3, d]
is a sequence[1, 3, d]
is a sequence[3, c, d]
is not a sequence
Examples:
ForbiddenSequence([3, 4])
enforces that rule 4
cannot be applied at c
or d
.ForbiddenSequence([1, 2, 4])
enforces that rule 4
cannot be applied at b
, c
or d
.ForbiddenSequence([1, 4])
enforces that rule 4
cannot be applied anywhere.
If any of the rules in ignore_if
appears in the sequence, the constraint is ignored. Suppose the forbidden sequence = [1, 2, 3]
and ignore_if = [99]
Consider the following paths from the root:
[1, 2, 2, 3]
is forbidden, as the sequence does not contain 99
[1, 99, 2, 3]
is NOT forbidden, as the sequence does contain 99
[1, 99, 1, 2, 3]
is forbidden, as there is a subsequence that does not contain 99
sourceHerbConstraints.GenericSolver
— TypeGenericSolver
Maintains a feasible partial program in a SolverState
. A ProgramIterator
may manipulate the partial tree with the following tree manipulations:
substitute!
remove!
remove_below!
remove_above!
remove_all_but!
Each SolverState
holds an independent propagation program. Program iterators can freely move back and forth between states using:
new_state!
save_state!
load_state!
sourceHerbConstraints.GenericSolver
— MethodGenericSolver(grammar::AbstractGrammar, init_node::AbstractRuleNode)
Constructs a new solver, with an initial state of the provided AbstractRuleNode
.
sourceHerbConstraints.GenericSolver
— MethodGenericSolver(grammar::AbstractGrammar, sym::Symbol)
Constructs a new solver, with an initial state using starting symbol sym
sourceHerbConstraints.LessThanOrEqualHardFail
— Typestruct LessThanOrEqualHardFail <: LessThanOrEqualResult end
node1
> node2
is guaranteed under all possible assignments of the holes involved.
sourceHerbConstraints.LessThanOrEqualResult
— Typeabstract type LessThanOrEqualResult end
A result of the less_than_or_equal
function. Can be one of 3 cases:
sourceHerbConstraints.LessThanOrEqualSoftFail
— Typestruct LessThanOrEqualSoftFail <: LessThanOrEqualResult
node1
<= node2
and node1
> node2
are both possible depending on the assignment of hole1
and hole2
. Includes two cases:
- hole2::AbstractHole: A failed
AbstractHole
-AbstractHole
comparison. (e.g. AbstractHole(BitVector((1, 0, 1))) vs AbstractHole(BitVector((0, 1, 1)))) - hole2::Nothing: A failed
AbstractHole
-RuleNode
comparison. (e.g. AbstractHole(BitVector((1, 0, 1))) vs RuleNode(2))
sourceHerbConstraints.LessThanOrEqualSuccess
— Typeabstract type LessThanOrEqualSuccess <: LessThanOrEqualResult
node1
<= node2
is guaranteed under all possible assignments of the holes involved. The strictness of a LessThanOrEqualSuccess is specified by 1 of 2 concrete cases:
LessThanOrEqualSuccessLessThan
: node1
< node2
LessThanOrEqualSuccessEquality
: node1
== node2
LessThanOrEqualSuccessWithHoles
: node1
<= node2
. Unable to specific.
sourceHerbConstraints.LessThanOrEqualSuccessEquality
— Typestruct LessThanOrEqualSuccessEquality <: LessThanOrEqualSuccess end
node1
== node2
is guaranteed under all possible assignments of the holes involved.
sourceHerbConstraints.LessThanOrEqualSuccessLessThan
— Typestruct LessThanOrEqualSuccessEquality <: LessThanOrEqualSuccess end
node1
< node2
is guaranteed under all possible assignments of the holes involved.
sourceHerbConstraints.LessThanOrEqualSuccessWithHoles
— Typestruct LessThanOrEqualSuccessWithHoles <: LessThanOrEqualSuccess end
node1
<= node2
is guaranteed under all possible assignments of the holes involved. Because of the holes involved, it is not possible to specify '<' or '=='.
sourceHerbConstraints.LocalContains
— TypeLocalContains
Enforces that a given rule
appears at or below the given path
at least once.
sourceHerbConstraints.LocalContainsSubtree
— TypeLocalContains
Enforces that a given tree
appears at or below the given path
at least once.
!!! warning: This is a stateful constraint can only be propagated by the UniformSolver. The indices
and candidates
fields should not be set by the user.
sourceHerbConstraints.LocalContainsSubtree
— MethodLocalContainsSubtree(path::Vector{Int}, tree::AbstractRuleNode)
Enforces that a given tree
appears at or below the given path
at least once.
sourceHerbConstraints.LocalForbidden
— TypeLocalForbidden
Forbids the a subtree that matches the tree
to be generated at the location provided by the path. Use a Forbidden
constraint for enforcing this throughout the entire search space.
sourceHerbConstraints.LocalForbiddenSequence
— TypeLocalForbiddenSequence <: AbstractLocalConstraint
Forbids the given sequence
of rule nodes ending at the node at the path
. If any of the rules in ignore_if
appears in the sequence, the constraint is ignored.
sourceHerbConstraints.LocalOrdered
— TypeEnforces an order over two or more subtrees that fill the variables specified in order
when the pattern is applied at the location given by path
. Use an Ordered
constraint for enforcing this throughout the entire search space.
sourceHerbConstraints.LocalUnique
— TypeLocalUnique <: AbstractLocalConstraint
Enforces that a given rule
appears at or below the given path
at most once. In case of the UniformSolver, cache the list of holes
, since no new holes can appear.
sourceHerbConstraints.MakeEqualHardFail
— Typestruct MakeEqualHardFail <: MakeEqualResult end
node1
!= node2
is guaranteed under all possible assignments of the holes involved.
sourceHerbConstraints.MakeEqualResult
— Typeabstract type MakeEqualResult end
A result of the make_equal!
function. Can be one of 3 cases:
sourceHerbConstraints.MakeEqualSoftFail
— Typestruct MakeEqualSoftFail <: MakeEqualResult end
Making node1
== node2
is ambiguous. Examples:
RuleNode(1, [Hole({1, 2, 3})]) == RuleNode(1, [VarNode(:a)])
. The hole can be filled with any rule.Hole({1, 2, 3}) == DomainRuleNode({1, 2, 3})
. The hole can be filled with any rule.
sourceHerbConstraints.MakeEqualSuccess
— Typestruct MakeEqualSuccess <: MakeEqualResult end
node1
== node2
is guaranteed under all possible assignments of the holes involved.
sourceHerbConstraints.Ordered
— TypeOrdered <: AbstractGrammarConstraint
A AbstractGrammarConstraint
that enforces a specific order in MatchVar
assignments in the pattern defined by tree
. Nodes in the pattern can either be a RuleNode
, which contains a rule index corresponding to the rule index in the AbstractGrammar
and the appropriate number of children. It can also contain a VarNode
, which contains a single identifier symbol. A VarNode
can match any subtree. If there are multiple instances of the same variable in the pattern, the matched subtrees must be identical.
The order
defines an order between the variable assignments. For example, if the order is [x, y]
, the constraint will require the assignment to x
to be less than or equal to the assignment to y
. The order is recursively defined by RuleNode
indices. For more information, see Base.isless(rn₁::AbstractRuleNode, rn₂::AbstractRuleNode)
.
For example, consider the tree 1(a, 2(b, 3(c, 4))))
:
Ordered(RuleNode(3, [VarNode(:v), VarNode(:w)]), [:v, :w])
removes every rule with an index of 5 or greater from the domain of c
, since that would make the index of the assignment to v
greater than the index of the assignment to w
, violating the order.Ordered(RuleNode(3, [VarNode(:v), VarNode(:w)]), [:w, :v])
removes every rule with an index of 4 or less from the domain of c
, since that would make the index of the assignment to v
less than the index of the assignment to w
, violating the order.
sourceHerbConstraints.PatternMatchHardFail
— TypeThe pattern is not matched and can never be matched by filling in holes
sourceHerbConstraints.PatternMatchResult
— Typeabstract type PatternMatchResult end
A result of the pattern_match
function. Can be one of 4 cases:
sourceHerbConstraints.PatternMatchSoftFail
— TypeThe pattern can still be matched in a non-trivial way. Includes two cases:
- multiple holes are involved. this result stores a reference to one of them
- a single hole is involved, but needs to be filled with a node of size >= 2
sourceHerbConstraints.PatternMatchSuccess
— TypeThe pattern is exactly matched and does not involve any holes at all
sourceHerbConstraints.PatternMatchSuccessWhenHoleAssignedTo
— TypeThe pattern can be matched when the hole
is filled with any of the given ind
(s).
sourceHerbConstraints.Solver
— Typeabstract type Solver
Abstract constraint solver. Each solver should have at least the following fields:
statistics::SolverStatistics
fix_point_running::Bool
schedule::PriorityQueue{AbstractLocalConstraint, Int}
Each solver should implement at least:
post!
get_tree
get_grammar
set_infeasible!
isfeasible
HerbCore.get_node_at_location
get_hole_at_location
notify_tree_manipulation
deactivate!
sourceHerbConstraints.SolverState
— Typemutable struct SolverState
A state to be solved by the GenericSolver
. A state contains of:
tree
: A partial ASTactive_constraints
: The local constraints that apply to this tree. These constraints are enforced each time the tree is modified.isfeasible
: Flag to indicate if this state is still feasible. When a propagator spots an inconsistency, this field will be set to false. Tree manipulations and further propagations are not allowed on infeasible states
sourceHerbConstraints.SolverStatistics
— TypeTemporary struct to track!
the number of several function calls centered around the Solver
sourceHerbConstraints.StateHole
— TypeStateHole <: AbstractUniformHole
StateHole
s are uniform holes used by the UniformSolver
. Domain manipulations are tracked for backpropagation.
domain
: A StateSparseSet
representing the rule nodes this hole can take. If size(domain) == 1, this hole should act like a RuleNode
children
: The children of this hole in the expression tree.
sourceHerbConstraints.StateHole
— Methodsource HerbConstraints.StateHole
— MethodConverts a UniformHole
to a StateHole
sourceHerbConstraints.StateInt
— TypeStateful integer that can be saved and restored by the StateManager
. Supports the following functions:
get_value
set_value!
increment!
decrement!
sourceHerbConstraints.StateIntBackup
— TypeBackup entry for the given StateInt
sourceHerbConstraints.StateManager
— TypeManages all changes made to StateInts using StateIntBackups
sourceHerbConstraints.StateSparseSet
— MethodConverts a BitVector domain representation to a StateSparseSet Example:
set = StateSparseSet(sm, BitVector((1, 1, 0, 0, 1, 0, 0))) #{1, 2, 5}
sourceHerbConstraints.StateSparseSet
— MethodCreate a new StateSparseSet
with values [1, 2, ..., n]
sourceHerbConstraints.StateStack
— TypeSimple stack that can only increase in size. Supports backtracking by decreasing the size to the saved size.
sourceHerbConstraints.StateStack
— Methodfunction StateStack{T}(sm::AbstractStateManager) where T
Create an empty StateStack supporting elements of type T
sourceHerbConstraints.StateStack
— Methodfunction StateStack{T}(sm::AbstractStateManager, vec::Vector{T}) where T
Create a StateStack for the provided vec
sourceHerbConstraints.UniformSolver
— TypeA DFS-based solver that uses StateHole
s that support backtracking.
sourceHerbConstraints.UniformSolver
— MethodUniformSolver(grammar::AbstractGrammar, fixed_shaped_tree::AbstractRuleNode)
sourceHerbConstraints.Unique
— TypeUnique <: AbstractGrammarConstraint
This [AbstractGrammarConstraint
] enforces that a given rule
appears in the program tree at most once.
sourceHerbConstraints.VarNode
— Typestruct VarNode <: AbstractRuleNode
Matches any subtree and assigns it to a variable name. The LocalForbidden
constraint will not match if identical variable symbols match to different trees. Example usage:
RuleNode(3, [VarNode(:x), VarNode(:x)])
This matches RuleNode(3, [RuleNode(1), RuleNode(1)])
, RuleNode(3, [RuleNode(2), RuleNode(2)])
, etc. but also larger subtrees such as RuleNode(3, [RuleNode(4, [RuleNode(1)]), RuleNode(4, [RuleNode(1)])])
sourceHerbConstraints.@csgrammar_annotated
— Macro@csgrammar_annotated Define an annotated grammar and return it as a ContextSensitiveGrammar. Allows for adding optional annotations per rule. As well as that, allows for adding optional labels per rule, which can be referenced in annotations. Syntax is backwards-compatible with @csgrammar. Examples:
g₁ = @csgrammar_annotated begin
Element = 1
Element = x
Element = Element + Element := commutative
@@ -18,9 +18,9 @@
forbidden_path([:addition, :one]) || forbidden_path([:one, :variable])
)
multiplication:: Element = Element * Element := (commutative, transitive)
-end
sourceBase.collect
— Methodfunction Base.collect(stack::StateStack)
Return the internal Vector
representation of the stack
. !!! warning: The returned vector is read-only.
sourceBase.findall
— MethodReturns all elements in the set.
sourceBase.findfirst
— MethodReturns the minimum value in the set. This function name is used instead of min
to allow code reuse for domains of type BitVector
and StateSparseSet
.
sourceBase.findlast
— MethodReturns the maximum value in the set. This function name is used instead of min
to allow code reuse for domains of type BitVector
and StateSparseSet
.
sourceBase.getindex
— MethodChecks if value val
is in StateSparseSet s
. !!! warning: This allows a StateSparseSet
to be used as if it were a BitVector
representation of a set
sourceBase.in
— MethodChecks if value val
is in StateSparseSet s
.
sourceBase.in
— Methodfunction Base.in(stack::StateStack, value)::Bool
Checks whether the value
is in the stack
.
sourceBase.length
— MethodReturns the number of values in the StateSparseSet
.
sourceBase.push!
— Methodfunction Base.push!(stack::StateStack, item)
Place an item
on top of the stack
.
sourceBase.show
— MethodPretty print the StateSparseSet
.
sourceBase.size
— MethodReturns the number of values in the StateSparseSet
.
sourceBase.size
— Methodfunction Base.size(stack::StateStack)
Get the current size of the stack
.
sourceBase.sum
— MethodReturns the number of values in the StateSparseSet
. !!! warning: This is not actually the sum of the set. It is the length of the set. This allows a StateSparseSet
to be used as if it were a BitVector
representation of a set
sourceHerbConstraints._contains
— Method_contains(node::AbstractRuleNode, rule::Int)::Bool
Recursive helper function for the LocalContains constraint Returns one of the following:
true
, if the node
does contains the rule
false
, if the node
does not contain the rule
Vector{AbstractHole}
, if the node
contains the rule
if one the holes
gets filled with the target rule
sourceHerbConstraints._count_occurrences!
— Methodfunction _count_occurrences!(node::AbstractRuleNode, rule::Int, holes::Vector{AbstractHole})::Int
Recursive helper function for the LocalUnique constraint. Returns the number of certain occurrences of the rule in the tree. All holes that potentially can hold the target rule are stored in the holes
vector.
!!! warning: Stops counting if the rule occurs more than once. Counting beyond 2 is not needed for LocalUnique.
sourceHerbConstraints._count_occurrences
— Methodfunction _count_occurrences(rule::Int, node::AbstractRuleNode)::Int
Recursively counts the number of occurrences of the rule
in the node
.
sourceHerbConstraints._count_occurrences
— Methodfunction _count_occurrences(holes::Vector{AbstractHole}, rule::Int)
Counts the occurences of the rule
in the cached list of holes
.
!!! warning: Stops counting if the rule occurs more than once. Counting beyond 2 is not needed for LocalUnique.
sourceHerbConstraints._exchange_positions!
— MethodExchanges the positions in the internal representation of the StateSparseSet.
sourceHerbConstraints._update_bounds_val_removed!
— MethodThis function should be called whenever the minimum or maximum value from the set might have been removed. The minimum and maximum value of the set will be updated to the actual bounds of the set.
sourceHerbConstraints._update_max_val_removed!
— MethodThis function should be called whenever the maximum value from the set might have been removed. The maximum value of the set will be updated to the actual maximum of the set.
sourceHerbConstraints._update_min_val_removed!
— MethodThis function should be called whenever the minimum value from the set might have been removed. The minimum value of the set will be updated to the actual minimum of the set.
sourceHerbConstraints.annotation2constraint
— MethodConverts 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)
sourceHerbConstraints.are_disjoint
— Methodare_disjoint(domain1::BitVector, domain2::BitVector)::Bool
Returns true if there is no overlap in values between domain1
and domain2
sourceHerbConstraints.are_disjoint
— Methodare_disjoint(set1::StateSparseSet, set2::StateSparseSet)
Returns true if there is no overlap in values between set1
and set2
sourceHerbConstraints.backup!
— MethodShould be called whenever the state of a StateInt
is modified. Creates a StateIntBackup
for the given StateInt
. Only backup the value if this integer has not been stored during this state before Example usecase:
a = StateInt(sm, 10)
+end
sourceBase.collect
— Methodfunction Base.collect(stack::StateStack)
Return the internal Vector
representation of the stack
. !!! warning: The returned vector is read-only.
sourceBase.findall
— MethodReturns all elements in the set.
sourceBase.findfirst
— MethodReturns the minimum value in the set. This function name is used instead of min
to allow code reuse for domains of type BitVector
and StateSparseSet
.
sourceBase.findlast
— MethodReturns the maximum value in the set. This function name is used instead of min
to allow code reuse for domains of type BitVector
and StateSparseSet
.
sourceBase.getindex
— MethodChecks if value val
is in StateSparseSet s
. !!! warning: This allows a StateSparseSet
to be used as if it were a BitVector
representation of a set
sourceBase.in
— MethodChecks if value val
is in StateSparseSet s
.
sourceBase.in
— Methodfunction Base.in(stack::StateStack, value)::Bool
Checks whether the value
is in the stack
.
sourceBase.length
— MethodReturns the number of values in the StateSparseSet
.
sourceBase.push!
— Methodfunction Base.push!(stack::StateStack, item)
Place an item
on top of the stack
.
sourceBase.show
— MethodPretty print the StateSparseSet
.
sourceBase.size
— MethodReturns the number of values in the StateSparseSet
.
sourceBase.size
— Methodfunction Base.size(stack::StateStack)
Get the current size of the stack
.
sourceBase.sum
— MethodReturns the number of values in the StateSparseSet
. !!! warning: This is not actually the sum of the set. It is the length of the set. This allows a StateSparseSet
to be used as if it were a BitVector
representation of a set
sourceHerbConstraints._contains
— Method_contains(node::AbstractRuleNode, rule::Int)::Bool
Recursive helper function for the LocalContains constraint Returns one of the following:
true
, if the node
does contains the rule
false
, if the node
does not contain the rule
Vector{AbstractHole}
, if the node
contains the rule
if one the holes
gets filled with the target rule
sourceHerbConstraints._count_occurrences!
— Methodfunction _count_occurrences!(node::AbstractRuleNode, rule::Int, holes::Vector{AbstractHole})::Int
Recursive helper function for the LocalUnique constraint. Returns the number of certain occurrences of the rule in the tree. All holes that potentially can hold the target rule are stored in the holes
vector.
!!! warning: Stops counting if the rule occurs more than once. Counting beyond 2 is not needed for LocalUnique.
sourceHerbConstraints._count_occurrences
— Methodfunction _count_occurrences(rule::Int, node::AbstractRuleNode)::Int
Recursively counts the number of occurrences of the rule
in the node
.
sourceHerbConstraints._count_occurrences
— Methodfunction _count_occurrences(holes::Vector{AbstractHole}, rule::Int)
Counts the occurences of the rule
in the cached list of holes
.
!!! warning: Stops counting if the rule occurs more than once. Counting beyond 2 is not needed for LocalUnique.
sourceHerbConstraints._exchange_positions!
— MethodExchanges the positions in the internal representation of the StateSparseSet.
sourceHerbConstraints._update_bounds_val_removed!
— MethodThis function should be called whenever the minimum or maximum value from the set might have been removed. The minimum and maximum value of the set will be updated to the actual bounds of the set.
sourceHerbConstraints._update_max_val_removed!
— MethodThis function should be called whenever the maximum value from the set might have been removed. The maximum value of the set will be updated to the actual maximum of the set.
sourceHerbConstraints._update_min_val_removed!
— MethodThis function should be called whenever the minimum value from the set might have been removed. The minimum value of the set will be updated to the actual minimum of the set.
sourceHerbConstraints.annotation2constraint
— MethodConverts 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)
sourceHerbConstraints.are_disjoint
— Methodare_disjoint(domain1::BitVector, domain2::BitVector)::Bool
Returns true if there is no overlap in values between domain1
and domain2
sourceHerbConstraints.are_disjoint
— Methodare_disjoint(set1::StateSparseSet, set2::StateSparseSet)
Returns true if there is no overlap in values between set1
and set2
sourceHerbConstraints.backup!
— MethodShould be called whenever the state of a StateInt
is modified. Creates a StateIntBackup
for the given StateInt
. Only backup the value if this integer has not been stored during this state before Example usecase:
a = StateInt(sm, 10)
save_state!(sm)
set_value!(a, 9) #backup value 10
set_value!(a, 8) #no need to backup again
set_value!(a, 3) #no need to backup again
-restore!(sm) #restores a to value 10
sourceHerbConstraints.check_tree
— Methodcheck_tree(c::Contains, tree::AbstractRuleNode)::Bool
Checks if the given AbstractRuleNode
tree abides the Contains
constraint.
sourceHerbConstraints.check_tree
— Methodcheck_tree(c::ContainsSubtree, tree::AbstractRuleNode)::Bool
Checks if the given AbstractRuleNode
tree abides the ContainsSubtree
constraint.
sourceHerbConstraints.check_tree
— Methodcheck_tree(c::Forbidden, tree::AbstractRuleNode)::Bool
Checks if the given AbstractRuleNode
tree abides the Forbidden
constraint.
sourceHerbConstraints.check_tree
— Methodcheck_tree(c::ForbiddenSequence, tree::AbstractRuleNode; sequence_started=false)::Bool
Checks if the given AbstractRuleNode
tree abides the ForbiddenSequence
constraint.
sourceHerbConstraints.check_tree
— Methodcheck_tree(c::Ordered, tree::AbstractRuleNode)::Bool
Checks if the given AbstractRuleNode
tree abides the Ordered
constraint.
sourceHerbConstraints.check_tree
— Methodfunction check_tree(c::Unique, tree::AbstractRuleNode)::Bool
Checks if the given AbstractRuleNode
tree abides the Unique
constraint.
sourceHerbConstraints.contains_varnode
— Methodcontains_varnode(rn::AbstractRuleNode, name::Symbol)
Checks if an AbstractRuleNode
tree contains a VarNode
with the given name
.
sourceHerbConstraints.deactivate!
— Methoddeactivate!(solver::GenericSolver, constraint::AbstractLocalConstraint)
Function that should be called whenever the constraint is already satisfied and never has to be repropagated.
sourceHerbConstraints.deactivate!
— Methoddeactivate!(solver::UniformSolver, constraint::AbstractLocalConstraint)
Function that should be called whenever the constraint is already satisfied and never has to be repropagated.
sourceHerbConstraints.decrement!
— MethodDecrease the value of the integer by 1
sourceHerbConstraints.fix_point!
— Methodfix_point!(solver::Solver)
Propagate constraints in the current state until no further dedecutions can be made
sourceHerbConstraints.freeze_state
— Methodfreeze_state(hole::StateHole)::RuleNode
Converts a [StateHole
])(@ref) to a [RuleNode
]@(ref). The hole and its children are assumed to be filled.
sourceHerbConstraints.get_grammar
— Methodfunction get_grammar(solver::GenericSolver)::AbstractGrammar
Get the grammar.
sourceHerbConstraints.get_grammar
— Methodfunction get_grammar(solver::UniformSolver)::AbstractGrammar
Get the grammar.
sourceHerbConstraints.get_hole_at_location
— Methodget_hole_at_location(solver::GenericSolver, location::Vector{Int})::AbstractHole
Get the node at path location
and assert it is a AbstractHole
.
sourceHerbConstraints.get_hole_at_location
— Methodget_hole_at_location(solver::UniformSolver, path::Vector{Int})
Get the hole that is located at the provided path
.
sourceHerbConstraints.get_intersection
— Methodget_intersection(domain1::BitVector, domain2::BitVector)::Bool
Returns all the values that are in both domain1
and domain2
sourceHerbConstraints.get_max_depth
— Methodfunction get_max_depth(solver::GenericSolver)::SolverState
Get the maximum depth of the tree.
sourceHerbConstraints.get_max_size
— Methodfunction get_max_depth(solver::GenericSolver)::SolverState
Get the maximum number of AbstractRuleNode
s allowed inside the tree.
sourceHerbConstraints.get_nodes
— Methodget_nodes(solver)
Return an iterator over all nodes in the tree
sourceHerbConstraints.get_nodes_on_path
— Methodfunction get_nodes_on_path(root::AbstractRuleNode, path::Vector{Int})::Vector{AbstractRuleNode}
Gets a list of nodes on the path
, starting (and including) the root
.
sourceHerbConstraints.get_priority
— Methodfunction get_priority(::AbstractLocalConstraint)
Used to determine which constraint to propagate first in fix_point!
. Constraints with fast propagators and/or strong inference should be propagated first.
sourceHerbConstraints.get_starting_symbol
— Methodfunction get_starting_symbol(solver::GenericSolver)::Symbol
Get the symbol from the solver.
sourceHerbConstraints.get_state
— Methodfunction get_state(solver::GenericSolver)::SolverState
Get the current [SolverState
]@(ref) of the solver.
sourceHerbConstraints.get_tree
— Methodfunction get_tree(solver::GenericSolver)::AbstractRuleNode
Returns the number of AbstractRuleNode
s in the tree.
sourceHerbConstraints.get_tree
— Methodfunction get_tree(solver::UniformSolver)::AbstractRuleNode
Get the root of the tree. This remains the same instance throughout the entire search.
sourceHerbConstraints.get_tree_size
— Methodfunction get_tree_size(solver::GenericSolver)::Int
Returns the number of AbstractRuleNode
s in the tree.
sourceHerbConstraints.get_value
— MethodGet the value of the stateful integer
sourceHerbConstraints.increment!
— MethodIncrease the value of the integer by 1
sourceHerbConstraints.is_subdomain
— Methodis_subdomain(specific_tree::AbstractRuleNode, general_tree::AbstractRuleNode)
Checks if the specific_tree
can be obtained by repeatedly removing values from the general_tree
sourceHerbConstraints.is_subdomain
— Method is_subdomain(subdomain::BitVector, domain::BitVector)
Checks if subdomain
is a subdomain of domain
. Example: [0, 0, 1, 0] is a subdomain of [0, 1, 1, 1]
sourceHerbConstraints.isfeasible
— Methodisfeasible(solver::GenericSolver)
Returns true if no inconsistency has been detected. Used in several ways:
- Iterators should check for infeasibility to discard infeasible states
- After any tree manipulation with the possibility of an inconsistency (e.g.
remove_below!
, remove_above!
, remove!
) fix_point!
should check for infeasibility to clear its schedule and return- Some
GenericSolver
functions assert a feasible state for debugging purposes @assert isfeasible(solver)
- Some
GenericSolver
functions have a guard that skip the function on an infeasible state: if !isfeasible(solver) return end
sourceHerbConstraints.isfeasible
— Methodisfeasible(solver::UniformSolver)
Returns true if no inconsistency has been detected.
sourceHerbConstraints.load_state!
— Methodload_state!(solver::GenericSolver, state::SolverState)
Overwrites the current state with the given state
sourceHerbConstraints.make_equal!
— Methodfunction make_equal!(solver::Solver, node1::AbstractRuleNode, node2::AbstractRuleNode)::MakeEqualResult
Tree manipulation that enforces node1
== node2
if unambiguous.
sourceHerbConstraints.make_less_than_or_equal!
— Methodfunction make_less_than_or_equal!(h1::Union{RuleNode, AbstractHole}, h2::Union{RuleNode, AbstractHole}, guards::Vector{Tuple{AbstractHole, Int}})::LessThanOrEqualResult
Helper function that keeps track of the guards
sourceHerbConstraints.make_less_than_or_equal!
— Methodfunction make_less_than_or_equal!(h1::Union{RuleNode, AbstractHole}, h2::Union{RuleNode, AbstractHole})::LessThanOrEqualResult
Ensures that n1<=n2 by removing impossible values from holes. Returns one of the following results:
LessThanOrEqualSuccess
. When [n1<=n2].LessThanOrEqualHardFail
. When [n1>n2] or when the solver state is infeasible.LessThanOrEqualSoftFail
. When no further deductions can be made, but [n1<=n2] and [n1>n2] are still possible.
sourceHerbConstraints.make_less_than_or_equal!
— Methodfunction make_less_than_or_equal!(solver::Solver, nodes1::Vector{AbstractRuleNode}, nodes2::Vector{AbstractRuleNode}, guards::Vector{Tuple{AbstractHole, Int}})::LessThanOrEqualResult
Helper function that tiebreaks on children.
sourceHerbConstraints.new_state!
— Methodnew_state!(solver::GenericSolver, tree::AbstractRuleNode)
Overwrites the current state and propagates constraints on the tree
from the ground up
sourceHerbConstraints.notify_new_node
— Methodnotify_new_node(solver::GenericSolver, event_path::Vector{Int})
Notify all constraints that a new node has appeared at the event_path
by calling their respective on_new_node
function.
Warning This does not notify the solver about nodes below the event_path
. In that case, call notify_new_nodes
instead.
sourceHerbConstraints.notify_new_nodes
— Methodnotify_new_nodes(solver::GenericSolver, node::AbstractRuleNode, path::Vector{Int})
Notify all grammar constraints about the new node
and its (grand)children
sourceHerbConstraints.notify_new_nodes
— Methodnotify_new_nodes(solver::UniformSolver, node::AbstractRuleNode, path::Vector{Int})
Notify all grammar constraints about the new node
and its (grand)children
sourceHerbConstraints.notify_tree_manipulation
— Methodnotify_tree_manipulation(solver::GenericSolver, event_path::Vector{Int})
Notify subscribed constraints that a tree manipulation has occured at the event_path
by scheduling them for propagation
sourceHerbConstraints.notify_tree_manipulation
— Methodnotify_tree_manipulation(solver::UniformSolver, event_path::Vector{Int})
Notify subscribed constraints that a tree manipulation has occured at the event_path
by scheduling them for propagation
sourceHerbConstraints.partition
— Methodpartition(hole::Hole, grammar::ContextSensitiveGrammar)::Vector{BitVector}
Partition a Hole into subdomains grouped by childtypes
sourceHerbConstraints.pattern_match
— MethodGeneric fallback function for commutativity. Swaps arguments 1 and 2, then dispatches to a more specific signature. If this gets stuck in an infinite loop, the implementation of an AbstractRuleNode type pair is missing.
sourceHerbConstraints.pattern_match
— Methodpattern_match(rn::AbstractRuleNode, mn::AbstractRuleNode)::PatternMatchResult
Recursively tries to match AbstractRuleNode
rn
with AbstractRuleNode
mn
. Returns a PatternMatchResult
that describes if the pattern was matched.
sourceHerbConstraints.pattern_match
— Methodpattern_match(node::AbstractRuleNode, domainrulenode::DomainRuleNode, vars::Dict{Symbol, AbstractRuleNode})::PatternMatchResult
Comparing any AbstractRuleNode
with a DomainRuleNode
sourceHerbConstraints.pattern_match
— Methodpattern_match(rn::AbstractRuleNode, var::VarNode, vars::Dict{Symbol, AbstractRuleNode})::PatternMatchResult
Comparing any AbstractRuleNode
with a named VarNode
sourceHerbConstraints.pattern_match
— Methodpattern_match(h1::Union{RuleNode, AbstractHole}, h2::Union{RuleNode, AbstractHole}, vars::Dict{Symbol, AbstractRuleNode})::PatternMatchResult
Comparing any pair of Rulenode
and/or AbstractHole
. It is important to note that some AbstractHole
s are already filled and should be treated as RuleNode
. This is why this function is dispatched on (isfilled(h1), isfilled(h2))
. The '(RuleNode, AbstractHole)' case could still include two nodes of type AbstractHole
, but one of them should be treated as a rulenode.
sourceHerbConstraints.pattern_match
— Methodpattern_match(rns::Vector{AbstractRuleNode}, mns::Vector{AbstractRuleNode}, vars::Dict{Symbol, AbstractRuleNode})::PatternMatchResult
Pairwise tries to match two ordered lists of AbstractRuleNodes. Typically, this function is used to pattern match the children two AbstractRuleNodes.
sourceHerbConstraints.post!
— Methodpost!(solver::GenericSolver, constraint::AbstractLocalConstraint)
Imposes the constraint
to the current state. By default, the constraint will be scheduled for its initial propagation. Constraints can overload this method to add themselves to notify lists or triggers.
sourceHerbConstraints.post!
— Methodpost!(solver::UniformSolver, constraint::AbstractLocalConstraint)
Post a new local constraint. Converts the constraint to a state constraint and schedules it for propagation.
sourceHerbConstraints.propagate!
— Methodfunction propagate!(::GenericSolver, ::LocalContainsSubtree)
!!! warning: LocalContainsSubtree uses stateful properties and can therefore not be propagated in the GenericSolver. (The GenericSolver shares constraints among different states, so they cannot use stateful properties)
sourceHerbConstraints.propagate!
— Methodfunction propagate!(solver::Solver, c::LocalContains)
Enforce that the rule
appears at or below the path
at least once. Uses a helper function to retrieve a list of holes that can potentially hold the target rule. If there is only a single hole that can potentially hold the target rule, that hole will be filled with that rule.
sourceHerbConstraints.propagate!
— Methodfunction propagate!(solver::Solver, c::LocalForbiddenSequence)
sourceHerbConstraints.propagate!
— Methodfunction propagate!(solver::Solver, c::LocalForbidden)
Enforce that the forbidden tree
does not occur at the path
. The forbidden tree is matched against the AbstractRuleNode
located at the path. Deductions are based on the type of the PatternMatchResult
returned by the pattern_match
function.
sourceHerbConstraints.propagate!
— Methodfunction propagate!(solver::Solver, c::LocalOrdered)
Enforce that the VarNode
s in the tree
are in the specified order
. First the node located at the path
is matched to see if the ordered constraint applies here. The nodes matching the variables are stored in the vars
dictionary. Then the order
is enforced within the make_less_than_or_equal!
tree manipulation.
sourceHerbConstraints.propagate!
— Methodfunction propagate!(solver::Solver, c::LocalUnique)
Enforce that the rule
appears at or below the path
at least once. Uses a helper function to retrieve a list of holes that can potentially hold the target rule. If there is only a single hole that can potentially hold the target rule, that hole will be filled with that rule.
sourceHerbConstraints.propagate!
— Methodfunction propagate!(solver::UniformSolver, c::LocalContainsSubtree)
Enforce that the tree
appears at or below the path
at least once. Nodes that can potentially become the target sub-tree are considered candidates
. In case of multiple candidates, a stateful set of indices
is used to keep track of active candidates.
sourceHerbConstraints.remove!
— Methodremove!(solver::GenericSolver, path::Vector{Int}, rule_index::Int)
Remove rule_index
from the domain of the hole located at the path
. It is assumed the path points to a hole, otherwise an exception will be thrown.
sourceHerbConstraints.remove!
— Methodremove!(solver::GenericSolver, path::Vector{Int}, rules::Vector{Int})
Remove all rules
from the domain of the hole located at the path
. It is assumed the path points to a hole, otherwise an exception will be thrown.
sourceHerbConstraints.remove!
— Methodremove!(set::StateSparseSet, val::Int)
Removes value val
from StateSparseSet set
. Returns true if val
was in set
.
sourceHerbConstraints.remove!
— Methodremove!(solver::Solver, path::Vector{Int}, rule_index::Int)
Remove rule_index
from the domain of the hole located at the path
. It is assumed the path points to a hole, otherwise an exception will be thrown.
sourceHerbConstraints.remove!
— Methodremove!(solver::UniformSolver, path::Vector{Int}, rules::Vector{Int})
Remove all rules
from the domain of the hole located at the path
. It is assumed the path points to a hole, otherwise an exception will be thrown.
sourceHerbConstraints.remove_above!
— Methodremove_above!(solver::GenericSolver, path::Vector{Int}, rule_index::Int)
Reduce the domain of the hole located at the path
by removing all rules indices above rule_index
Example: rule_index
= 2. hole
with domain [1, 1, 0, 1] gets reduced to [1, 0, 0, 0] and gets simplified to a RuleNode
sourceHerbConstraints.remove_above!
— MethodRemove all the values greater than val
from the set
sourceHerbConstraints.remove_above!
— Methodremove_above!(solver::UniformSolver, path::Vector{Int}, rule_index::Int)
Reduce the domain of the hole located at the path
by removing all rules indices above rule_index
Example: rule_index
= 2. hole
with domain {1, 2, 4} gets reduced to {1}
sourceHerbConstraints.remove_all_but!
— Methodremove_all_but!(solver::GenericSolver, path::Vector{Int}, new_domain::BitVector)
Reduce the domain of the hole located at the path
, to the new_domain
. It is assumed the path points to a hole, otherwise an exception will be thrown. It is assumed new_domain ⊆ domain. For example: [1, 0, 1, 0] ⊆ [1, 0, 1, 1]
sourceHerbConstraints.remove_all_but!
— Methodremove_all_but!(solver::GenericSolver, path::Vector{Int}, rule_index::Int)
Fill in the hole located at the path
with rule rule_index
. It is assumed the path points to a hole, otherwise an exception will be thrown. It is assumed rule_index ∈ hole.domain.
!!! warning: If the hole
is known to be in the current tree, the hole can be passed directly. The caller has to make sure that the hole instance is actually present at the provided path
.
sourceHerbConstraints.remove_all_but!
— Methodremove_all_but!(set::StateSparseSet, val::Int)::Bool
Removes all values from StateSparseSet set
, except val
sourceHerbConstraints.remove_all_but!
— Methodremove_all_but!(solver::UniformSolver, path::Vector{Int}, rule_index::Int)
Fill in the hole located at the path
with rule rule_index
.
sourceHerbConstraints.remove_below!
— Methodremove_below!(solver::GenericSolver, path::Vector{Int}, rule_index::Int)
Reduce the domain of the hole located at the path
by removing all rules indices below rule_index
Example: rule_index
= 2. hole
with domain [1, 1, 0, 1] gets reduced to [0, 1, 0, 1]
sourceHerbConstraints.remove_below!
— MethodRemove all the values less than val
from the set
sourceHerbConstraints.remove_below!
— Methodremove_below!(solver::UniformSolver, path::Vector{Int}, rule_index::Int)
Reduce the domain of the hole located at the path
by removing all rules indices below rule_index
Example: rule_index
= 2. hole
with domain {1, 2, 4} gets reduced to {2, 4}
sourceHerbConstraints.remove_node!
— Methodfunction remove_node!(solver::GenericSolver, path::Vector{Int})
Remove the node at the given path
by substituting it with a hole of the same symbol.
sourceHerbConstraints.restore!
— MethodRestores the StateInt
stored in the StateIntBackup
to its original value
sourceHerbConstraints.restore!
— MethodReverts all the backups since the last save_state!
.
sourceHerbConstraints.restore!
— MethodRestore state of the solver until the last save_state!
sourceHerbConstraints.save_state!
— Methodsave_state!(solver::GenericSolver)
Returns a copy of the current state that can be restored by calling load_state!(solver, state)
sourceHerbConstraints.save_state!
— MethodMake a backup of the current state. Return to this state by calling restore!
.
sourceHerbConstraints.save_state!
— MethodSave the current state of the solver, can restored using restore!
sourceHerbConstraints.schedule!
— Methodschedule(solver::GenericSolver, constraint::AbstractLocalConstraint)
Schedules the constraint
for propagation.
sourceHerbConstraints.set_infeasible!
— Methodset_infeasible!(solver::GenericSolver)
Function to be called if any inconsistency has been detected
sourceHerbConstraints.set_infeasible!
— Methodset_infeasible!(solver::Solver)
Function to be called if any inconsistency has been detected
sourceHerbConstraints.set_value!
— MethodSet the value of the integer to the given val
sourceHerbConstraints.shouldschedule
— Methodshouldschedule(solver::Solver, constraint::AbstractLocalConstraint, path::Vector{Int})::Bool
Function that is called when a tree manipulation occured at the path
. Returns true if the constraint
should be scheduled for propagation.
Default behavior: return true iff the manipulation happened at or below the constraint path.
sourceHerbConstraints.shouldschedule
— Methodshouldschedule(::Solver, constraint::LocalForbiddenSequence, path::Vector{Int})::Bool
Return true iff the manipulation happened at or above the constraint path.
sourceHerbConstraints.simplify_hole!
— Methodsimplify_hole!(solver::GenericSolver, path::Vector{Int})
Takes a Hole and tries to simplify it to a UniformHole or RuleNode. If the domain of the hole is empty, the state will be marked as infeasible
sourceHerbConstraints.substitute!
— Methodsubstitute!(solver::GenericSolver, path::Vector{Int}, new_node::AbstractRuleNode; is_domain_increasing::Union{Nothing, Bool}=nothing)
Substitute the node at the path
, with a new_node
.
is_domain_increasing
: indicates if all grammar constraints should be repropagated from the ground up.
Domain increasing substitutions are substitutions that cannot be achieved by repeatedly removing values from domains. Example of an domain increasing event: hole[{3, 4, 5}] -> hole[{1, 2}]
. Example of an domain decreasing event: hole[{3, 4, 5}] -> rulenode(4, [hole[{1, 2}], rulenode(1)])
.
sourceHerbCore.contains_hole
— Methodcontains_hole(hole::StateHole)::Bool
Returns true if the hole
or any of its (grand)children are not filled.
sourceHerbCore.get_node_at_location
— MethodHerbCore.get_node_at_location(solver::GenericSolver, location::Vector{Int})::AbstractRuleNode
Get the node at path location
.
sourceHerbCore.get_node_at_location
— Methodget_node_at_location(solver::UniformSolver, path::Vector{Int})
Get the node that is located at the provided path
.
sourceHerbCore.get_path
— Methodget_path(solver::GenericSolver, node::AbstractRuleNode)
Get the path at which the node
is located.
sourceHerbCore.get_path
— Methodget_path(solver::UniformSolver, node::AbstractRuleNode)
Get the path at which the node
is located.
sourceHerbCore.get_rule
— Methodget_rule(hole::StateHole)::Int
Assuming the hole has domain size 1, get the rule it is currently assigned to.
sourceHerbCore.isfilled
— Methodisfilled(hole::StateHole)::Bool
Holes with domain size 1 are fixed to a rule. Returns whether the hole has domain size 1. (holes with an empty domain are not considered to be fixed)
sourceIndex
HerbConstraints.AbstractGrammarConstraint
HerbConstraints.AbstractLocalConstraint
HerbConstraints.AbstractStateManager
HerbConstraints.Contains
HerbConstraints.ContainsSubtree
HerbConstraints.DomainRuleNode
HerbConstraints.Forbidden
HerbConstraints.ForbiddenSequence
HerbConstraints.GenericSolver
HerbConstraints.GenericSolver
HerbConstraints.GenericSolver
HerbConstraints.LessThanOrEqualHardFail
HerbConstraints.LessThanOrEqualResult
HerbConstraints.LessThanOrEqualSoftFail
HerbConstraints.LessThanOrEqualSuccess
HerbConstraints.LessThanOrEqualSuccessEquality
HerbConstraints.LessThanOrEqualSuccessLessThan
HerbConstraints.LessThanOrEqualSuccessWithHoles
HerbConstraints.LocalContains
HerbConstraints.LocalContainsSubtree
HerbConstraints.LocalContainsSubtree
HerbConstraints.LocalForbidden
HerbConstraints.LocalForbiddenSequence
HerbConstraints.LocalOrdered
HerbConstraints.LocalUnique
HerbConstraints.MakeEqualHardFail
HerbConstraints.MakeEqualResult
HerbConstraints.MakeEqualSoftFail
HerbConstraints.MakeEqualSuccess
HerbConstraints.Ordered
HerbConstraints.PatternMatchHardFail
HerbConstraints.PatternMatchResult
HerbConstraints.PatternMatchSoftFail
HerbConstraints.PatternMatchSuccess
HerbConstraints.PatternMatchSuccessWhenHoleAssignedTo
HerbConstraints.Solver
HerbConstraints.SolverState
HerbConstraints.SolverStatistics
HerbConstraints.StateHole
HerbConstraints.StateHole
HerbConstraints.StateHole
HerbConstraints.StateInt
HerbConstraints.StateIntBackup
HerbConstraints.StateManager
HerbConstraints.StateSparseSet
HerbConstraints.StateSparseSet
HerbConstraints.StateStack
HerbConstraints.StateStack
HerbConstraints.StateStack
HerbConstraints.UniformSolver
HerbConstraints.UniformSolver
HerbConstraints.Unique
HerbConstraints.VarNode
HerbCore.AbstractConstraint
HerbCore.AbstractGrammar
HerbCore.AbstractHole
HerbCore.AbstractRuleNode
HerbCore.AbstractUniformHole
HerbCore.Hole
HerbCore.HoleReference
HerbCore.RuleNode
HerbCore.RuleNode
HerbCore.RuleNode
HerbCore.UniformHole
HerbGrammar.ContextSensitiveGrammar
HerbGrammar.NodeLoc
HerbGrammar.SymbolTable
HerbGrammar.SymbolTable
HerbSearch.BFSIterator
HerbSearch.DFSIterator
HerbSearch.ExpandFailureReason
HerbSearch.FixedShapedIterator
HerbSearch.GeneticSearchIterator
HerbSearch.MHSearchIterator
HerbSearch.MLFSIterator
HerbSearch.ProgramIterator
HerbSearch.RandomIterator
HerbSearch.SASearchIterator
HerbSearch.StochasticSearchIterator
HerbSearch.SynthResult
HerbSearch.TopDownIterator
HerbSearch.UniformIterator
HerbSearch.UniformIterator
HerbSearch.VLSNSearchIterator
HerbSpecification.AbstractDependentTypeSpecification
HerbSpecification.AgdaSpecification
HerbSpecification.IOExample
HerbSpecification.MetricProblem
HerbSpecification.Problem
HerbSpecification.SMTSpecification
HerbSpecification.Trace
Base.collect
Base.collect
Base.findall
Base.findfirst
Base.findlast
Base.get
Base.getindex
Base.getindex
Base.in
Base.in
Base.insert!
Base.isless
Base.iterate
Base.iterate
Base.iterate
Base.iterate
Base.iterate
Base.iterate
Base.iterate
Base.length
Base.length
Base.length
Base.length
Base.push!
Base.rand
Base.rand
Base.rand
Base.show
Base.size
Base.size
Base.sum
HerbConstraints._contains
HerbConstraints._count_occurrences
HerbConstraints._count_occurrences
HerbConstraints._count_occurrences!
HerbConstraints._exchange_positions!
HerbConstraints._update_bounds_val_removed!
HerbConstraints._update_max_val_removed!
HerbConstraints._update_min_val_removed!
HerbConstraints.annotation2constraint
HerbConstraints.are_disjoint
HerbConstraints.are_disjoint
HerbConstraints.backup!
HerbConstraints.check_tree
HerbConstraints.check_tree
HerbConstraints.check_tree
HerbConstraints.check_tree
HerbConstraints.check_tree
HerbConstraints.check_tree
HerbConstraints.contains_varnode
HerbConstraints.deactivate!
HerbConstraints.deactivate!
HerbConstraints.decrement!
HerbConstraints.fix_point!
HerbConstraints.freeze_state
HerbConstraints.get_grammar
HerbConstraints.get_grammar
HerbConstraints.get_hole_at_location
HerbConstraints.get_hole_at_location
HerbConstraints.get_intersection
HerbConstraints.get_max_depth
HerbConstraints.get_max_size
HerbConstraints.get_nodes
HerbConstraints.get_nodes_on_path
HerbConstraints.get_priority
HerbConstraints.get_starting_symbol
HerbConstraints.get_state
HerbConstraints.get_tree
HerbConstraints.get_tree
HerbConstraints.get_tree_size
HerbConstraints.get_value
HerbConstraints.increment!
HerbConstraints.is_subdomain
HerbConstraints.is_subdomain
HerbConstraints.isfeasible
HerbConstraints.isfeasible
HerbConstraints.load_state!
HerbConstraints.make_equal!
HerbConstraints.make_less_than_or_equal!
HerbConstraints.make_less_than_or_equal!
HerbConstraints.make_less_than_or_equal!
HerbConstraints.new_state!
HerbConstraints.notify_new_node
HerbConstraints.notify_new_nodes
HerbConstraints.notify_new_nodes
HerbConstraints.notify_tree_manipulation
HerbConstraints.notify_tree_manipulation
HerbConstraints.partition
HerbConstraints.pattern_match
HerbConstraints.pattern_match
HerbConstraints.pattern_match
HerbConstraints.pattern_match
HerbConstraints.pattern_match
HerbConstraints.pattern_match
HerbConstraints.post!
HerbConstraints.post!
HerbConstraints.propagate!
HerbConstraints.propagate!
HerbConstraints.propagate!
HerbConstraints.propagate!
HerbConstraints.propagate!
HerbConstraints.propagate!
HerbConstraints.propagate!
HerbConstraints.remove!
HerbConstraints.remove!
HerbConstraints.remove!
HerbConstraints.remove!
HerbConstraints.remove!
HerbConstraints.remove_above!
HerbConstraints.remove_above!
HerbConstraints.remove_above!
HerbConstraints.remove_all_but!
HerbConstraints.remove_all_but!
HerbConstraints.remove_all_but!
HerbConstraints.remove_all_but!
HerbConstraints.remove_below!
HerbConstraints.remove_below!
HerbConstraints.remove_below!
HerbConstraints.remove_node!
HerbConstraints.restore!
HerbConstraints.restore!
HerbConstraints.restore!
HerbConstraints.save_state!
HerbConstraints.save_state!
HerbConstraints.save_state!
HerbConstraints.schedule!
HerbConstraints.set_infeasible!
HerbConstraints.set_infeasible!
HerbConstraints.set_value!
HerbConstraints.shouldschedule
HerbConstraints.shouldschedule
HerbConstraints.simplify_hole!
HerbConstraints.substitute!
HerbCore.contains_hole
HerbCore.contains_hole
HerbCore.contains_nonuniform_hole
HerbCore.depth
HerbCore.get_children
HerbCore.get_node_at_location
HerbCore.get_node_at_location
HerbCore.get_node_at_location
HerbCore.get_node_at_location
HerbCore.get_path
HerbCore.get_path
HerbCore.get_path
HerbCore.get_rule
HerbCore.get_rule
HerbCore.get_rulesequence
HerbCore.hasdynamicvalue
HerbCore.have_same_shape
HerbCore.isfilled
HerbCore.isfilled
HerbCore.isuniform
HerbCore.node_depth
HerbCore.number_of_holes
HerbCore.rulesoftype
HerbCore.rulesonleft
HerbCore.swap_node
HerbCore.swap_node
HerbGrammar.add_rule!
HerbGrammar.add_rule!
HerbGrammar.addconstraint!
HerbGrammar.child_types
HerbGrammar.child_types
HerbGrammar.cleanup_removed_rules!
HerbGrammar.clearconstraints!
HerbGrammar.containedin
HerbGrammar.contains_returntype
HerbGrammar.expr2csgrammar
HerbGrammar.expr2pcsgrammar
HerbGrammar.get_childtypes
HerbGrammar.get_domain
HerbGrammar.get_domain
HerbGrammar.get_rulesequence
HerbGrammar.iscomplete
HerbGrammar.iseval
HerbGrammar.iseval
HerbGrammar.iseval
HerbGrammar.isprobabilistic
HerbGrammar.isterminal
HerbGrammar.isterminal
HerbGrammar.isterminal
HerbGrammar.isvariable
HerbGrammar.isvariable
HerbGrammar.isvariable
HerbGrammar.isvariable
HerbGrammar.log_probability
HerbGrammar.max_arity
HerbGrammar.merge_grammars!
HerbGrammar.mindepth
HerbGrammar.mindepth_map
HerbGrammar.nchildren
HerbGrammar.nchildren
HerbGrammar.nonterminals
HerbGrammar.normalize!
HerbGrammar.parse_probabilistic_rule
HerbGrammar.probability
HerbGrammar.read_csg
HerbGrammar.read_pcsg
HerbGrammar.remove_rule!
HerbGrammar.return_type
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_csg
HerbGrammar.subsequenceof
HerbGrammar.swap_node
HerbGrammar.swap_node
HerbInterpret.evaluate_program
HerbInterpret.execute_on_input
HerbInterpret.execute_on_input
HerbInterpret.execute_on_input
HerbInterpret.execute_on_input
HerbInterpret.interpret
HerbInterpret.test_all_examples
HerbInterpret.test_examples
HerbSearch._calculate_cost
HerbSearch._find_next_complete_tree
HerbSearch._find_next_complete_tree
HerbSearch.best_accept
HerbSearch.calculate_cost
HerbSearch.const_temperature
HerbSearch.constructNeighbourhood
HerbSearch.constructNeighbourhoodRuleSubset
HerbSearch.cross_over
HerbSearch.crossover_swap_children_1
HerbSearch.crossover_swap_children_2
HerbSearch.decreasing_temperature
HerbSearch.default_fitness
HerbSearch.derivation_heuristic
HerbSearch.derivation_heuristic
HerbSearch.enumerate_neighbours_propose
HerbSearch.evaluate
HerbSearch.extract_name_from_argument
HerbSearch.fitness
HerbSearch.generate_branches
HerbSearch.get_best_program
HerbSearch.heuristic_leftmost
HerbSearch.heuristic_leftmost_fixed_shaped_hole
HerbSearch.heuristic_random
HerbSearch.heuristic_rightmost
HerbSearch.heuristic_smallest_domain
HerbSearch.hole_heuristic
HerbSearch.hole_heuristic
HerbSearch.is_field_decl
HerbSearch.is_kwdef
HerbSearch.mean_squared_error
HerbSearch.misclassification
HerbSearch.mutate!
HerbSearch.mutate_random!
HerbSearch.next_solution!
HerbSearch.priority_function
HerbSearch.priority_function
HerbSearch.priority_function
HerbSearch.priority_function
HerbSearch.priority_function
HerbSearch.priority_function
HerbSearch.probabilistic_accept
HerbSearch.probabilistic_accept_with_temperature
HerbSearch.probabilistic_accept_with_temperature_fraction
HerbSearch.processkwarg!
HerbSearch.random_fill_propose
HerbSearch.select_chromosome
HerbSearch.select_fitness_proportional_parents
HerbSearch.select_parents
HerbSearch.set_stateholes!
HerbSearch.synth
HerbSearch.validate_iterator
StatsBase.sample
StatsBase.sample
StatsBase.sample
StatsBase.sample
HerbConstraints.@csgrammar_annotated
HerbGrammar.@cfgrammar
HerbGrammar.@csgrammar
HerbGrammar.@pcsgrammar
HerbSearch.@programiterator
Settings
This document was generated with Documenter.jl version 1.5.0 on Tuesday 9 July 2024. Using Julia version 1.10.4.
+restore!(sm) #restores a to value 10
HerbConstraints.check_tree
— Methodcheck_tree(c::Contains, tree::AbstractRuleNode)::Bool
Checks if the given AbstractRuleNode
tree abides the Contains
constraint.
HerbConstraints.check_tree
— Methodcheck_tree(c::ContainsSubtree, tree::AbstractRuleNode)::Bool
Checks if the given AbstractRuleNode
tree abides the ContainsSubtree
constraint.
HerbConstraints.check_tree
— Methodcheck_tree(c::Forbidden, tree::AbstractRuleNode)::Bool
Checks if the given AbstractRuleNode
tree abides the Forbidden
constraint.
HerbConstraints.check_tree
— Methodcheck_tree(c::ForbiddenSequence, tree::AbstractRuleNode; sequence_started=false)::Bool
Checks if the given AbstractRuleNode
tree abides the ForbiddenSequence
constraint.
HerbConstraints.check_tree
— Methodcheck_tree(c::Ordered, tree::AbstractRuleNode)::Bool
Checks if the given AbstractRuleNode
tree abides the Ordered
constraint.
HerbConstraints.check_tree
— Methodfunction check_tree(c::Unique, tree::AbstractRuleNode)::Bool
Checks if the given AbstractRuleNode
tree abides the Unique
constraint.
HerbConstraints.contains_varnode
— Methodcontains_varnode(rn::AbstractRuleNode, name::Symbol)
Checks if an AbstractRuleNode
tree contains a VarNode
with the given name
.
HerbConstraints.deactivate!
— Methoddeactivate!(solver::GenericSolver, constraint::AbstractLocalConstraint)
Function that should be called whenever the constraint is already satisfied and never has to be repropagated.
HerbConstraints.deactivate!
— Methoddeactivate!(solver::UniformSolver, constraint::AbstractLocalConstraint)
Function that should be called whenever the constraint is already satisfied and never has to be repropagated.
HerbConstraints.decrement!
— MethodDecrease the value of the integer by 1
HerbConstraints.fix_point!
— Methodfix_point!(solver::Solver)
Propagate constraints in the current state until no further dedecutions can be made
HerbConstraints.freeze_state
— Methodfreeze_state(hole::StateHole)::RuleNode
Converts a [StateHole
])(@ref) to a [RuleNode
]@(ref). The hole and its children are assumed to be filled.
HerbConstraints.get_grammar
— Methodfunction get_grammar(solver::GenericSolver)::AbstractGrammar
Get the grammar.
HerbConstraints.get_grammar
— Methodfunction get_grammar(solver::UniformSolver)::AbstractGrammar
Get the grammar.
HerbConstraints.get_hole_at_location
— Methodget_hole_at_location(solver::GenericSolver, location::Vector{Int})::AbstractHole
Get the node at path location
and assert it is a AbstractHole
.
HerbConstraints.get_hole_at_location
— Methodget_hole_at_location(solver::UniformSolver, path::Vector{Int})
Get the hole that is located at the provided path
.
HerbConstraints.get_intersection
— Methodget_intersection(domain1::BitVector, domain2::BitVector)::Bool
Returns all the values that are in both domain1
and domain2
HerbConstraints.get_max_depth
— Methodfunction get_max_depth(solver::GenericSolver)::SolverState
Get the maximum depth of the tree.
HerbConstraints.get_max_size
— Methodfunction get_max_depth(solver::GenericSolver)::SolverState
Get the maximum number of AbstractRuleNode
s allowed inside the tree.
HerbConstraints.get_nodes
— Methodget_nodes(solver)
Return an iterator over all nodes in the tree
HerbConstraints.get_nodes_on_path
— Methodfunction get_nodes_on_path(root::AbstractRuleNode, path::Vector{Int})::Vector{AbstractRuleNode}
Gets a list of nodes on the path
, starting (and including) the root
.
HerbConstraints.get_priority
— Methodfunction get_priority(::AbstractLocalConstraint)
Used to determine which constraint to propagate first in fix_point!
. Constraints with fast propagators and/or strong inference should be propagated first.
HerbConstraints.get_starting_symbol
— Methodfunction get_starting_symbol(solver::GenericSolver)::Symbol
Get the symbol from the solver.
HerbConstraints.get_state
— Methodfunction get_state(solver::GenericSolver)::SolverState
Get the current [SolverState
]@(ref) of the solver.
HerbConstraints.get_tree
— Methodfunction get_tree(solver::GenericSolver)::AbstractRuleNode
Returns the number of AbstractRuleNode
s in the tree.
HerbConstraints.get_tree
— Methodfunction get_tree(solver::UniformSolver)::AbstractRuleNode
Get the root of the tree. This remains the same instance throughout the entire search.
HerbConstraints.get_tree_size
— Methodfunction get_tree_size(solver::GenericSolver)::Int
Returns the number of AbstractRuleNode
s in the tree.
HerbConstraints.get_value
— MethodGet the value of the stateful integer
HerbConstraints.increment!
— MethodIncrease the value of the integer by 1
HerbConstraints.is_subdomain
— Methodis_subdomain(specific_tree::AbstractRuleNode, general_tree::AbstractRuleNode)
Checks if the specific_tree
can be obtained by repeatedly removing values from the general_tree
HerbConstraints.is_subdomain
— Method is_subdomain(subdomain::BitVector, domain::BitVector)
Checks if subdomain
is a subdomain of domain
. Example: [0, 0, 1, 0] is a subdomain of [0, 1, 1, 1]
HerbConstraints.isfeasible
— Methodisfeasible(solver::GenericSolver)
Returns true if no inconsistency has been detected. Used in several ways:
- Iterators should check for infeasibility to discard infeasible states
- After any tree manipulation with the possibility of an inconsistency (e.g.
remove_below!
,remove_above!
,remove!
) fix_point!
should check for infeasibility to clear its schedule and return- Some
GenericSolver
functions assert a feasible state for debugging purposes@assert isfeasible(solver)
- Some
GenericSolver
functions have a guard that skip the function on an infeasible state:if !isfeasible(solver) return end
HerbConstraints.isfeasible
— Methodisfeasible(solver::UniformSolver)
Returns true if no inconsistency has been detected.
HerbConstraints.load_state!
— Methodload_state!(solver::GenericSolver, state::SolverState)
Overwrites the current state with the given state
HerbConstraints.make_equal!
— Methodfunction make_equal!(solver::Solver, node1::AbstractRuleNode, node2::AbstractRuleNode)::MakeEqualResult
Tree manipulation that enforces node1
== node2
if unambiguous.
HerbConstraints.make_less_than_or_equal!
— Methodfunction make_less_than_or_equal!(h1::Union{RuleNode, AbstractHole}, h2::Union{RuleNode, AbstractHole}, guards::Vector{Tuple{AbstractHole, Int}})::LessThanOrEqualResult
Helper function that keeps track of the guards
HerbConstraints.make_less_than_or_equal!
— Methodfunction make_less_than_or_equal!(h1::Union{RuleNode, AbstractHole}, h2::Union{RuleNode, AbstractHole})::LessThanOrEqualResult
Ensures that n1<=n2 by removing impossible values from holes. Returns one of the following results:
LessThanOrEqualSuccess
. When [n1<=n2].LessThanOrEqualHardFail
. When [n1>n2] or when the solver state is infeasible.LessThanOrEqualSoftFail
. When no further deductions can be made, but [n1<=n2] and [n1>n2] are still possible.
HerbConstraints.make_less_than_or_equal!
— Methodfunction make_less_than_or_equal!(solver::Solver, nodes1::Vector{AbstractRuleNode}, nodes2::Vector{AbstractRuleNode}, guards::Vector{Tuple{AbstractHole, Int}})::LessThanOrEqualResult
Helper function that tiebreaks on children.
HerbConstraints.new_state!
— Methodnew_state!(solver::GenericSolver, tree::AbstractRuleNode)
Overwrites the current state and propagates constraints on the tree
from the ground up
HerbConstraints.notify_new_node
— Methodnotify_new_node(solver::GenericSolver, event_path::Vector{Int})
Notify all constraints that a new node has appeared at the event_path
by calling their respective on_new_node
function.
This does not notify the solver about nodes below the event_path
. In that case, call notify_new_nodes
instead.
HerbConstraints.notify_new_nodes
— Methodnotify_new_nodes(solver::GenericSolver, node::AbstractRuleNode, path::Vector{Int})
Notify all grammar constraints about the new node
and its (grand)children
HerbConstraints.notify_new_nodes
— Methodnotify_new_nodes(solver::UniformSolver, node::AbstractRuleNode, path::Vector{Int})
Notify all grammar constraints about the new node
and its (grand)children
HerbConstraints.notify_tree_manipulation
— Methodnotify_tree_manipulation(solver::GenericSolver, event_path::Vector{Int})
Notify subscribed constraints that a tree manipulation has occured at the event_path
by scheduling them for propagation
HerbConstraints.notify_tree_manipulation
— Methodnotify_tree_manipulation(solver::UniformSolver, event_path::Vector{Int})
Notify subscribed constraints that a tree manipulation has occured at the event_path
by scheduling them for propagation
HerbConstraints.partition
— Methodpartition(hole::Hole, grammar::ContextSensitiveGrammar)::Vector{BitVector}
Partition a Hole into subdomains grouped by childtypes
HerbConstraints.pattern_match
— MethodGeneric fallback function for commutativity. Swaps arguments 1 and 2, then dispatches to a more specific signature. If this gets stuck in an infinite loop, the implementation of an AbstractRuleNode type pair is missing.
HerbConstraints.pattern_match
— Methodpattern_match(rn::AbstractRuleNode, mn::AbstractRuleNode)::PatternMatchResult
Recursively tries to match AbstractRuleNode
rn
with AbstractRuleNode
mn
. Returns a PatternMatchResult
that describes if the pattern was matched.
HerbConstraints.pattern_match
— Methodpattern_match(node::AbstractRuleNode, domainrulenode::DomainRuleNode, vars::Dict{Symbol, AbstractRuleNode})::PatternMatchResult
Comparing any AbstractRuleNode
with a DomainRuleNode
HerbConstraints.pattern_match
— Methodpattern_match(rn::AbstractRuleNode, var::VarNode, vars::Dict{Symbol, AbstractRuleNode})::PatternMatchResult
Comparing any AbstractRuleNode
with a named VarNode
HerbConstraints.pattern_match
— Methodpattern_match(h1::Union{RuleNode, AbstractHole}, h2::Union{RuleNode, AbstractHole}, vars::Dict{Symbol, AbstractRuleNode})::PatternMatchResult
Comparing any pair of Rulenode
and/or AbstractHole
. It is important to note that some AbstractHole
s are already filled and should be treated as RuleNode
. This is why this function is dispatched on (isfilled(h1), isfilled(h2))
. The '(RuleNode, AbstractHole)' case could still include two nodes of type AbstractHole
, but one of them should be treated as a rulenode.
HerbConstraints.pattern_match
— Methodpattern_match(rns::Vector{AbstractRuleNode}, mns::Vector{AbstractRuleNode}, vars::Dict{Symbol, AbstractRuleNode})::PatternMatchResult
Pairwise tries to match two ordered lists of AbstractRuleNodes. Typically, this function is used to pattern match the children two AbstractRuleNodes.
HerbConstraints.post!
— Methodpost!(solver::GenericSolver, constraint::AbstractLocalConstraint)
Imposes the constraint
to the current state. By default, the constraint will be scheduled for its initial propagation. Constraints can overload this method to add themselves to notify lists or triggers.
HerbConstraints.post!
— Methodpost!(solver::UniformSolver, constraint::AbstractLocalConstraint)
Post a new local constraint. Converts the constraint to a state constraint and schedules it for propagation.
HerbConstraints.propagate!
— Methodfunction propagate!(::GenericSolver, ::LocalContainsSubtree)
!!! warning: LocalContainsSubtree uses stateful properties and can therefore not be propagated in the GenericSolver. (The GenericSolver shares constraints among different states, so they cannot use stateful properties)
HerbConstraints.propagate!
— Methodfunction propagate!(solver::Solver, c::LocalContains)
Enforce that the rule
appears at or below the path
at least once. Uses a helper function to retrieve a list of holes that can potentially hold the target rule. If there is only a single hole that can potentially hold the target rule, that hole will be filled with that rule.
HerbConstraints.propagate!
— Methodfunction propagate!(solver::Solver, c::LocalForbiddenSequence)
HerbConstraints.propagate!
— Methodfunction propagate!(solver::Solver, c::LocalForbidden)
Enforce that the forbidden tree
does not occur at the path
. The forbidden tree is matched against the AbstractRuleNode
located at the path. Deductions are based on the type of the PatternMatchResult
returned by the pattern_match
function.
HerbConstraints.propagate!
— Methodfunction propagate!(solver::Solver, c::LocalOrdered)
Enforce that the VarNode
s in the tree
are in the specified order
. First the node located at the path
is matched to see if the ordered constraint applies here. The nodes matching the variables are stored in the vars
dictionary. Then the order
is enforced within the make_less_than_or_equal!
tree manipulation.
HerbConstraints.propagate!
— Methodfunction propagate!(solver::Solver, c::LocalUnique)
Enforce that the rule
appears at or below the path
at least once. Uses a helper function to retrieve a list of holes that can potentially hold the target rule. If there is only a single hole that can potentially hold the target rule, that hole will be filled with that rule.
HerbConstraints.propagate!
— Methodfunction propagate!(solver::UniformSolver, c::LocalContainsSubtree)
Enforce that the tree
appears at or below the path
at least once. Nodes that can potentially become the target sub-tree are considered candidates
. In case of multiple candidates, a stateful set of indices
is used to keep track of active candidates.
HerbConstraints.remove!
— Methodremove!(solver::GenericSolver, path::Vector{Int}, rule_index::Int)
Remove rule_index
from the domain of the hole located at the path
. It is assumed the path points to a hole, otherwise an exception will be thrown.
HerbConstraints.remove!
— Methodremove!(solver::GenericSolver, path::Vector{Int}, rules::Vector{Int})
Remove all rules
from the domain of the hole located at the path
. It is assumed the path points to a hole, otherwise an exception will be thrown.
HerbConstraints.remove!
— Methodremove!(set::StateSparseSet, val::Int)
Removes value val
from StateSparseSet set
. Returns true if val
was in set
.
HerbConstraints.remove!
— Methodremove!(solver::Solver, path::Vector{Int}, rule_index::Int)
Remove rule_index
from the domain of the hole located at the path
. It is assumed the path points to a hole, otherwise an exception will be thrown.
HerbConstraints.remove!
— Methodremove!(solver::UniformSolver, path::Vector{Int}, rules::Vector{Int})
Remove all rules
from the domain of the hole located at the path
. It is assumed the path points to a hole, otherwise an exception will be thrown.
HerbConstraints.remove_above!
— Methodremove_above!(solver::GenericSolver, path::Vector{Int}, rule_index::Int)
Reduce the domain of the hole located at the path
by removing all rules indices above rule_index
Example: rule_index
= 2. hole
with domain [1, 1, 0, 1] gets reduced to [1, 0, 0, 0] and gets simplified to a RuleNode
HerbConstraints.remove_above!
— MethodRemove all the values greater than val
from the set
HerbConstraints.remove_above!
— Methodremove_above!(solver::UniformSolver, path::Vector{Int}, rule_index::Int)
Reduce the domain of the hole located at the path
by removing all rules indices above rule_index
Example: rule_index
= 2. hole
with domain {1, 2, 4} gets reduced to {1}
HerbConstraints.remove_all_but!
— Methodremove_all_but!(solver::GenericSolver, path::Vector{Int}, new_domain::BitVector)
Reduce the domain of the hole located at the path
, to the new_domain
. It is assumed the path points to a hole, otherwise an exception will be thrown. It is assumed new_domain ⊆ domain. For example: [1, 0, 1, 0] ⊆ [1, 0, 1, 1]
HerbConstraints.remove_all_but!
— Methodremove_all_but!(solver::GenericSolver, path::Vector{Int}, rule_index::Int)
Fill in the hole located at the path
with rule rule_index
. It is assumed the path points to a hole, otherwise an exception will be thrown. It is assumed rule_index ∈ hole.domain.
!!! warning: If the hole
is known to be in the current tree, the hole can be passed directly. The caller has to make sure that the hole instance is actually present at the provided path
.
HerbConstraints.remove_all_but!
— Methodremove_all_but!(set::StateSparseSet, val::Int)::Bool
Removes all values from StateSparseSet set
, except val
HerbConstraints.remove_all_but!
— Methodremove_all_but!(solver::UniformSolver, path::Vector{Int}, rule_index::Int)
Fill in the hole located at the path
with rule rule_index
.
HerbConstraints.remove_below!
— Methodremove_below!(solver::GenericSolver, path::Vector{Int}, rule_index::Int)
Reduce the domain of the hole located at the path
by removing all rules indices below rule_index
Example: rule_index
= 2. hole
with domain [1, 1, 0, 1] gets reduced to [0, 1, 0, 1]
HerbConstraints.remove_below!
— MethodRemove all the values less than val
from the set
HerbConstraints.remove_below!
— Methodremove_below!(solver::UniformSolver, path::Vector{Int}, rule_index::Int)
Reduce the domain of the hole located at the path
by removing all rules indices below rule_index
Example: rule_index
= 2. hole
with domain {1, 2, 4} gets reduced to {2, 4}
HerbConstraints.remove_node!
— Methodfunction remove_node!(solver::GenericSolver, path::Vector{Int})
Remove the node at the given path
by substituting it with a hole of the same symbol.
HerbConstraints.restore!
— MethodRestores the StateInt
stored in the StateIntBackup
to its original value
HerbConstraints.restore!
— MethodReverts all the backups since the last save_state!
.
HerbConstraints.restore!
— MethodRestore state of the solver until the last save_state!
HerbConstraints.save_state!
— Methodsave_state!(solver::GenericSolver)
Returns a copy of the current state that can be restored by calling load_state!(solver, state)
HerbConstraints.save_state!
— MethodMake a backup of the current state. Return to this state by calling restore!
.
HerbConstraints.save_state!
— MethodSave the current state of the solver, can restored using restore!
HerbConstraints.schedule!
— Methodschedule(solver::GenericSolver, constraint::AbstractLocalConstraint)
Schedules the constraint
for propagation.
HerbConstraints.set_infeasible!
— Methodset_infeasible!(solver::GenericSolver)
Function to be called if any inconsistency has been detected
HerbConstraints.set_infeasible!
— Methodset_infeasible!(solver::Solver)
Function to be called if any inconsistency has been detected
HerbConstraints.set_value!
— MethodSet the value of the integer to the given val
HerbConstraints.shouldschedule
— Methodshouldschedule(solver::Solver, constraint::AbstractLocalConstraint, path::Vector{Int})::Bool
Function that is called when a tree manipulation occured at the path
. Returns true if the constraint
should be scheduled for propagation.
Default behavior: return true iff the manipulation happened at or below the constraint path.
HerbConstraints.shouldschedule
— Methodshouldschedule(::Solver, constraint::LocalForbiddenSequence, path::Vector{Int})::Bool
Return true iff the manipulation happened at or above the constraint path.
HerbConstraints.simplify_hole!
— Methodsimplify_hole!(solver::GenericSolver, path::Vector{Int})
Takes a Hole and tries to simplify it to a UniformHole or RuleNode. If the domain of the hole is empty, the state will be marked as infeasible
HerbConstraints.substitute!
— Methodsubstitute!(solver::GenericSolver, path::Vector{Int}, new_node::AbstractRuleNode; is_domain_increasing::Union{Nothing, Bool}=nothing)
Substitute the node at the path
, with a new_node
.
is_domain_increasing
: indicates if all grammar constraints should be repropagated from the ground up.
Domain increasing substitutions are substitutions that cannot be achieved by repeatedly removing values from domains. Example of an domain increasing event: hole[{3, 4, 5}] -> hole[{1, 2}]
. Example of an domain decreasing event: hole[{3, 4, 5}] -> rulenode(4, [hole[{1, 2}], rulenode(1)])
.
HerbCore.contains_hole
— Methodcontains_hole(hole::StateHole)::Bool
Returns true if the hole
or any of its (grand)children are not filled.
HerbCore.get_node_at_location
— MethodHerbCore.get_node_at_location(solver::GenericSolver, location::Vector{Int})::AbstractRuleNode
Get the node at path location
.
HerbCore.get_node_at_location
— Methodget_node_at_location(solver::UniformSolver, path::Vector{Int})
Get the node that is located at the provided path
.
HerbCore.get_path
— Methodget_path(solver::GenericSolver, node::AbstractRuleNode)
Get the path at which the node
is located.
HerbCore.get_path
— Methodget_path(solver::UniformSolver, node::AbstractRuleNode)
Get the path at which the node
is located.
HerbCore.get_rule
— Methodget_rule(hole::StateHole)::Int
Assuming the hole has domain size 1, get the rule it is currently assigned to.
HerbCore.isfilled
— Methodisfilled(hole::StateHole)::Bool
Holes with domain size 1 are fixed to a rule. Returns whether the hole has domain size 1. (holes with an empty domain are not considered to be fixed)
Index
HerbConstraints.AbstractGrammarConstraint
HerbConstraints.AbstractLocalConstraint
HerbConstraints.AbstractStateManager
HerbConstraints.Contains
HerbConstraints.ContainsSubtree
HerbConstraints.DomainRuleNode
HerbConstraints.Forbidden
HerbConstraints.ForbiddenSequence
HerbConstraints.GenericSolver
HerbConstraints.GenericSolver
HerbConstraints.GenericSolver
HerbConstraints.LessThanOrEqualHardFail
HerbConstraints.LessThanOrEqualResult
HerbConstraints.LessThanOrEqualSoftFail
HerbConstraints.LessThanOrEqualSuccess
HerbConstraints.LessThanOrEqualSuccessEquality
HerbConstraints.LessThanOrEqualSuccessLessThan
HerbConstraints.LessThanOrEqualSuccessWithHoles
HerbConstraints.LocalContains
HerbConstraints.LocalContainsSubtree
HerbConstraints.LocalContainsSubtree
HerbConstraints.LocalForbidden
HerbConstraints.LocalForbiddenSequence
HerbConstraints.LocalOrdered
HerbConstraints.LocalUnique
HerbConstraints.MakeEqualHardFail
HerbConstraints.MakeEqualResult
HerbConstraints.MakeEqualSoftFail
HerbConstraints.MakeEqualSuccess
HerbConstraints.Ordered
HerbConstraints.PatternMatchHardFail
HerbConstraints.PatternMatchResult
HerbConstraints.PatternMatchSoftFail
HerbConstraints.PatternMatchSuccess
HerbConstraints.PatternMatchSuccessWhenHoleAssignedTo
HerbConstraints.Solver
HerbConstraints.SolverState
HerbConstraints.SolverStatistics
HerbConstraints.StateHole
HerbConstraints.StateHole
HerbConstraints.StateHole
HerbConstraints.StateInt
HerbConstraints.StateIntBackup
HerbConstraints.StateManager
HerbConstraints.StateSparseSet
HerbConstraints.StateSparseSet
HerbConstraints.StateStack
HerbConstraints.StateStack
HerbConstraints.StateStack
HerbConstraints.UniformSolver
HerbConstraints.UniformSolver
HerbConstraints.Unique
HerbConstraints.VarNode
HerbCore.AbstractConstraint
HerbCore.AbstractGrammar
HerbCore.AbstractHole
HerbCore.AbstractRuleNode
HerbCore.AbstractUniformHole
HerbCore.Hole
HerbCore.HoleReference
HerbCore.RuleNode
HerbCore.RuleNode
HerbCore.RuleNode
HerbCore.UniformHole
HerbGrammar.ContextSensitiveGrammar
HerbGrammar.NodeLoc
HerbGrammar.SymbolTable
HerbGrammar.SymbolTable
HerbSearch.BFSIterator
HerbSearch.DFSIterator
HerbSearch.ExpandFailureReason
HerbSearch.FixedShapedIterator
HerbSearch.GeneticSearchIterator
HerbSearch.MHSearchIterator
HerbSearch.MLFSIterator
HerbSearch.ProgramIterator
HerbSearch.RandomIterator
HerbSearch.SASearchIterator
HerbSearch.StochasticSearchIterator
HerbSearch.SynthResult
HerbSearch.TopDownIterator
HerbSearch.UniformIterator
HerbSearch.UniformIterator
HerbSearch.VLSNSearchIterator
HerbSpecification.AbstractDependentTypeSpecification
HerbSpecification.AgdaSpecification
HerbSpecification.IOExample
HerbSpecification.MetricProblem
HerbSpecification.Problem
HerbSpecification.SMTSpecification
HerbSpecification.Trace
Base.collect
Base.collect
Base.findall
Base.findfirst
Base.findlast
Base.get
Base.getindex
Base.getindex
Base.in
Base.in
Base.insert!
Base.isless
Base.iterate
Base.iterate
Base.iterate
Base.iterate
Base.iterate
Base.iterate
Base.iterate
Base.length
Base.length
Base.length
Base.length
Base.push!
Base.rand
Base.rand
Base.rand
Base.show
Base.size
Base.size
Base.sum
HerbConstraints._contains
HerbConstraints._count_occurrences
HerbConstraints._count_occurrences
HerbConstraints._count_occurrences!
HerbConstraints._exchange_positions!
HerbConstraints._update_bounds_val_removed!
HerbConstraints._update_max_val_removed!
HerbConstraints._update_min_val_removed!
HerbConstraints.annotation2constraint
HerbConstraints.are_disjoint
HerbConstraints.are_disjoint
HerbConstraints.backup!
HerbConstraints.check_tree
HerbConstraints.check_tree
HerbConstraints.check_tree
HerbConstraints.check_tree
HerbConstraints.check_tree
HerbConstraints.check_tree
HerbConstraints.contains_varnode
HerbConstraints.deactivate!
HerbConstraints.deactivate!
HerbConstraints.decrement!
HerbConstraints.fix_point!
HerbConstraints.freeze_state
HerbConstraints.get_grammar
HerbConstraints.get_grammar
HerbConstraints.get_hole_at_location
HerbConstraints.get_hole_at_location
HerbConstraints.get_intersection
HerbConstraints.get_max_depth
HerbConstraints.get_max_size
HerbConstraints.get_nodes
HerbConstraints.get_nodes_on_path
HerbConstraints.get_priority
HerbConstraints.get_starting_symbol
HerbConstraints.get_state
HerbConstraints.get_tree
HerbConstraints.get_tree
HerbConstraints.get_tree_size
HerbConstraints.get_value
HerbConstraints.increment!
HerbConstraints.is_subdomain
HerbConstraints.is_subdomain
HerbConstraints.isfeasible
HerbConstraints.isfeasible
HerbConstraints.load_state!
HerbConstraints.make_equal!
HerbConstraints.make_less_than_or_equal!
HerbConstraints.make_less_than_or_equal!
HerbConstraints.make_less_than_or_equal!
HerbConstraints.new_state!
HerbConstraints.notify_new_node
HerbConstraints.notify_new_nodes
HerbConstraints.notify_new_nodes
HerbConstraints.notify_tree_manipulation
HerbConstraints.notify_tree_manipulation
HerbConstraints.partition
HerbConstraints.pattern_match
HerbConstraints.pattern_match
HerbConstraints.pattern_match
HerbConstraints.pattern_match
HerbConstraints.pattern_match
HerbConstraints.pattern_match
HerbConstraints.post!
HerbConstraints.post!
HerbConstraints.propagate!
HerbConstraints.propagate!
HerbConstraints.propagate!
HerbConstraints.propagate!
HerbConstraints.propagate!
HerbConstraints.propagate!
HerbConstraints.propagate!
HerbConstraints.remove!
HerbConstraints.remove!
HerbConstraints.remove!
HerbConstraints.remove!
HerbConstraints.remove!
HerbConstraints.remove_above!
HerbConstraints.remove_above!
HerbConstraints.remove_above!
HerbConstraints.remove_all_but!
HerbConstraints.remove_all_but!
HerbConstraints.remove_all_but!
HerbConstraints.remove_all_but!
HerbConstraints.remove_below!
HerbConstraints.remove_below!
HerbConstraints.remove_below!
HerbConstraints.remove_node!
HerbConstraints.restore!
HerbConstraints.restore!
HerbConstraints.restore!
HerbConstraints.save_state!
HerbConstraints.save_state!
HerbConstraints.save_state!
HerbConstraints.schedule!
HerbConstraints.set_infeasible!
HerbConstraints.set_infeasible!
HerbConstraints.set_value!
HerbConstraints.shouldschedule
HerbConstraints.shouldschedule
HerbConstraints.simplify_hole!
HerbConstraints.substitute!
HerbCore.contains_hole
HerbCore.contains_hole
HerbCore.contains_nonuniform_hole
HerbCore.depth
HerbCore.get_children
HerbCore.get_node_at_location
HerbCore.get_node_at_location
HerbCore.get_node_at_location
HerbCore.get_node_at_location
HerbCore.get_path
HerbCore.get_path
HerbCore.get_path
HerbCore.get_rule
HerbCore.get_rule
HerbCore.get_rulesequence
HerbCore.hasdynamicvalue
HerbCore.have_same_shape
HerbCore.isfilled
HerbCore.isfilled
HerbCore.isuniform
HerbCore.node_depth
HerbCore.number_of_holes
HerbCore.rulesoftype
HerbCore.rulesonleft
HerbCore.swap_node
HerbCore.swap_node
HerbGrammar.add_rule!
HerbGrammar.add_rule!
HerbGrammar.addconstraint!
HerbGrammar.child_types
HerbGrammar.child_types
HerbGrammar.cleanup_removed_rules!
HerbGrammar.clearconstraints!
HerbGrammar.containedin
HerbGrammar.contains_returntype
HerbGrammar.expr2csgrammar
HerbGrammar.expr2pcsgrammar
HerbGrammar.get_childtypes
HerbGrammar.get_domain
HerbGrammar.get_domain
HerbGrammar.get_rulesequence
HerbGrammar.iscomplete
HerbGrammar.iseval
HerbGrammar.iseval
HerbGrammar.iseval
HerbGrammar.isprobabilistic
HerbGrammar.isterminal
HerbGrammar.isterminal
HerbGrammar.isterminal
HerbGrammar.isvariable
HerbGrammar.isvariable
HerbGrammar.isvariable
HerbGrammar.isvariable
HerbGrammar.log_probability
HerbGrammar.max_arity
HerbGrammar.merge_grammars!
HerbGrammar.mindepth
HerbGrammar.mindepth_map
HerbGrammar.nchildren
HerbGrammar.nchildren
HerbGrammar.nonterminals
HerbGrammar.normalize!
HerbGrammar.parse_probabilistic_rule
HerbGrammar.probability
HerbGrammar.read_csg
HerbGrammar.read_pcsg
HerbGrammar.remove_rule!
HerbGrammar.return_type
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_csg
HerbGrammar.subsequenceof
HerbGrammar.swap_node
HerbGrammar.swap_node
HerbInterpret.evaluate_program
HerbInterpret.execute_on_input
HerbInterpret.execute_on_input
HerbInterpret.execute_on_input
HerbInterpret.execute_on_input
HerbInterpret.interpret
HerbInterpret.test_all_examples
HerbInterpret.test_examples
HerbSearch._calculate_cost
HerbSearch._find_next_complete_tree
HerbSearch._find_next_complete_tree
HerbSearch.best_accept
HerbSearch.calculate_cost
HerbSearch.const_temperature
HerbSearch.constructNeighbourhood
HerbSearch.constructNeighbourhoodRuleSubset
HerbSearch.cross_over
HerbSearch.crossover_swap_children_1
HerbSearch.crossover_swap_children_2
HerbSearch.decreasing_temperature
HerbSearch.default_fitness
HerbSearch.derivation_heuristic
HerbSearch.derivation_heuristic
HerbSearch.enumerate_neighbours_propose
HerbSearch.evaluate
HerbSearch.extract_name_from_argument
HerbSearch.fitness
HerbSearch.generate_branches
HerbSearch.get_best_program
HerbSearch.heuristic_leftmost
HerbSearch.heuristic_leftmost_fixed_shaped_hole
HerbSearch.heuristic_random
HerbSearch.heuristic_rightmost
HerbSearch.heuristic_smallest_domain
HerbSearch.hole_heuristic
HerbSearch.hole_heuristic
HerbSearch.is_field_decl
HerbSearch.is_kwdef
HerbSearch.mean_squared_error
HerbSearch.misclassification
HerbSearch.mutate!
HerbSearch.mutate_random!
HerbSearch.next_solution!
HerbSearch.priority_function
HerbSearch.priority_function
HerbSearch.priority_function
HerbSearch.priority_function
HerbSearch.priority_function
HerbSearch.priority_function
HerbSearch.probabilistic_accept
HerbSearch.probabilistic_accept_with_temperature
HerbSearch.probabilistic_accept_with_temperature_fraction
HerbSearch.processkwarg!
HerbSearch.random_fill_propose
HerbSearch.select_chromosome
HerbSearch.select_fitness_proportional_parents
HerbSearch.select_parents
HerbSearch.set_stateholes!
HerbSearch.synth
HerbSearch.validate_iterator
StatsBase.sample
StatsBase.sample
StatsBase.sample
StatsBase.sample
HerbConstraints.@csgrammar_annotated
HerbGrammar.@cfgrammar
HerbGrammar.@csgrammar
HerbGrammar.@pcsgrammar
HerbSearch.@programiterator