Package org.jacop.search
Class MaxRegret<T extends IntVar>
- java.lang.Object
-
- org.jacop.search.MaxRegret<T>
-
- Type Parameters:
T
- variable of type IntVar.
- All Implemented Interfaces:
ComparatorVariable<T>
public class MaxRegret<T extends IntVar> extends java.lang.Object implements ComparatorVariable<T>
Defines a MaxRegret comparator for Variables.- Version:
- 4.7
-
-
Constructor Summary
Constructors Constructor Description MaxRegret()
It constructs MaxRegret comparator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compare(float ldiff, T var)
It compares the baseline metric to the variable metric.int
compare(T left, T right)
It compares the metric of the left variable against the right one.float
metric(T o)
It returns the metric of the variable given according to the comparator.
-
-
-
Method Detail
-
compare
public int compare(float ldiff, T var)
Description copied from interface:ComparatorVariable
It compares the baseline metric to the variable metric.- Specified by:
compare
in interfaceComparatorVariable<T extends IntVar>
- Parameters:
ldiff
- 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 left, T right)
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:
left
- left variableright
- 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:ComparatorVariable
It returns the metric of the variable given according to the comparator.- Specified by:
metric
in interfaceComparatorVariable<T extends IntVar>
- Parameters:
o
- variable for which metric is computed.- Returns:
- the metric of the variable according to the comparator.
-
-