Overview | Group | Tree | Graph | Index | Concepts |
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 IloBool | isTrue(const IloAny, const IloAny) |
public void | operator=(const IloAnyBinaryPredicate &) |
Constructor and Destructor Detail |
---|
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
).
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 |
---|
This member function returns a pointer to the implementation object of the invoking handle.
This member function returns IloTrue
if the values val1
and
val2
make the invoking binary predicate valid. It returns IloFalse
otherwise.
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.