Package org.jacop.search
Interface ComparatorVariable<T extends Var>
-
- Type Parameters:
T- Variable type being compared.
- All Known Implementing Classes:
ActivityMax,ActivityMaxDeg,ActivityMin,ActivityMinDeg,AFCMax,AFCMaxDeg,AFCMin,AFCMinDeg,LargestDomain,LargestDomainFloat,LargestMax,LargestMaxFloat,LargestMin,LargestMinFloat,MaxCardDiff,MaxGlbCard,MaxLubCard,MaxRegret,MaxRegretFloat,MinCardDiff,MinDomainOverDegree,MinGlbCard,MinLubCard,MostConstrainedDynamic,MostConstrainedStatic,RandomVar,SmallestDomain,SmallestDomainFloat,SmallestMax,SmallestMaxFloat,SmallestMin,SmallestMinFloat,WeightedDegree,WeightedDegreeFloat
public interface ComparatorVariable<T extends Var>Defines an interface for comparing variables.- Version:
- 4.8
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description intcompare(float metric, 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 var)It returns the metric of the variable given according to the comparator.
-
-
-
Method Detail
-
compare
int compare(float metric, T var)It compares the baseline metric to the variable metric.- Parameters:
metric- 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
int compare(T leftVar, T rightVar)
It compares the metric of the left variable against the right one.- Parameters:
leftVar- left variablerightVar- right variable- Returns:
- 1 if metric for left variable is greater, 0 is they are equal, -1 if smaller.
-
metric
float metric(T var)
It returns the metric of the variable given according to the comparator.- Parameters:
var- variable for which metric is computed.- Returns:
- the metric of the variable according to the comparator.
-
-