# McCormick envelopes

Author: Susan Urban (smu29) (SYSEN 5800 Fall 2021)

## Introduction

Optimization of a non-convex function f(x) is challenging since it may have multiple locally optimal solutions or no solution and it can take a significant amount of time, resources, and effort to determine if the solution is global or the problem has no feasible solution. According to Castro1, "Gradient based solvers [are] unable to certify optimality". Different techniques are used to address this challenge depending on the characteristics of the problem. One technique used is convex envelopes2:

Given a non-convex function f(x), g(x) is a convex envelope of f(x) for X $\in$ S if:

·      g(x) is convex under-estimator of f(x)

·      g(x)>=h(x) for all convex under-estimators h(x)

## McCormick Envelopes

In particular, for bilinear (e.g., x*y, x+y) non-linear programming (NLP) problems3, the McCormick Envelope4 is a type of convex relaxation used for optimization.

In case of an NLP, a linear programming (LP) relaxation is derived by replacing each bilinear term with a new variable and adding four sets of constraints. In the case of a mixed-integer linear programming (MINLP), a MILP relaxation is derived. This strategy is known as McCormick relaxation.

The LP solution gives a lower bound and any feasible solution gives an upper bound.

As noted by Scott et al5, "McCormick envelopes are attractive due to their recursive nature of their definition, which affords wide applicability and easy implementation computationally.  Furthermore, these relaxations are typically stronger than those resulting from convexification or linearization procedures."

## Derivation of McCormick Envelopes

The following is a derivation of the McCormick Envelopes:2

$Let\ w=xy$ $x^{L}\leq x\leq x^{U}$ $y^{L}\leq y\leq y^{U}$ where $x^{L},x^{U},y^{L},y^{U}$ are   upper  and   lower  bound  values  for  $x$ and $y$ , respectively.

$a=\left(x-x^{L}\right)$ $b=\left(y-y^{L}\right)$ $a*b\geq 0$ $a*b=\left(x-x^{L}\right)\left(y-y^{L}\right)=xy-x^{L}y-xy^{L}+x^{L}y^{L}\geq 0$ $w\geq x^{L}y+xy^{L}-x^{L}y^{L}$ $a=\left(x^{U}-x\right)$ $b=\left(y^{U}-y\right)$ $w\geq x^{U}y+xy^{U}-x^{U}y^{U}$ $a=\left(x^{U}-x\right)$ $b=\left(y-y^{L}\right)$ $w\leq x^{U}y+xy^{L}-x^{U}y^{L}$ $a=\left(x-x^{L}\right)$ $b=\left(y^{U}-y\right)$ $w\leq xy^{U}+x^{L}y-x^{L}y^{U}$ The under-estimators of the function are represented by:

$w\geq x^{L}y+xy^{L}-x^{L}y^{L}$ $w\geq x^{U}y+xy^{U}-x^{U}y^{U}$ The over-estimators of the function are represented by:

$w\leq x^{U}y+xy^{L}-x^{U}y^{L}$ $w\leq xy^{U}+x^{L}y-x^{L}y^{U}$ ## Example: Convex Relaxation

The following shows the relaxation of a non-convex problem:2

Original non-convex problem:

$\min Z=\textstyle \sum _{i=1}\sum _{j=1}c_{i,j}x_{i}x_{j}+g_{0}(x)$ $s.t.\sum _{i=1}\sum _{j=1}c_{i,j}^{l}x_{i}x_{j}+g_{l}(x)\leq 0,\forall l\in L$ $x^{L}\leq x\leq x^{U}$ Replacing $u_{i,j}=x_{i}x_{j}$ we obtain a relaxed, convex problem:

$\min Z=\textstyle \sum _{i=1}\sum _{j=1}c_{i,j}u_{i,j}+g_{0}(x)$ $s.t.\sum _{i=1}\sum _{j=1}c_{i,j}^{l}u_{i,j}+g_{l}(x)\leq 0,\forall l\in L$ $u_{i,j}\geq x_{i}^{L}x_{j}+x_{i}x_{j}^{L}-{x_{i}}^{L}{x_{j}}^{L},\forall i,j\$ $u_{i,j}\geq x_{i}^{U}x_{j}+x_{i}x_{j}^{U}-{x_{i}}^{U}{x_{j}}^{U},\forall i,j\$ $u_{i,j}\geq x_{i}^{L}x_{j}+x_{i}x_{j}^{U}-{x_{i}}^{L}{x_{j}}^{U},\forall i,j\$ $u_{i,j}\geq x_{i}^{U}x_{j}+x_{i}x_{j}^{L}-{x_{i}}^{U}{x_{j}}^{L},\forall i,j\$ $x^{L}\leq x\leq x^{U},\ \ u^{L}\leq u\leq u^{U}$ Good bounds are essential to focus and minimize the feasible solution space and to reduce the number of iterations to find the optimal solution. "Good bounds may be obtained either by inspection or solving the optimization problem to minimize (maximize) x, subject to the same constraints as the original problem."2

As discussed by Hazaji6, global optimization solvers implement bound contraction techniques and once the boundary is optimized, domain partitioning may become necessary. Spatial branch and bound schemes7,8 are among the most effective partitioning methods in global optimization. By dividing the domain of a given variable, the solver is able to divide the original domain into smaller regions, further tightening the convex relaxations of each partition.

## Example: Numerical

$min\ Z=xy+6x+y$ $s.t.\ xy\leq 18$ $0\leq x\leq 10$ $0\leq y\leq 2$ $Let\ w=xy$ $min\ Z=-w+6x+y$ $s.t.\ w\leq 18$ $w\geq 0$ $w\geq 10y+2x-20$ $w\leq 10y$ $w\leq 2x$ Using GAMS, the solution is z= -24, x=6, y=2.

GAMS code sample:

variable z;

positive variable x, y, w;

equations  obj, c1, c2, c3, c4, c5 ;

obj..    z =e= -w -2*x ;

c1..     w =l= 12 ;

c2..     w =g= 0;

c3..     w =g= 6*y +3*x -18;

c4..     w =l= 6*y;

c5..     w =l= 3*x;

x.up = 10;

x.lo =0;

y.up = 2;

y.lo = 0;

model course5800 /all/;

option mip = baron;

option optcr = 0;

solve course5800 minimizing z using mip ;

## Application

Bilinear expressions are the most common non-convex components in mathematical formulations modeling problems in: 6

Chemical engineering 9, 10, 11, 12

Process network problems13

Water networks14

Pooling and blending15 (Haverly, 1978)

Supply Chain and Transportation 16, 10, 11, 12

Energy Systems 17 18 19 20

## Conclusion

McCormick Envelopes provide a relaxation technique for bi-linear non-convex nonlinear programming problems3. Since non-convex NLP are challenging to solve and may be time or computationally resource intensive, McCormick envelopes are relevant due to their recursive nature, which affords wide applicability and easy implementation computationally.  Furthermore, these relaxations are typically stronger than those resulting from convexification or linearization procedures4.