T - type of variable being used in search.public class SimpleSolutionListener<T extends Var> extends Object implements SolutionListener<T>
| Modifier and Type | Field and Description |
|---|---|
SolutionListener<T>[] |
childrenSolutionListeners
It contains children of the solution listener.
|
protected int |
noSolutions |
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.
|
Domain[][] |
solutions |
T[] |
vars
It is executed right after consistency of the current search node.
|
| Constructor and Description |
|---|
SimpleSolutionListener() |
| Modifier and Type | Method and Description |
|---|---|
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.
|
void |
setSolutionsNo(int no) |
void |
setVariables(T[] vs) |
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.
|
String |
toString()
It returns the string representation of the last solution.
|
public T extends Var[] vars
public int solutionLimit
protected int noSolutions
public Domain[][] solutions
public SolutionListener<? extends Var> parentSolutionListener
public int[] parentSolutionNo
public SolutionListener<T extends Var>[] childrenSolutionListeners
public T[] getVariables()
getVariables in interface SolutionListener<T extends Var>public boolean solutionLimitReached()
SolutionListenersolutionLimitReached in interface SolutionListener<T extends Var>public void setSolutionLimit(int limit)
SolutionListenersetSolutionLimit in interface SolutionListener<T extends Var>limit - the maximal number of solutions we are interested in.public void setParentSolutionListener(SolutionListener<? extends Var> parent)
SolutionListenersetParentSolutionListener in interface SolutionListener<T extends Var>parent - solution listener used by a master search.public Domain[][] getSolutions()
SolutionListenergetSolutions 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 setSolutionsNo(int no)
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)
SolutionListenerexecuteAfterSolution in interface SolutionListener<T extends Var>search - the search which have found a solution.select - the select choice point heuristicpublic boolean assignSolution(Store store)
store - the store in the context of which the search took place.public boolean assignSolution(Store store, int number)
SolutionListenerassignSolution in interface SolutionListener<T extends Var>store - store in which the solution is enforced.number - the number of the solution to be enforced.public void setVariables(T[] vs)
public String toString()
SolutionListenerpublic PrimitiveConstraint[] returnSolution()
SolutionListenerreturnSolution 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)
SolutionListenerfindSolutionMatchingParent in interface SolutionListener<T extends Var>parentNo - solution number of the parent for which we search matching solution.public void setChildrenListeners(SolutionListener<T>[] children)
SolutionListenersetChildrenListeners in interface SolutionListener<T extends Var>children - an array containing children listeners.public void setChildrenListeners(SolutionListener<T> child)
SolutionListenersetChildrenListeners in interface SolutionListener<T extends Var>child - the child listener.public boolean isRecordingSolutions()
SolutionListenerisRecordingSolutions in interface SolutionListener<T extends Var>public void printAllSolutions()
SolutionListenerprintAllSolutions in interface SolutionListener<T extends Var>public int getParentSolution(int childSolutionNo)
getParentSolution in interface SolutionListener<T extends Var>Copyright © 2022. All rights reserved.