Package org.jacop.jasat.modules
Class SearchModule
java.lang.Object
org.jacop.jasat.modules.SearchModule
- All Implemented Interfaces:
SolverComponent
,ExplanationListener
,SolutionListener
,StartStopListener
public final class SearchModule
extends Object
implements SolutionListener, ExplanationListener, StartStopListener
A basic searching component, which controls the solver to solve the problem
- Version:
- 4.10
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionsearch implementation, without timeout (search until solution is found) -
Method Summary
Modifier and TypeMethodDescriptionvoid
initialize
(Core core) initializes the component with the given solver.private void
creates a thread and runs itvoid
called when the conflict clause is explainedvoid
onSolution
(boolean solution) a handler called when a solution is found.void
onStart()
perform search on the given solver, without limit of time.void
onStop()
stops searchprivate void
search()
main search looptoString()
-
Field Details
-
TIME_MARGIN
private static final long TIME_MARGIN- See Also:
-
core
-
activity
-
assertionH
-
restartH
-
timeout
private long timeout -
mustStop
private boolean mustStop -
task
-
clauseToLearn
-
-
Constructor Details
-
SearchModule
public SearchModule()search implementation, without timeout (search until solution is found)
-
-
Method Details
-
onExplain
Description copied from interface:ExplanationListener
called when the conflict clause is explained- Specified by:
onExplain
in interfaceExplanationListener
- Parameters:
explanation
- the explanation clause
-
onSolution
public void onSolution(boolean solution) Description copied from interface:SolutionListener
a handler called when a solution is found.- Specified by:
onSolution
in interfaceSolutionListener
- Parameters:
solution
- true when the solution is Satisfiable, false if it is Unsatisfiable.
-
onStart
public void onStart()perform search on the given solver, without limit of time. Must be called at most once after initialize() was called.- Specified by:
onStart
in interfaceStartStopListener
-
onStop
public void onStop()stops search- Specified by:
onStop
in interfaceStartStopListener
-
search
private void search()main search loop -
initializeTask
private void initializeTask()creates a thread and runs it -
toString
-
initialize
Description copied from interface:SolverComponent
initializes the component with the given solver. May be called only once. This method must register the component to the solver for the run.- Specified by:
initialize
in interfaceSolverComponent
- Parameters:
core
- core component to initialize
-