Package org.jacop.floats.search
Class SplitRandomSelectFloat<T extends Var>
- java.lang.Object
-
- org.jacop.search.SimpleSelect<T>
-
- org.jacop.floats.search.SplitRandomSelectFloat<T>
-
- Type Parameters:
T
- type of variable being used in the search.
- All Implemented Interfaces:
SelectChoicePoint<T>
public class SplitRandomSelectFloat<T extends Var> extends SimpleSelect<T>
It is simple and customizable selector of decisions (constraints) which will be enforced by search. However, it does not use P=c as a search decision but rather P <= c (potentially splitting the domain), unless c is equal to the maximal value in the domain of P then the constraint P < c is used.- Version:
- 4.7
-
-
Field Summary
Fields Modifier and Type Field Description (package private) TimeStamp<java.lang.Integer>
currentIndex
private java.util.Random
generator
boolean
leftFirst
It specifies if the left branch (values smaller or equal to the value selected) are first considered.boolean
roundRobin
-
Fields inherited from class org.jacop.search.SimpleSelect
inputOrderTieBreaking, position, searchVariables, tieBreakingComparator, variableOrdering
-
-
Constructor Summary
Constructors Constructor Description SplitRandomSelectFloat(Store store, T[] variables, ComparatorVariable<T> varSelect)
The constructor to create a simple choice select mechanism.SplitRandomSelectFloat(Store store, T[] variables, ComparatorVariable<T> varSelect, ComparatorVariable<T> tieBreakerVarSelect)
It constructs a simple selection mechanism for choice points.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PrimitiveConstraint
getChoiceConstraint(int index)
It always returns null as choice point is obtained by getChoiceVariable and getChoiceValue.T
getChoiceVariable(int index)
It returns the variable which is the base on the next choice point.(package private) T
roundRobinVarSelection(int index)
-
Methods inherited from class org.jacop.search.SimpleSelect
getChoiceValue, getIndex, getVariablesMapping, placeSearchVariable, toString
-
-
-
-
Field Detail
-
leftFirst
public boolean leftFirst
It specifies if the left branch (values smaller or equal to the value selected) are first considered.
-
roundRobin
public boolean roundRobin
-
currentIndex
TimeStamp<java.lang.Integer> currentIndex
-
generator
private final java.util.Random generator
-
-
Constructor Detail
-
SplitRandomSelectFloat
public SplitRandomSelectFloat(Store store, T[] variables, ComparatorVariable<T> varSelect)
The constructor to create a simple choice select mechanism.- Parameters:
store
- current storevariables
- variables upon which the choice points are created.varSelect
- the variable comparator to choose the variable.
-
SplitRandomSelectFloat
public SplitRandomSelectFloat(Store store, T[] variables, ComparatorVariable<T> varSelect, ComparatorVariable<T> tieBreakerVarSelect)
It constructs a simple selection mechanism for choice points.- Parameters:
store
- current storevariables
- 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.
-
-
Method Detail
-
getChoiceVariable
public T getChoiceVariable(int index)
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 Var>
- Overrides:
getChoiceVariable
in classSimpleSelect<T extends Var>
- 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
public PrimitiveConstraint getChoiceConstraint(int index)
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 Var>
- Overrides:
getChoiceConstraint
in classSimpleSelect<T extends Var>
- 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.
-
roundRobinVarSelection
T roundRobinVarSelection(int index)
-
-