Package org.jacop.search
Class SmallestMax<T extends IntVar>
java.lang.Object
org.jacop.search.SmallestMax<T>
- Type Parameters:
T
- type of variable being used in the search.
- All Implemented Interfaces:
ComparatorVariable<T>
Defines a SmallestMax comparator for Variables. The variable with maximum value 5 will
have a priority over variable with maximum value equal 10.
- Version:
- 4.8
-
Constructor Summary
ConstructorsConstructorDescriptionIt constructs the variable comparator based on the smallest maximal value from the domain. -
Method Summary
Modifier and TypeMethodDescriptionint
It compares the baseline metric to the variable metric.int
It compares the metric of the left variable against the right one.float
It returns the metric of the variable given according to the comparator.
-
Constructor Details
-
SmallestMax
public SmallestMax()It constructs the variable comparator based on the smallest maximal value from the domain.
-
-
Method Details
-
compare
Description copied from interface:ComparatorVariable
It compares the baseline metric to the variable metric.- Specified by:
compare
in interfaceComparatorVariable<T extends IntVar>
- Parameters:
left
- the baseline for comparison.var
- variable which is compared to baseline.- Returns:
- 1 if metric is larger than variable, 0 if equal, -1 if baseline is smaller.
-
compare
Description copied from interface:ComparatorVariable
It compares the metric of the left variable against the right one.- Specified by:
compare
in interfaceComparatorVariable<T extends IntVar>
- Parameters:
leftVar
- left variablerightVar
- right variable- Returns:
- 1 if metric for left variable is greater, 0 is they are equal, -1 if smaller.
-
metric
Description copied from interface:ComparatorVariable
It returns the metric of the variable given according to the comparator.- Specified by:
metric
in interfaceComparatorVariable<T extends IntVar>
- Parameters:
var
- variable for which metric is computed.- Returns:
- the metric of the variable according to the comparator.
-