Skip to main content
FRAMES NO FRAMES

Class IlcIntPredicateI

Definition file: ilcp/cpext.h
Include file: <ilcp/cpext.h>
Map of IlcIntPredicateIIlcIntPredicateIIlcIntPredicateI
The implementation class for integer predicates.

IlcIntPredicateI is the implementation class of IlcIntPredicate, which makes it possible for you to define integer predicates in CP Optimizer. An integer predicate is an object with a method (IlcIntPredicateI::isTrue) that checks whether or not a property is satisfied by an ordered set of integers. Conventionally in CP Optimizer, the ordered set of integers is represented by an instance of IlcIntArray.

Defining Your Own Class of Integer Predicates

Integer predicates, like other CP Optimizer objects, depend on two classes: a handle class, IlcIntPredicate, and an implementation class, IlcIntPredicateI, where an object of the handle class contains a data member (the handle pointer) that points to an object (its implementation object), an instance of IlcIntPredicateI allocated on the CP Optimizer heap. As a CP Optimizer user, you will be working primarily with handles.

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

Arity

As a developer, you can use predicates in CP Optimizer applications to define your own constraints that have not already been predefined in CP Optimizer. 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 IlcIntPredicateI::isTrue must check) must be less than or equal to three.

See Also:

Method Summary
public IlcIntPredicateI()
public virtual IlcBoolisTrue(IlcIntArray val)
public ~IlcIntPredicateI()
Method Detail

IlcIntPredicateI

public IlcIntPredicateI()

This constructor creates an implementation object of an integer 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.


~IlcIntPredicateI

public ~IlcIntPredicateI()

As this class is to be subclassed, a virtual destructor is provided.


isTrue

public virtual IlcBool isTrue(IlcIntArray val)

This member function must be redefined when you derive a new subclass of IlcIntPredicateI. 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.