NO FRAMES

Class IloAnyBinaryPredicate

Definition file: ilconcert/ilotupleset.h
A class to define binary predicates on objects in a model.

This class makes it possible for you to define binary predicates operating on arbitrary objects in a model. A predicate is an object with a member function (such as IloAnyBinaryPredicate::isTrue) that checks whether or not a property is satisfied by an ordered set of (pointers to) objects.

Defining a New Class of Predicates

Predicates, like other Concert Technology objects, depend on two classes: a handle class, IloAnyBinaryPredicate, and an implementation class, such as IloAnyBinaryPredicateI, where an object of the handle class contains a data member (the handle pointer) that points to an object (its implementation object) of an instance of IloAnyBinaryPredicateI allocated in a Concert Technology environment. As a Concert Technology user, you will be working primarily with handles.

If you define a new class of predicates yourself, you must define its implementation class together with the corresponding virtual member function isTrue, as well as a member function that returns an instance of the handle class IloAnyBinaryPredicate.

Arity

As a developer, you can use predicates in Concert Technology applications to define your own constraints that have not already been predefined in Concert Technology. In that case, the arity of the predicate (that is, the number of constrained variables involved in the predicate, and thus the size of the array that the member function IloAnyBinaryPredicate::isTrue must check) must be two.

See Also:

Constructor and Destructor Summary
public IloAnyBinaryPredicate()
public IloAnyBinaryPredicate(IloAnyBinaryPredicateI *)
Method Summary
public IloAnyBinaryPredicateI *getImpl()
public IloBoolisTrue(const IloAny, const IloAny)
public voidoperator=(const IloAnyBinaryPredicate &)
Constructor and Destructor Detail

IloAnyBinaryPredicate

public IloAnyBinaryPredicate()

This constructor creates an empty binary predicate. In other words, the predicate is an empty handle with a null handle pointer. You must assign the elements of the predicate before you attempt to access it, just as you would any other pointer. Any attempt to access it before this assignment will throw an exception (an instance of IloSolver::SolverErrorException).


IloAnyBinaryPredicate

public IloAnyBinaryPredicate(IloAnyBinaryPredicateI * impl)

This constructor creates a handle object (an instance of the class IloAnyBinaryPredicate) from a pointer to an implementation object (an instance of the implementation class IlcAnyPredicateI, documented in the ILOG Solver Reference Manual).


Method Detail

getImpl

public IloAnyBinaryPredicateI * getImpl()

This member function returns a pointer to the implementation object of the invoking handle.


isTrue

public IloBool isTrue(const IloAny val1, const IloAny val2)

This member function returns IloTrue if the values val1 and val2 make the invoking binary predicate valid. It returns IloFalse otherwise.


operator=

public void operator=(const IloAnyBinaryPredicate & h)

This assignment operator copies h into the invoking predicate by assigning an address to the handle pointer of the invoking object. That address is the location of the implementation object of the argument h. After execution of this operator, both the invoking predicate and h point to the same implementation object.