NO FRAMES

Class IloIntBinaryPredicate

Definition file: ilconcert/ilotupleset.h

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 IloIntBinaryPredicate::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, IloIntBinaryPredicate, and an implementation class, such as IloIntBinaryPredicateI, 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 IloIntBinaryPredicateI 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 IloIntBinaryPredicate.

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 IloIntBinaryPredicate::isTrue must check) must be two.

See Also:

Constructor and Destructor Summary
public IloIntBinaryPredicate()
public IloIntBinaryPredicate(IloIntBinaryPredicateI *)
Method Summary
public IloIntBinaryPredicateI *getImpl()
public IloBoolisTrue(const IloInt, const IloInt)
public voidoperator=(const IloIntBinaryPredicate &)
Constructor and Destructor Detail

IloIntBinaryPredicate

public IloIntBinaryPredicate()

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. Int attempt to access it before this assignment will throw an exception (an instance of IloSolver::SolverErrorException).


IloIntBinaryPredicate

public IloIntBinaryPredicate(IloIntBinaryPredicateI * impl)

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


Method Detail

getImpl

public IloIntBinaryPredicateI * getImpl()

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


isTrue

public IloBool isTrue(const IloInt val1, const IloInt 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 IloIntBinaryPredicate & 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.