| Overview | Group | Tree | Graph | Index | Concepts | 

A comparator is a class that implements a comparison between two objects. IloComparator is a
 template class, meaning that it can be instantiated to define a comparator
 for user-defined classes.
A comparator can be constructed from a single evaluator (see member
 functions
 IloEvaluator::makeLessThanComparator,
 IloEvaluator::makeGreaterThanComparator),
 from a composition of evaluators
 (IloLexicographicComparator,
 IloParetoComparator), or by using macros
 (ILOCOMPARATOR0 and ILOCLIKECOMPARATOR0).
There are two main comparison functions of a comparator:
 operator() and isBetterThan.
The function operator() takes two objects, o1 and o2, and by default returns -1,
 0, or 1 depending on whether o1 is respectively better, equal or worse
 than o2. The optional argument nu is a context that can be used for
 the comparison:
IloInt operator()(IloObject o1, IloObject o2, IloAny nu = 0) const;
The function isBetterThan takes two objects, o1 and o2, and returns IloTrue if and
 only if o1 is preferred to o2. The optional argument nu is a context
 that can be used for the comparison:
IloBool isBetterThan(IloObject o1, IloObject o2, IloAny nu = 0) const;
It is possible to combine comparators and evaluators into more
 complicated comparators. See IloLexicographicComparator and IloParetoComparator.
For more information, see Selectors.
See Also:
IloEvaluator, IloLexicographicComparator, IloParetoComparator, ILOCOMPARATOR0, ILOCLIKECOMPARATOR0
| Method Summary | |
|---|---|
public IloBool | isBetterOrEqual(IloObject left, IloObject right, IloAny nu=0) const
Returns   | 
public IloBool | isBetterThan(IloObject left, IloObject right, IloAny nu=0) const
Returns   | 
public IloBool | isEqual(IloObject left, IloObject right, IloAny nu=0) const
Returns   | 
public IloBool | isWorseOrEqual(IloObject left, IloObject right, IloAny nu=0) const
Returns   | 
public IloBool | isWorseThan(IloObject left, IloObject right, IloAny nu=0) const
Returns   | 
public IloComparator< IloObject > | makeInverse() constInverts the sense of a comparator. The returned comparator compares as the invoking comparator, but with the objects being compared interchanged.  | 
public IloInt | operator()(IloObject left, IloObject right, IloAny nu=0) const | 
| Method Detail | 
|---|
IloTrue when the left-hand side is
 better than or equal to the right-hand side.
        This member function returns IloTrue if and only if
 the the left-hand side object left is better than or equal to the right-hand side object right. The
 parameter nu is a context that will be passed to the evaluator(s) of the
 comparator.
IloTrue when the left-hand side is
 better than the right-hand side.
        This member function returns IloTrue if and only if
 the the left-hand side object left is better than the right-hand side object right. The
 parameter nu is a context that will be passed to the evaluator(s) of the
 comparator.
IloTrue if and only if the left-hand side is
 of equal quality to the right-hand side.
        This member function returns IloTrue if and only if
 the the left-hand side object left is equal to the right-hand side object right. The
 parameter nu is a context that will be passed to the evaluator(s) of the
 comparator.
IloTrue when the left-hand side is
 worse than or equal to the right-hand side.
        This member function returns IloTrue if and only if
 the the left-hand side object left is worse than or equal to the right-hand side object right. The
 parameter nu is a context that will be passed to the evaluator(s) of the
 comparator.
IloTrue when the left-hand side is
 worse than the right-hand side.
        This member function returns IloTrue if and only if
 the the left-hand side object left is worse than the right-hand side object right. The
 parameter nu is a context that will be passed to the evaluator(s) of the
 comparator.
This member function returns a comparator that inverts the sense of the invoking comparator. The returned comparator interchanges the objects to be compared.
This member function implements the comparison of two objects
 based on the evaluator with which the invoking comparator was
 created and based on the sense of comparison of the invoking
 comparator. This member function returns -1, 0, or 1 depending on
 whether object left is considered to be better, equal,
 or worse than object right. The parameter nu is a
 context that will be passed to the evaluator(s) of the comparator.