|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.ObjectJaCoP.search.SimpleSolutionListener<T>
T - type of variable being used in search.public class SimpleSolutionListener<T extends Var>
It defines a simple solution listener which should be used if some basic functionality of search when a solution is encounterred are required.
| Field Summary | |
|---|---|
SolutionListener<T>[] |
childrenSolutionListeners
It contains children of the solution listener. |
SolutionListener<? extends Var> |
parentSolutionListener
If this search is a slave search than each solution within this search must be connected to a solution of the master search. |
int[] |
parentSolutionNo
If this search is a slave search than each solution within this search must be connected to a solution of the master search. |
int |
solutionLimit
It specifies the number of solutions we want to find. |
| Constructor Summary | |
|---|---|
SimpleSolutionListener()
|
|
| Method Summary | |
|---|---|
boolean |
assignSolution(Store store)
It assigns the last found solution to the store. |
boolean |
assignSolution(Store store,
int number)
It imposes the constraints, so the last found solution is enforced. |
boolean |
executeAfterSolution(Search<T> search,
SelectChoicePoint<T> select)
It is executed by search after a solution is found. |
int |
findSolutionMatchingParent(int parentNo)
For a given master solution finds any solution within that listener which matches the master solution. |
int |
getParentSolution(int childSolutionNo)
|
Domain[] |
getSolution(int no)
It returns the solution number no. |
Domain[][] |
getSolutions()
It returns all solutions. |
T[] |
getVariables()
It returns null if no solution was recorded, or the variables for which the solution(s) was recorded. |
boolean |
isRecordingSolutions()
It specifies if the solution listener is recording solutions or not. |
void |
printAllSolutions()
It prints all the solutions. |
void |
recordSolution()
It records a solution. |
void |
recordSolutions(boolean status)
It records all solutions so they can be later retrieved and used. |
PrimitiveConstraint[] |
returnSolution()
It returns a collection of constraints which represent the last found solution. |
PrimitiveConstraint[] |
returnSolution(int number)
It returns the solution with the given number (value 0 denotes the first solution) as a set of primitive constraints. |
void |
searchAll(boolean status)
It searches for all solutions, but they do not have to be recorded as this is decided by another parameter. |
void |
setChildrenListeners(SolutionListener<T> child)
It sets the child listener for this solution listener. |
void |
setChildrenListeners(SolutionListener<T>[] children)
It sets the children listeners for this solution listener. |
void |
setParentSolutionListener(SolutionListener<? extends Var> parent)
It allows to inform sub-search of what is the current number of the solution in master search. |
void |
setSolutionLimit(int limit)
It sets the solution limit. |
boolean |
solutionLimitReached()
It checks if the sufficient number of solutions was found. |
int |
solutionsNo()
It returns number of solutions found while using this choice point selector. |
java.lang.String |
toString()
It returns the string representation of the last solution. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public int solutionLimit
public SolutionListener<? extends Var> parentSolutionListener
public int[] parentSolutionNo
public SolutionListener<T extends Var>[] childrenSolutionListeners
| Constructor Detail |
|---|
public SimpleSolutionListener()
| Method Detail |
|---|
public T[] getVariables()
getVariables in interface SolutionListener<T extends Var>public boolean solutionLimitReached()
SolutionListener
solutionLimitReached in interface SolutionListener<T extends Var>public void setSolutionLimit(int limit)
SolutionListener
setSolutionLimit in interface SolutionListener<T extends Var>limit - the maximal number of solutions we are interested in.public void setParentSolutionListener(SolutionListener<? extends Var> parent)
SolutionListener
setParentSolutionListener in interface SolutionListener<T extends Var>parent - solution listener used by a master search.public Domain[][] getSolutions()
SolutionListener
getSolutions in interface SolutionListener<T extends Var>public Domain[] getSolution(int no)
getSolution in interface SolutionListener<T extends Var>no - it obtains the solution with a given index.
public int solutionsNo()
solutionsNo in interface SolutionListener<T extends Var>public void recordSolutions(boolean status)
recordSolutions in interface SolutionListener<T extends Var>status - true if we are interested in recording all solutions, false otherwise.public void searchAll(boolean status)
searchAll in interface SolutionListener<T extends Var>status - true if we are interested in search for all solutions, false otherwise.public void recordSolution()
public boolean executeAfterSolution(Search<T> search,
SelectChoicePoint<T> select)
SolutionListener
executeAfterSolution in interface SolutionListener<T extends Var>search - the search which have found a solution.select - the select choice point heuristic
public boolean assignSolution(Store store)
store - the store in the context of which the search took place.
public boolean assignSolution(Store store,
int number)
SolutionListener
assignSolution in interface SolutionListener<T extends Var>store - store in which the solution is enforced.number - the number of the solution to be enforced.
public java.lang.String toString()
SolutionListener
toString in interface SolutionListener<T extends Var>toString in class java.lang.Objectpublic PrimitiveConstraint[] returnSolution()
SolutionListener
returnSolution in interface SolutionListener<T extends Var>public PrimitiveConstraint[] returnSolution(int number)
number - the solution number (0 denotes the first solution).
public int findSolutionMatchingParent(int parentNo)
SolutionListener
findSolutionMatchingParent in interface SolutionListener<T extends Var>parentNo - solution number of the parent for which we search matching solution.
public void setChildrenListeners(SolutionListener<T>[] children)
SolutionListener
setChildrenListeners in interface SolutionListener<T extends Var>children - an array containing children listeners.public void setChildrenListeners(SolutionListener<T> child)
SolutionListener
setChildrenListeners in interface SolutionListener<T extends Var>child - the child listener.public boolean isRecordingSolutions()
SolutionListener
isRecordingSolutions in interface SolutionListener<T extends Var>public void printAllSolutions()
SolutionListener
printAllSolutions in interface SolutionListener<T extends Var>public int getParentSolution(int childSolutionNo)
getParentSolution in interface SolutionListener<T extends Var>
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||