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 java.lang.Object implements SolutionListener, ExplanationListener, StartStopListener
A basic searching component, which controls the solver to solve the problem- Version:
- 4.8
-
-
Field Summary
Fields Modifier and Type Field Description ActivityModuleactivityHeuristicAssertionModuleassertionHprivate MapClauseclauseToLearnCorecoreprivate booleanmustStopHeuristicRestartModulerestartHprivate java.util.TimerTasktaskprivate static longTIME_MARGINprivate longtimeout
-
Constructor Summary
Constructors Constructor Description SearchModule()search implementation, without timeout (search until solution is found)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidinitialize(Core core)initializes the component with the given solver.private voidinitializeTask()creates a thread and runs itvoidonExplain(MapClause explanation)called when the conflict clause is explainedvoidonSolution(boolean solution)a handler called when a solution is found.voidonStart()perform search on the given solver, without limit of time.voidonStop()stops searchprivate voidsearch()main search loopjava.lang.StringtoString()
-
-
-
Field Detail
-
TIME_MARGIN
private static final long TIME_MARGIN
- See Also:
- Constant Field Values
-
core
public Core core
-
activity
public ActivityModule activity
-
assertionH
public HeuristicAssertionModule assertionH
-
restartH
public HeuristicRestartModule restartH
-
timeout
private long timeout
-
mustStop
private boolean mustStop
-
task
private java.util.TimerTask task
-
clauseToLearn
private MapClause clauseToLearn
-
-
Method Detail
-
onExplain
public void onExplain(MapClause explanation)
Description copied from interface:ExplanationListenercalled when the conflict clause is explained- Specified by:
onExplainin interfaceExplanationListener- Parameters:
explanation- the explanation clause
-
onSolution
public void onSolution(boolean solution)
Description copied from interface:SolutionListenera handler called when a solution is found.- Specified by:
onSolutionin 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:
onStartin interfaceStartStopListener
-
onStop
public void onStop()
stops search- Specified by:
onStopin interfaceStartStopListener
-
search
private void search()
main search loop
-
initializeTask
private void initializeTask()
creates a thread and runs it
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
initialize
public void initialize(Core core)
Description copied from interface:SolverComponentinitializes 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:
initializein interfaceSolverComponent- Parameters:
core- core component to initialize
-
-