Skip to main content
FRAMES NO FRAMES

IlcIfThen

public void IlcIfThen(const IlcConstraint ct1, const IlcConstraint ct2)
Definition file: ilcp/cpext.h
Include file: <ilcp/cpext.h>
Returns an implication constraint.

This function constrains its first argument to imply its second argument. That is, if ct1 is satisfied, then ct2 must be satisfied; if ct2 is violated, then ct1 must also be violated.

A constraint needs to be added to an instance of IlcCPEngine (either directly or indirectly) for it to take effect. Normally this is done by casting a constraint to a goal and using it in a choice point (IlcOr).

Implementation

Inside a goal or constraint, this function is equivalent to these lines:

 void IlcIfThen(IlcConstraint ct1, IlcConstraint ct2) {
     IlcCPEngine cp = ct1.getCPEngine();
     cp.add(!ct1 || ct2);
 }

See Also: