# Constrainted optimization: merge two constraints into one

Consider the following problem \begin{align} &\max_u F(x,u)\\ \text{s.t. }& u \in [0,\bar u]. \end{align}

Any idea how to merge the two constraints $u \geq 0$ and $\bar u - u \geq 0$ into one constraint $f(u,\bar u) \geq 0$?

• Sure. Define the function $f$ so that $f(u,\bar{u}) = -1$ if $u < 0$ or $\bar{u} - u < 0$, and otherwise let $f(u,\bar{u}) = 0$. This is a well defined function. Perhaps you would like to include that $f$ is differentiable or some similar condition. – Giskard Mar 29 '16 at 12:20

$$0\leq u \leq \bar u \implies -\frac {\bar u}{2} \leq u - \frac {\bar u}{2} \leq \frac {\bar u}{2}$$

$$\implies \left | u - \frac {\bar u}{2}\right| \leq \frac {\bar u}{2}$$

$$\implies \frac {\bar u}{2} - \left | u - \frac {\bar u}{2}\right| \geq 0$$

ADDENDUM In a comment it was proposed that we could instead use the squared expression to achieve differentiability everywhere,

$$\frac {\bar{u}^2}{4} - \left ( u - \frac {\bar u}{2}\right)^2 \geq 0$$

Let's see: we then are allowed to decompose the square and write

$$\frac {\bar{u}^2}{4} - u^2 + u\bar u - \frac {\bar{u}^2}{4} \geq 0$$

$$\implies -u^2 + \bar u u \geq 0 \implies u(\bar u -u) \geq 0$$

which is nothing more than the multiplication of the two separate constraints.

If we have $u \in [a,b]$ for $a<b$ arbitrary reals, then the general expression is
$$-u^2+(a+b)u-ab\geq 0$$
• Nice! But $$\frac {\bar{u}^2}{4} - \left ( u - \frac {\bar u}{2}\right)^2 \geq 0$$ is even better because it is differentiable everywhere, even in $u = \frac {\bar u}{2}$. – Giskard Mar 29 '16 at 16:44
• @AlecosPapadopoulos Good decomposition but actually you have just shown that all our rules so far are incorrect :) Your new condition also holds if $u < 0$ AND $\bar u < u$ :( If $\bar u < 0$ is impossible then we are fine though. – Giskard Mar 29 '16 at 18:29