<p>$$0\leq u \leq \bar u  \implies -\frac {\bar u}{2} \leq u - \frac {\bar u}{2} \leq \frac {\bar u}{2}$$</p>

<p>$$\implies \left | u - \frac {\bar u}{2}\right| \leq \frac {\bar u}{2}$$</p>

<p>$$\implies \frac {\bar u}{2} - \left | u - \frac {\bar u}{2}\right| \geq 0$$</p>

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

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

<p>Let's see: we then are allowed to decompose the square and write</p>

<p>$$\frac {\bar{u}^2}{4} - u^2 + u\bar u - \frac {\bar{u}^2}{4} \geq 0$$ </p>

<p>$$\implies -u^2 + \bar u u \geq 0 \implies u(\bar u -u) \geq 0$$ </p>

<p>which is nothing more than <em>the multiplication</em> of the two separate constraints.</p>

<p><strong>ADDENDUM II</strong><br>
If we have $u \in [a,b]$ for $a&lt;b$ arbitrary reals, then the general expression is</p>

<p>$$-u^2+(a+b)u-ab\geq 0$$</p>

CC BY-SA 3.0
2016-03-29T16:44:49.850Z
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
CC BY-SA 3.0
2016-03-29T17:30:05.583Z
@denesp By all means - and it gets even better.
Alecos Papadopoulos
CC BY-SA 3.0
2016-03-29T18:20:28.637Z
Thanks guys. Is it conincidence that it's just the multiplication of the two seperate constraints, or some general rule?
clueless
CC BY-SA 3.0
2016-03-29T18:29:02.037Z
@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
CC BY-SA 3.0
2016-03-29T18:31:34.900Z
@denesp These inequalities cannot hold at the same time.
Alecos Papadopoulos
CC BY-SA 3.0
2016-03-29T18:34:12.617Z
@denesp Writing $[0,\bar u]$ always means that $\bar u \geq 0$.
Alecos Papadopoulos
CC BY-SA 3.0
2016-03-29T18:34:17.243Z
You are probably right, it seems to be implied by the problem.
Giskard
CC BY-SA 3.0
2016-03-29T16:23:32.390Z
2016-03-30T09:41:40.023Z
2016-03-30T09:41:40.023Z
Alecos Papadopoulos
<p>Consider the following problem
\begin{align}
&amp;\max_u F(x,u)\\
\text{s.t. }&amp; u \in [0,\bar u].
\end{align}</p>

<p>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$?</p>

CC BY-SA 3.0
2016-03-29T12:20:33.480Z
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
<optimization>
Constrainted optimization: merge two constraints into one
clueless
# Constrainted optimization: merge two constraints into one

(Asked by: username_0 on 2016-03-29)

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$?

**Tags:** optimization
> **Comments:**
> **username_1**: 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.  

---

## 1 answers

### Answer by username_2 on 2016-03-29. Score: 3 | Accepted answer

$$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.

**ADDENDUM II**  
If we have $u \in [a,b]$ for $a

$$-u^2+(a+b)u-ab\geq 0$$

> **Comments:**
> **username_1**: 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}$.  
> **username_2**: @denesp By all means - and it gets even better.  
> **username_0**: Thanks guys. Is it conincidence that it's just the multiplication of the two seperate constraints, or some general rule?  
> **username_1**: @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.  
> **username_2**: @denesp These inequalities cannot hold at the same time.  
> **username_2**: @denesp Writing $[0,\bar u]$ always means that $\bar u \geq 0$.  
> **username_1**: You are probably right, it seems to be implied by the problem.  

---

