Using logical constraints
These logical constraints are available in Concert Technology for representing certain nonlinear elements in a model.
Logical constraints are available in all APIs of Concert Technology: C++, Java, C#.NET. 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.
Names of classes, methods, and symbolic constants in the C#.NET API correspond very closely to those in the Java API with these systematic exceptions:
-
In the Java API, the names of classes begin with the prefix Ilo, whereas in C#.NET they do not.
-
In the Java API, the names of methods conventionally begin with a lowercase letter, for example,
addCols, whereas in the C#.NET API, the names of methods conventionally begin with an uppercase (that is, capital) letter, for example,AddColsaccording to Microsoft practice.
| Purpose | Java API | C++ API | C API |
|---|---|---|---|
| Conjunction (logical-and) of two or more constraints as a constraint |
IloModeler.and(ilog.concert.IloConstraint[]) IloCplexModeler.and(ilog.concert.IloConstraint[]) IloAnd |
IloAnd | ---- |
| Logical-or of two or more constraints as a constraint | IloCplexModeler.or(ilog.concert.IloConstraint[]) | IloOr | ---- |
| Logical negation of a constraint | IloCplexModeler.not(ilog.concert.IloConstraint) | IloNot | ---- |
| Absolute value | IloCplexModeler.abs(ilog.concert.IloNumExpr) | IloAbs | ---- |
| Conditional logic; that is, if ... then | IloCplexModeler.ifThen(ilog.concert.IloConstraint, ilog.concert.IloConstraint) | IloIfThen | ---- |
| Logical equivalence of two constraints; that is, they must be the same | IloCplexModeler.eq(double, ilog.concert.IloNumExpr) | operator_equ_equ | ---- |
| Piecewise linear function |
IloMPModeler.piecewiseLinear(ilog.concert.IloNumExpr, double[], double[], double, double) IloCplexModeler.piecewiseLinear(ilog.concert.IloNumExpr, double[], double[], double, double) |
IloPiecewiseLinear | ---- |
| Maximum over a numeric expression or set | IloCplexModeler.max(double, ilog.concert.IloNumExpr) | IloMax | ---- |