0

I want to solve the following optimisation problems.

$$ \begin{gather} &\begin{array}{ll} \underset {x, y} {\text{minimize}} & |x|+|y| \\ \text{subject to} & 3 x + 2 = y \end{array} \tag{OP$_1$} \\ \\ \\ &\begin{array}{ll} \underset {x, y} {\text{minimize}} & |x|+|y| \\ \text{subject to} & \sin x + x^2 = y\end{array} \tag{OP$_2$} \end{gather}$$

I would be highly obliged for any help, hints or suggestions.

AgnostMystic
  • 1,808

2 Answers2

1

Both of these problems can be solved by using the constraints to eliminate $\ y\ $ from the objective functions. The first is equivalent to $$ \underset{x}{\text{minimize}}\ |x|+|2+3x|\ , $$ and the second to $$ \underset{x}{\text{minimize}}\ |x|+|x^2+\sin x|\ . $$ For the objective of the first, we have $$ |x|+|2+3x|=\cases{-4x-2&if $\ x\le-\frac{2}{3}$\\ 2+2x&if $\ -\frac{2}{3}<x\le0$\\ 2+4x&if $\ 0<x\ $,} $$ which is clearly decreasing for $\ -\infty<x\le-\frac{2}{3}\ $ and increasing for $\ -\frac{2}{3}\le x\le\infty\ $, and therefore attains its minimum of $\ \frac{2}{3}\ $ at $\ x=-\frac{2}{3}\ $.

The equation $$ x^2+\sin x=0 $$ has a unique solution $\ x_0\ $ lying somewhere in the interval $\ \left(-\frac{\pi}{2},0\right)\ $. The function $\ x^2+\sin x\ $ is negative for $\ x_0<x<0\ $, but non-negative for $\ x\le x_0\ $ and $\ 0<x\ $. Therefore $$ |x|+|x^2+\sin x|=\cases{x^2+\sin x-x&if $\ x\le x_0$\\ -x^2-\sin x-x&if $\ x_0<x\le0$\\ x^2+\sin x+x&if $\ 0<x\ $.} $$ While it's not as immediately obvious as in the first case, it's not difficult to show from this that $\ |x|+|x^2+\sin x|\ $ is decreasing for $\ -\infty<x\le 0\ $ and increasing for $\ 0\le x\le\infty\ $, and therefore attains its minimum of $\ 0\ $ at $\ x=0\ $.

0

for first one, you can linearize by couple of constraints defined by 2 additional variables $ x',y'$
$ x \le x'$
$ -x \le x'$
$ y \le y'$
$ -y \le y'$
$3x+2 = y$
Min $ x' + y'$

For OP2, same for the norm but if you want to linearize $\sin(x)$ either you need special constraints from solvers like Gurobi or use piecewise linear functions.

  • A graphical estimate may be the best way to get an approximate answer for the second problem. That is, make a graph of $y=x^2+\sin x$ and use this to estimate the closest point (in the L1 sense)…and in fact this is better than an estimate. – Semiclassical Feb 25 '23 at 18:20