The propagate method of LocalForbiddenSequence starts by collecting a list of nodes:
function propagate!(solver::Solver, c::LocalForbiddenSequence)
nodes = get_nodes_on_path(get_tree(solver), c.path)
#...
end
This is the bottleneck of this propagate method. Furthermore, in a uniform tree, this list will always be the same. So re-computing the list is unnecessary.
Why is this not here yet?
In the GenericSolver, hole instances can be replaced during search. So references might become invalid. Additionally, constraints cannot be stateful in the GenericSolver because the constraints are shared by reference among different active solver states.
This optimization will only be valid in the UniformSolver. So it may require a new type of local constraint: StateLocalForbiddenSequence.
The propagate method of
LocalForbiddenSequence
starts by collecting a list of nodes:This is the bottleneck of this propagate method. Furthermore, in a uniform tree, this list will always be the same. So re-computing the list is unnecessary.
Why is this not here yet?
In the GenericSolver, hole instances can be replaced during search. So references might become invalid. Additionally, constraints cannot be stateful in the GenericSolver because the constraints are shared by reference among different active solver states.
This optimization will only be valid in the UniformSolver. So it may require a new type of local constraint:
StateLocalForbiddenSequence
.