Package org.jacop.set.search
Class MinCardDiff<T extends SetVar>
java.lang.Object
org.jacop.set.search.MinCardDiff<T>
- Type Parameters:
T
- type of variable being used in the search.
- All Implemented Interfaces:
ComparatorVariable<T>
Defines a minimum cardinality difference variable comparator. The variable with the minimum
difference in cardinality between the greatest lower bound and the least upper bound has the priority.
- Version:
- 4.10
-
Constructor Summary
ConstructorsConstructorDescriptionIt constructs a minimum cardinality difference variable comparator. -
Method Summary
Modifier and TypeMethodDescriptionint
Compares the cardinality difference of the variable to the float value.int
Compares the cardinality difference of the variables.double
Returns the metric(Cardinality difference) of the variable.
-
Constructor Details
-
MinCardDiff
public MinCardDiff()It constructs a minimum cardinality difference variable comparator.
-
-
Method Details
-
compare
Compares the cardinality difference of the variable to the float value.- Specified by:
compare
in interfaceComparatorVariable<T extends SetVar>
- 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
Compares the cardinality difference of the variables.- Specified by:
compare
in interfaceComparatorVariable<T extends SetVar>
- Parameters:
leftVar
- left variablerightVar
- right variable- Returns:
- 1 if metric for left variable is greater, 0 is they are equal, -1 if smaller.
-
metric
Returns the metric(Cardinality difference) of the variable.- Specified by:
metric
in interfaceComparatorVariable<T extends SetVar>
- Parameters:
var
- variable for which metric is computed.- Returns:
- the metric of the variable according to the comparator.
-