> Discrete Optimization > Logical Constraints in Optimization > What Can CPLEX Extract from a Model with Logical Constraints? |
What Can CPLEX Extract from a Model with Logical Constraints? |
INDEX PREVIOUS NEXT |
In C++ applications, the class IloCplex
can extract modeling objects to solve a wide variety of MIPs, as you see in Solving Concert Technology Models with IloCplex, summarized in Table 1.1. In fact, the class IloCplex
can extract logical constraints as well as some logical expressions. The logical constraints that IloCplex
can extract are these:
IloAnd
IloOr
IloNot
IloIfThen
==
that is, the equivalence relation
!=
that is, the exclusive-or relation
Among those extractable objects, IloAnd
IloOr
, and IloNot
can also be represented in your application by means of the C++ operators:
All those extractable objects accept as their arguments other linear constraints or logical constraints, so you can combine linear constraints with logical constraints in complicated expressions in your application.
For example, to express the idea that two jobs with starting times x1
and x2
and with duration d1
and d2
must not overlap, you can either use overloaded C++ operators, like this:
model.add((x1 >= x2 + d2) || (x2 >= x1 + d1)); |
or you can express the same idea, like this:
IloOr or(env) or.add(x1 >= x2 + d2); or.add(x2 >= x1 + d1); model.add(or); |
Since IloCplex
can also extract logical constraints embedded in other logical constraints, you can also write logical constraints like this:
IloIfThen(env, (x >= y && x >= z), IloNot(x <= 300 || y >= 700)) |
where x
, y
, and z
are variables in your application.
Copyright © 1987-2003 ILOG, S.A. All rights reserved. Legal terms. | PREVIOUS NEXT |