# Maximisation of the absolute value of a linear function subject to bound constraints: Am I wrong?

I have the following optimisation problem:

$$\max |a_0 + a_1x_1 + \dots + a_nx_n |$$

subject to bound constraints

$$\mathbf{b}_l \leq \mathbf{x} \leq \mathbf{b}_u.$$

According to this previous post and this link, this problem converts to a mixed-integer program.

However, I am rather convinced that I can simply replace this problem with the best solution from the following two separate linear programs:

$$\max a_0 + a_1x_1 + \dots + a_nx_n$$

subject to

$$\mathbf{b}_l \leq \mathbf{x} \leq \mathbf{b}_u$$

and

$$\min a_0 + a_1x_1 + \dots + a_nx_n$$

subject to

$$\mathbf{b}_l \leq \mathbf{x} \leq \mathbf{b}_u$$.

Comparing the two results and choosing the one with greatest absolute value should surely give me the answer to the first optimisation problem, without having to resort to formulating the original problem as a mixed-integer linear program.

If I am wrong, could someone please explain why?

Yes, you can solve this special case of maximizing $$|z|$$ by separately maximizing and minimizing $$z$$ and taking the larger resulting value of $$|z|$$, without introducing any additional variables or constraints. This approach even applies if $$z$$ is nonlinear and/or if you have more general constraints.