JaCoP.search
Interface ComparatorVariable<T extends Var>

Type Parameters:
T - Variable type being compared.
All Known Implementing Classes:
LargestDomain, LargestMax, LargestMin, MaxCardDiff, MaxGlbCard, MaxLubCard, MaxRegret, MinCardDiff, MinDomainOverDegree, MinGlbCard, MinLubCard, MostConstrainedDynamic, MostConstrainedStatic, SmallestDomain, SmallestMax, SmallestMin, WeightedDegree

public interface ComparatorVariable<T extends Var>

Defines an interface for comparing variables.

Version:
3.1
Author:
Krzysztof Kuchcinski and Radoslaw Szymanek

Method Summary
 int compare(float metric, T var)
          It compares the baseline metric to the variable metric.
 int compare(T leftVar, T rightVar)
          It compares the metric of the left variable against the right one.
 float metric(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 variable
rightVar - 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.