Overview | Group | Tree | Graph | Index | Concepts |
IlcAnyPredicateI
is the implementation class of
IlcAnyPredicate
, which makes it possible for
you to define predicates on arbitrary objects in Solver. A
predicate is an object with a method (IlcAnyPredicateI::isTrue
) that checks whether or not a
property is satisfied by an ordered set of (pointers to) objects.
Conventionally in Solver, the ordered set of objects is represented by an
instance of IlcIntArray
.
Defining a New Class of Predicates
Predicates, like other Solver objects, depend on two classes: a handle
class, IlcAnyPredicate
, and an implementation class,
IlcAnyPredicateI
, 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
IlcAnyPredicateI
allocated on the Solver heap. As a Solver
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 IlcAnyPredicate
.
Arity
As a developer, you can use predicates in Solver applications to define
your own constraints that have not already been predefined in Solver. 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 IlcAnyPredicateI::isTrue
must check) must be less than or
equal to three.
See Also:
IlcAnyArray, ILCANYPREDICATE0, IlcIntPredicateI, IlcTableConstraint
Constructor and Destructor Summary | |
---|---|
public | IlcAnyPredicateI() |
public | ~IlcAnyPredicateI() |
Method Summary | |
---|---|
public virtual IlcBool | isTrue(IlcAnyArray val) |
Constructor and Destructor Detail |
---|
This constructor creates an implementation object of a predicate. This constructor should not be called directly because this is an abstract class. This constructor is called automatically in the constructors of its subclasses.
As this class is to be subclassed, a virtual destructor is provided.
Method Detail |
---|
This member function must be redefined when you derive a new subclass of
IlcAnyPredicateI
. This member function must return IlcTrue
if the invoking predicate is satisfied by the elements contained in the array val
.
Otherwise, it must return IlcFalse
.