FRAMES NO FRAMES

Class IlcIntPredicate

Definition file: ilsolver/ilcint.h
Include file: <ilsolver/ilosolver.h>

This class makes it possible for you to define integer predicates. An integer predicate is an object with a method (IlcIntPredicate::isTrue) that checks whether or not a property is satisfied by an ordered set of integers. The ordered set of integers is conventionally represented in Solver by an instance of IlcIntArray.

Most member functions in this class contain assert statements. For an explanation of the macro NDEBUG (a way to turn on or turn off these assert statements), see the concept Assert and NDEBUG.

Defining a New Class of Integer Predicates

Integer predicates, like other Solver 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 Solver heap. As a Solver 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 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 IlcIntPredicate::isTrue must check) must be less than or equal to three.

See Also:

Constructor Summary
public IlcIntPredicate()
public IlcIntPredicate(IlcIntPredicateI * impl)
Method Summary
public IlcIntPredicateI *getImpl() const
public IlcBoolisTrue(IlcIntArray val)
public voidoperator=(const IlcIntPredicate & h)
Constructor Detail

IlcIntPredicate

public IlcIntPredicate()

This constructor creates an empty handle. You must initialize it before you use it.


IlcIntPredicate

public IlcIntPredicate(IlcIntPredicateI * impl)

This constructor creates a handle object from a pointer to an implementation object.


Method Detail

getImpl

public IlcIntPredicateI * getImpl() const
This constructor creates an object by copying another one.

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


isTrue

public IlcBool isTrue(IlcIntArray val)

This member function calls the member function isTrue of the implementation class IlcIntPredicateI.


operator=

public void operator=(const IlcIntPredicate & h)

This operator assigns an address to the handle pointer of the invoking object. That address is the location of the implementation object of the provided argument.