- All Known Implementing Classes:
AbstractConcurrentSearchMethod,AbstractSearchMethod,BestFirstSearch,ConcurrentDFSearch,DFSearch,RunnableSearchMethod,SymbolicSearchMethod
public interface SearchMethod
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidAdds a listener that is called whenever a failure occurs and the search backtracks.voidonFailure(Consumer<SearchStatistics> listener) Adds a listener that is called whenever a failure occurs and the search backtracks.default voidonSolution(Runnable listener) Adds a listener that is called on each solution.voidonSolution(Consumer<SearchStatistics> listener) Adds a listener that is called on each solution.optimize(Objective obj, Predicate<SearchStatistics> limit) Start the solving process with a given objective.optimize(Objective toTighten, Predicate<SearchStatistics> limit) Start the solving process with a given objective and with a given predicate called at each node to stop the search when it becomes true.optimizeSubjectTo(Objective objToTighten, Predicate<SearchStatistics> limit, Runnable subjectTo) optimizeSubjectTo(Objective objToTighten, Predicate<SearchStatistics> limit, Runnable subjectTo) Executes a closure prior to effectively starting a branch and bound depth first search with a given objective to optimize and a given predicate called at each node to stop the search when it becomes true.solve()Start the solving processsolve(Predicate<SearchStatistics> limit) Start the solving process with a given predicate called at each node to stop the search when it becomes true.solveSubjectTo(Predicate<SearchStatistics> limit, Runnable subjectTo) Start the solving process with a given predicate called at each node to stop the search when it becomes true.
-
Method Details
-
onSolution
Adds a listener that is called on each solution.- Parameters:
listener- the closure to be called whenever a solution is found
-
onSolution
Adds a listener that is called on each solution.- Parameters:
listener- the closure to be called whenever a solution is found
-
onFailure
Adds a listener that is called whenever a failure occurs and the search backtracks. This happens when aInconsistencyExceptionis thrown when executing the closure generated by the branching.- Parameters:
listener- the closure to be called whenever a failure occurs and the search need to backtrack
-
onFailure
Adds a listener that is called whenever a failure occurs and the search backtracks. This happens when aInconsistencyExceptionis thrown when executing the closure generated by the branching.- Parameters:
listener- the closure to be called whenever a failure occurs and the search need to backtrack
-
solve
SearchStatistics solve()Start the solving process- Returns:
- an object with the statistics on the search
-
solve
Start the solving process with a given predicate called at each node to stop the search when it becomes true.- Parameters:
limit- a predicate called at each node that stops the search when it becomes true- Returns:
- an object with the statistics on the search
-
solveSubjectTo
Start the solving process with a given predicate called at each node to stop the search when it becomes true. The state manager saves the state before executing the closure and restores it after the search. AnyInconsistencyExceptionthat may be throw when executing the closure is also catched.- Parameters:
limit- a predicate called at each node that stops the search when it becomes truesubjectTo- the closure to execute prior to the search starts- Returns:
- an object with the statistics on the search
-
optimize
Start the solving process with a given objective.- Parameters:
obj- the objective to optimize that is tightened each time a new solution is found- Returns:
- an object with the statistics on the search
-
optimize
-
optimize
-
optimize
Start the solving process with a given objective and with a given predicate called at each node to stop the search when it becomes true.- Parameters:
toTighten- the objective to optimize that is tightened each time a new solution is foundlimit- a predicate called at each node that stops the search when it becomes true- Returns:
- an object with the statistics on the search
-
optimizeSubjectTo
SearchStatistics optimizeSubjectTo(Objective objToTighten, Predicate<SearchStatistics> limit, Runnable subjectTo) Executes a closure prior to effectively starting a branch and bound depth first search with a given objective to optimize and a given predicate called at each node to stop the search when it becomes true. The state manager saves the state before executing the closure and restores it after the search. AnyInconsistencyExceptionthat may be thrown when executing the closure is also catched.- Parameters:
objToTighten- the objective to optimize that is tightened each time a new solution is foundlimit- a predicate called at each node that stops the search when it becomes truesubjectTo- the closure to execute prior to the search starts- Returns:
- an object with the statistics on the search
-
optimizeSubjectTo
SearchStatistics optimizeSubjectTo(Objective objToTighten, Predicate<SearchStatistics> limit, Runnable subjectTo)
-