Package org.jacop.search
Class SmallestMin<T extends IntVar>
- java.lang.Object
-
- org.jacop.search.SmallestMin<T>
-
- Type Parameters:
T- type of variable being used in the search.
- All Implemented Interfaces:
ComparatorVariable<T>
public class SmallestMin<T extends IntVar> extends java.lang.Object implements ComparatorVariable<T>
Defines a SmallestMin comparator for variables. It prefers variables which have smaller minimal value in their domain.- Version:
- 4.8
-
-
Constructor Summary
Constructors Constructor Description SmallestMin()It constructs SmallestMin Comparator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompare(float left, T var)It compares the baseline metric to the variable metric.intcompare(T leftVar, T rightVar)It compares the metric of the left variable against the right one.floatmetric(T o)It returns the metric of the variable given according to the comparator.
-
-
-
Method Detail
-
compare
public int compare(float left, T var)Description copied from interface:ComparatorVariableIt compares the baseline metric to the variable metric.- Specified by:
comparein 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
public int compare(T leftVar, T rightVar)
Description copied from interface:ComparatorVariableIt compares the metric of the left variable against the right one.- Specified by:
comparein 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
public float metric(T o)
Description copied from interface:ComparatorVariableIt returns the metric of the variable given according to the comparator.- Specified by:
metricin interfaceComparatorVariable<T extends IntVar>- Parameters:
o- variable for which metric is computed.- Returns:
- the metric of the variable according to the comparator.
-
-