Package org.jacop.search
Class OneSolution<T extends Var>
java.lang.Object
org.jacop.search.SimpleSolutionListener<T>
org.jacop.search.OneSolution<T>
- All Implemented Interfaces:
ConsistencyListener,InitializeListener,SolutionListener<T>
public class OneSolution<T extends Var>
extends SimpleSolutionListener<T>
implements ConsistencyListener, InitializeListener
Defines functionality for OneSolution plug-in, that is the search
with this plug-in will stop after funding first solution. Each call
to this search will restore the functionality and the search will
again search for a single solution.
- Version:
- 4.10
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) ConsistencyListener[](package private) InitializeListener[](package private) booleanFields inherited from class org.jacop.search.SimpleSolutionListener
alwaysUpdateToMostRecentSolution, childrenSolutionListeners, noSolutions, parentSolutionListener, parentSolutionNo, recordSolutions, solutionLimit, solutions, vars -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanexecuteAfterConsistency(boolean consistent) It is executed right after consistency of the current search node.booleanexecuteAfterSolution(Search<T> search, SelectChoicePoint<T> select) It is executed by search after a solution is found.voidexecutedAtInitialize(Store store) It is executed before the search starts labeling procedure.voidSetting one child listener.voidsetChildrenListeners(ConsistencyListener[] children) Each of the child listeners will be called and the return code from them will be combined (taken into account) by a parent).voidIt sets one child listener for this initialize listener.voidsetChildrenListeners(InitializeListener[] children) It sets the children listeners of this initialize listener.Methods inherited from class org.jacop.search.SimpleSolutionListener
assignSolution, assignSolution, findSolutionMatchingParent, getParentSolution, getSolution, getSolutions, getVariables, isRecordingSolutions, printAllSolutions, recordSolution, recordSolutions, returnSolution, returnSolution, searchAll, setChildrenListeners, setChildrenListeners, setParentSolutionListener, setSolutionLimit, setSolutionsNo, setVariables, solutionLimitReached, solutionsNo, toString
-
Field Details
-
solutionFound
boolean solutionFound -
childrenConsistencyListeners
ConsistencyListener[] childrenConsistencyListeners -
childrenInitializeListeners
InitializeListener[] childrenInitializeListeners
-
-
Constructor Details
-
OneSolution
public OneSolution()
-
-
Method Details
-
executedAtInitialize
Description copied from interface:InitializeListenerIt is executed before the search starts labeling procedure.- Specified by:
executedAtInitializein interfaceInitializeListener- Parameters:
store- store in which context the search is performed.
-
setChildrenListeners
It sets the children listeners of this initialize listener.- Specified by:
setChildrenListenersin interfaceInitializeListener- Parameters:
children- children listeners
-
setChildrenListeners
It sets one child listener for this initialize listener.- Specified by:
setChildrenListenersin interfaceInitializeListener- Parameters:
child- the child of this initialize listener.
-
executeAfterSolution
Description copied from interface:SolutionListenerIt is executed by search after a solution is found.- Specified by:
executeAfterSolutionin interfaceSolutionListener<T extends Var>- Overrides:
executeAfterSolutionin classSimpleSolutionListener<T extends Var>- Parameters:
search- the search which have found a solution.select- the select choice point heuristic- Returns:
- false forces the search to keep looking for a solution, true then the search will accept a solution.
-
executeAfterConsistency
public boolean executeAfterConsistency(boolean consistent) Description copied from interface:ConsistencyListenerIt is executed right after consistency of the current search node. Returning true when the parameter was false is not advised as things like invalid solutions can be found.- Specified by:
executeAfterConsistencyin interfaceConsistencyListener- Parameters:
consistent- specifies if the consistency call returned true or false.- Returns:
- true if the search should continue, false if the search should act as the consistency returned false.
-
setChildrenListeners
Description copied from interface:ConsistencyListenerEach of the child listeners will be called and the return code from them will be combined (taken into account) by a parent).- Specified by:
setChildrenListenersin interfaceConsistencyListener- Parameters:
children- the children listeners attached to this listener.
-
setChildrenListeners
Description copied from interface:ConsistencyListenerSetting one child listener.- Specified by:
setChildrenListenersin interfaceConsistencyListener- Parameters:
child- the only child listener added to this consistency listener.
-