Using Logical Constraints

Logical constraints are available in all APIs of Concert Technology. They are useful for representing certain nonlinear elements in a model, such as absolute value, logical-and, logical-or, negation, equivalence, nonequivalence (difference), conditional logic (if ... then), piecewise linear functions, maximum over a numeric expression or set, minimum over a numeric expression or set, and other such modeling elements.

Similar facilities are available in the Callable Library (C API) through the routine CPXaddindconstr, which enables you to add indicator constraints to your model.

Note: Names of classes, methods, and symbolic constants in the .NET API correspond very closely to those in the Java API with these systematic exceptions:

Purpose

Java API

C++ API

C API

Conjunction (logical-and) of two or more constraints as a constraint

IloMPModeler.and

IloCplexModeler.and

IloAnd

IloAnd

----

Logical-or of two or more constraints as a constraint

IloCplexModeler.or

IloOr

----

Logical negation of a constraint

IloCplexModeler.not

IloNot

----

Absolute value

IloCplexModeler.abs

IloAbs

----

Conditional logic; that is, if ... then

IloCplexModeler.ifThen

IloIfThen

----

Logical equivalence of two constraints; that is, they must be the same

IloCplexModeler.eq

operator==

----

Piecewise linear function

IloMPModeler.piecewiseLinear

IloCplexModeler.piecewiseLinear

IloPiecewiseLinear

----

Maximum over a numeric expression or set

IloCplexModeler.max

IloMax

----