> Discrete Optimization > Logical Constraints in Optimization > Are Logical Constraints Discrete or Continuous? |
Are Logical Constraints Discrete or Continuous? |
INDEX PREVIOUS NEXT |
Under some conditions, a problem expressed in terms of logical constraints may be equivalent to a continuous problem, rather than a discrete problem (that is, a MIP). In such a case, there is no need for branching during the search for a solution. Whether a problem (or parts of a problem) represented by logical terms can be modeled and solved by a continous optimizer depends on the shape of those logical terms. In this context, shape means convex or concave in the formal, mathematical sense. (For an intuitive idea of convex and concave in a different context, see also Convexity.)
For example, absolute value, as represented in Concert Technology by IloAbs(x)
, is convex, whereas -IloAbs(x)
is concave.
Similarly, a piecewise linear function is convex if the succession of the slopes of its segments is increasing over the interval of the term it is applied to. In contrast, a piecewise linear function is concave if the succession of slopes is decreasing. (For more detail about convexity and piecewise linearity, see also Special Considerations about Solving with IloPiecewiseLinear.)
Consequently, a logical term has a continuous formulation in ILOG CPLEX if it satisfies one of the following conditions:
<=
), with a negative or zero coefficient in greater-than-or-equal-to constraints (>=), and with a positive or zero coefficient in a minimization objective function.
As an example, consider the following logical term in a minimization:
IloNumVarArray x(env, 3, 0, 10)); model.add(IloMinimize(env, IloMax(x))); |
In that example, IloMax
is convex. Since it appears in a minimization objective function, it has a linear programming formulation. In fact, if you export the model of this example in LP format, it looks like this:
Minimize obj: y Subject To id9: - x1 + y >= 0 id11: - x2 + y >= 0 id13: - x3 + y >= 0 Bounds 0 <= x1 <= 10 0 <= x2 <= 10 0 <= x3 <= 10 0 <= y <= 10 End |
As you can see in the exported model, a new variable, y
, has been created. The problem is to minimize y
while requiring y
to be greater than each of the other variables in the array x
.
In contrast, if you replace the minimization objective function by a maximization, then a MIP formulation becomes necessary, as you can see when the modified model is exported to a file.
The MIP formulation contains all the constraints from the continuous formulation, but now y
must be maximized and in addition must be equal to exactly one of the x[i]
. For this purpose, three binary variables have been introduced (id8
, id9
, and id10
). When one of these three is set to 1, the corresponding variable x[i]
must also satisfy the constraint y <= x[i]
, in addition to those in the continuous formulation.
In short, it may be difficult to forecast accurately whether a model containing logical expressions will be extracted as continuous or discrete. For example, a small change in the formulation or a particular instance of the input data may destroy the property of convexity that previously had been present.
In most applications, it will be safest to assume the extracted model always will be a MIP, because in cases where it is actually continuous, the optimizer will treat it correctly anyway, namely, as the degenerate case having no integrality restrictions to apply.
A particular caution: it may be unsafe to assume that post-solution information involving dual values corresponding to a continuous model (for example, values from the method getDual
) will be obtainable or will have any useful meaning in a model containing logical constraints.
Copyright © 1987-2003 ILOG, S.A. All rights reserved. Legal terms. | PREVIOUS NEXT |