public class TraceGenerator<T extends Var> extends Object implements SelectChoicePoint<T>, ConsistencyListener, ExitChildListener<T>, ExitListener
Modifier and Type | Field and Description |
---|---|
ArrayList<Var> |
tracedVar
It specifies the list of variables that are being traced.
|
String |
treeFilename
The file containing information about tree for CPviz format.
|
HashMap<Var,Integer> |
varIndex |
String |
visFilename
The file containing visualisation information.
|
Constructor and Description |
---|
TraceGenerator(Search<T> search,
SelectChoicePoint<T> select)
It creates a CPviz trace generator around proper select choice point object.
|
TraceGenerator(Search<T> search,
SelectChoicePoint<T> select,
String treeFilename,
String visFilename)
It creates a CPviz trace generator around proper select choice point object.
|
TraceGenerator(Search<T> search,
SelectChoicePoint<T> select,
Var[] vars)
It creates a CPviz trace generator around proper select choice point object.
|
TraceGenerator(Search<T> search,
SelectChoicePoint<T> select,
Var[] vars,
String treeFilename,
String visFilename)
It creates a CPviz trace generator around proper select choice point object.
|
Modifier and Type | Method and Description |
---|---|
void |
addTracedVar(Var v) |
boolean |
executeAfterConsistency(boolean consistent)
It is executed right after consistency of the current search node.
|
void |
executedAtExit(Store store,
int solutionsNo)
It is executed right after time out is determined.
|
PrimitiveConstraint |
getChoiceConstraint(int index)
It returns the constraint which is the base of the choice point.
|
int |
getChoiceValue()
It returns a value which is the base of the next choice point.
|
T |
getChoiceVariable(int index)
It returns the variable which is the base on the next choice point.
|
int |
getIndex()
It returns the current index.
|
IdentityHashMap<T,Integer> |
getVariablesMapping()
It specifies the position of variables as given when variables of this
select object were supplied.
|
boolean |
leftChild(PrimitiveConstraint choice,
boolean status)
It is executed after exiting the left child.
|
boolean |
leftChild(T var,
int value,
boolean status)
It is executed after exiting the left child.
|
void |
rightChild(PrimitiveConstraint choice,
boolean status)
It is executed after exiting the right child.
|
void |
rightChild(T var,
int value,
boolean status)
It is executed after exiting the right child.
|
void |
setChildrenListeners(ConsistencyListener child)
Setting one child listener.
|
void |
setChildrenListeners(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).
|
void |
setChildrenListeners(ExitChildListener<T> child)
It adds one child listener.
|
void |
setChildrenListeners(ExitChildListener<T>[] children)
It sets the children listeners for the current listener.
|
void |
setChildrenListeners(ExitListener child)
It sets one child listener.
|
void |
setChildrenListeners(ExitListener[] children)
It sets the children of this exit listener.
|
String |
toString() |
public final String treeFilename
public final String visFilename
public TraceGenerator(Search<T> search, SelectChoicePoint<T> select)
search
- it specifies search method used for depth-first-search.select
- it specifies how the select choice points are being generated.public TraceGenerator(Search<T> search, SelectChoicePoint<T> select, String treeFilename, String visFilename)
search
- it specifies search method used for depth-first-search.select
- it specifies how the select choice points are being generated.treeFilename
- it specifies the file name for search tree trace (default tree.xml).visFilename
- it specifies the file name for variable trace (default vis.xml).public TraceGenerator(Search<T> search, SelectChoicePoint<T> select, Var[] vars)
search
- it specifies search method used for depth-first-search.select
- it specifies how the select choice points are being generated.vars
- it specifies variables which are being traced.public TraceGenerator(Search<T> search, SelectChoicePoint<T> select, Var[] vars, String treeFilename, String visFilename)
search
- it specifies search method used for depth-first-search.select
- it specifies how the select choice points are being generated.vars
- it specifies variables which are being traced.treeFilename
- it specifies the file name for search tree trace (default tree.xml).visFilename
- it specifies the file name for variable trace (default vis.xml).public T getChoiceVariable(int index)
SelectChoicePoint
getChoiceVariable
in interface SelectChoicePoint<T extends Var>
index
- the position of the last variable in selection choice point heuristic.public int getChoiceValue()
SelectChoicePoint
getChoiceValue
in interface SelectChoicePoint<T extends Var>
public PrimitiveConstraint getChoiceConstraint(int index)
SelectChoicePoint
getChoiceConstraint
in interface SelectChoicePoint<T extends Var>
index
- the position of the last variable returned by selection choice point heuristic.public IdentityHashMap<T,Integer> getVariablesMapping()
SelectChoicePoint
getVariablesMapping
in interface SelectChoicePoint<T extends Var>
public int getIndex()
SelectChoicePoint
getIndex
in interface SelectChoicePoint<T extends Var>
public void setChildrenListeners(ConsistencyListener[] children)
ConsistencyListener
setChildrenListeners
in interface ConsistencyListener
children
- the children listeners attached to this listener.public void setChildrenListeners(ConsistencyListener child)
ConsistencyListener
setChildrenListeners
in interface ConsistencyListener
child
- the only child listener added to this consistency listener.public boolean executeAfterConsistency(boolean consistent)
ConsistencyListener
executeAfterConsistency
in interface ConsistencyListener
consistent
- specifies if the consistency call returned true or false.public void setChildrenListeners(ExitChildListener<T>[] children)
ExitChildListener
setChildrenListeners
in interface ExitChildListener<T extends Var>
children
- array containing children listeners.public void setChildrenListeners(ExitListener[] children)
ExitListener
setChildrenListeners
in interface ExitListener
children
- an array containing the children.public boolean leftChild(T var, int value, boolean status)
ExitChildListener
leftChild
in interface ExitChildListener<T extends Var>
var
- variable used in the choice point.value
- value used in the choice point.status
- true if the solution was found in the child subtree, false otherwise.public boolean leftChild(PrimitiveConstraint choice, boolean status)
ExitChildListener
leftChild
in interface ExitChildListener<T extends Var>
choice
- primitive constraint used as the base of the choice point.status
- true if the solution was found in the child subtree, false otherwise.public void rightChild(T var, int value, boolean status)
ExitChildListener
rightChild
in interface ExitChildListener<T extends Var>
var
- variable used in the choice point.value
- value used in the choice point.status
- true if the solution was found in the child subtree, false otherwise.
exit the current node with falsepublic void rightChild(PrimitiveConstraint choice, boolean status)
ExitChildListener
rightChild
in interface ExitChildListener<T extends Var>
choice
- primitive constraint used as the base of the choice point.status
- true if the solution was found in the child subtree, false otherwise.
exit the current node with falsepublic void setChildrenListeners(ExitChildListener<T> child)
ExitChildListener
setChildrenListeners
in interface ExitChildListener<T extends Var>
child
- added child listener.public void setChildrenListeners(ExitListener child)
ExitListener
setChildrenListeners
in interface ExitListener
child
- the only child listener used by this listener.public void executedAtExit(Store store, int solutionsNo)
ExitListener
executedAtExit
in interface ExitListener
store
- store in the context of which the search took place.solutionsNo
- the number of solutions found.public void addTracedVar(Var v)
Copyright © 2015. All rights reserved.