Package org.jacop.search
Class SplitRandomSelect<T extends IntVar>
java.lang.Object
org.jacop.search.SimpleSelect<T>
org.jacop.search.SplitRandomSelect<T>
- Type Parameters:
T
- type of variable being used in the search.
- All Implemented Interfaces:
SelectChoicePoint<T>
It is simple and customizable selector of decisions (constraints) which will
be enforced by search. However, it does not use X=c as a search decision
but rather X <= c (potentially splitting the domain), unless c is equal to
the maximal value in the domain of X then the constraint X < c is used.
- Version:
- 4.8
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Random
boolean
It specifies if the left branch (values smaller or equal to the value selected) are first considered.Fields inherited from class org.jacop.search.SimpleSelect
currentIndex, debugAll, inputOrderTieBreaking, position, searchVariables, tieBreakingComparator, valueOrdering, variableOrdering
-
Constructor Summary
ConstructorsConstructorDescriptionSplitRandomSelect
(T[] variables, ComparatorVariable<T> varSelect, ComparatorVariable<T> tieBreakerVarSelect, Indomain<T> indomain) It constructs a simple selection mechanism for choice points.SplitRandomSelect
(T[] variables, ComparatorVariable<T> varSelect, Indomain<T> indomain) The constructor to create a simple choice select mechanism. -
Method Summary
Modifier and TypeMethodDescriptiongetChoiceConstraint
(int index) It always returns null as choice point is obtained by getChoiceVariable and getChoiceValue.getChoiceVariable
(int index) It returns the variable which is the base on the next choice point.Methods inherited from class org.jacop.search.SimpleSelect
getChoiceValue, getIndex, getVariablesMapping, placeSearchVariable, toString
-
Field Details
-
leftFirst
public boolean leftFirstIt specifies if the left branch (values smaller or equal to the value selected) are first considered. -
generator
-
-
Constructor Details
-
SplitRandomSelect
The constructor to create a simple choice select mechanism.- Parameters:
variables
- variables upon which the choice points are created.varSelect
- the variable comparator to choose the variable.indomain
- the value heuristic to choose a value for a given variable.
-
SplitRandomSelect
public SplitRandomSelect(T[] variables, ComparatorVariable<T> varSelect, ComparatorVariable<T> tieBreakerVarSelect, Indomain<T> indomain) It constructs a simple selection mechanism for choice points.- Parameters:
variables
- variables used as basis of the choice point.varSelect
- the main variable comparator.tieBreakerVarSelect
- secondary variable comparator employed if the first one gives the same metric.indomain
- the heuristic to choose value assigned to a chosen variable.
-
-
Method Details
-
getChoiceVariable
Description copied from class:SimpleSelect
It returns the variable which is the base on the next choice point. Only if choice is of an X = C type. This function returns null if all variables have a value assigned or a choice point based on other type of constraint is being selected. The parameter index is the last value which have been return by this SelectChoicePoint object which has not been backtracked upon yet.- Specified by:
getChoiceVariable
in interfaceSelectChoicePoint<T extends IntVar>
- Overrides:
getChoiceVariable
in classSimpleSelect<T extends IntVar>
- Parameters:
index
- the position of the last variable in selection choice point heuristic.- Returns:
- variable based on which the choice needs to be created.
-
getChoiceConstraint
Description copied from class:SimpleSelect
It always returns null as choice point is obtained by getChoiceVariable and getChoiceValue.- Specified by:
getChoiceConstraint
in interfaceSelectChoicePoint<T extends IntVar>
- Overrides:
getChoiceConstraint
in classSimpleSelect<T extends IntVar>
- Parameters:
index
- the position of the last variable returned by selection choice point heuristic.- Returns:
- primitive constraint which is a base of a choice point.
-