0

I have an optimisation problem:

$$ \max_{\theta} \quad \theta \\ \text{such that} \qquad |x + \theta a| \leq b $$

where $x, a \in \mathbb{R}^{n}$. We know that $|x| \leq b$. The norm referred to here is the $\ell_{1}$-norm.

Is there a simple way to solve this kind of optimisation problem that does not require using a full blown convex optimisation technique? Given that the problem is one dimensional my only thought was to solve this problem for different intervals of $\theta$ manually. i.e. for $\theta \in [0, 10]$ we may know that $x_{1} + \theta a_{1} \leq 0$ and $x_{i} + \theta a_{i} \geq 0$ for all $ 1< i \leq n$. Then we can replace the constraint with a simple sum and solve. But this would still require a number of checks dependent on the dimension of $a$ which I would like to avoid if possible. Does this problem have a well known analytical solution?

2 Answers2

4

The function $f(\theta) =||x-\theta a||_1$ is piecewise linear and you know $f(0) \leq b$. Here is an $\mathcal{O}(n\log n)$ algorithm:

  1. Precompute the breakpoints $x_i / a_i$ and sort the positive breakpoints in ascending order.

  2. Set $\theta^0=0$ and compute $f(\theta^0)$ and $f_+'(\theta^0)$ (the right derivative).

  3. Iteratively move to the next breakpoint $\theta^{k+1}$, and check if $f(\theta^{k+1})=f(\theta^k) + f_+'(\theta^k)(\theta^{k+1}-\theta^k) \leq b$. If yes, set $f_+'(\theta^{k+1}) := f_+'(\theta^k) + 2|a_{i(k)}|$ and repeat this step. If no (or if there is no next breakpoint), solve $f(\theta^k) + f_+'(\theta^k)(\theta^{k+1}-\theta^k) = b$ for the solution.

LinAlg
  • 19,822
  • Does the vector $a_{i(k)}$ here correspond to the vector of zeros with the $i$th entry replaced by $a_{i}$? If so should't I be adding $2a_{i(k)}$ as the gradient will change from $-a_{i(k)}$ to $a_{i(k)}$? – Nick Bishop May 27 '20 at 15:56
  • @NickBishop $a_{i(k)}$ refers to the $a_i$ corresponding to the $k^{th}$ breakpoint. It is a scalar, and the factor 2 was indeed missing.Copper.hat good point, thx – LinAlg May 27 '20 at 21:41
3

Here is one computational solution:

We can write the constraint as $\sum_{a_k \neq 0} |x_k+\theta a_k| = b-\sum_{a_k = 0} |x_k|$, so we can suppose that $a_k \neq 0$ for all $k$.

Let $f(\theta) = \|x+\theta a\|_1$, we are given that $f(0) \le b$. Note that $f$ is convex and piecewise affine.

Let $\theta_k^*$ solve $x_k+\theta a_k = 0$ and note that $f(\theta) = \sum_k |a_k| |\theta-\theta_k|$.

Let $B = \{ \theta_k^* | \theta_k^* >0 \} \cup \{0\}$. Sort the collection into $t_0=0,t_1,...,t_m$

If $f(t_m) \le b$ and $\theta \ge t_m$ then $f(\theta) = \sum_k |a_k| (\theta-\theta_k)$ and so the solution is given by $\theta^* = {b + \sum_k \theta_k^* |a_k| \over \sum_k |a_k| }$.

Otherwise we have $f(t_m) >b$. Find the largest index $k$ such that $f(t_k) \le b$, then we know that the solution lies in $[t_k,t_{k+1})$ and is given by $\theta^* = \lambda t_{k+1} + (1-\lambda)t_k$ where $\lambda = {b - f(t_k) \over f(t_{k+1})-f(t_k)}$.

copper.hat
  • 172,524
  • after sorting, your solution is $\mathcal{O}(\log n)$ steps of $\mathcal{O}(n)$ each, and my solution is $\mathcal{O}(n)$ steps of $\mathcal{O}(1)$ each, right? – LinAlg May 27 '20 at 14:22
  • Just evaluating $f$ is $O(n)$ and both require up to $n$ steps. – copper.hat May 27 '20 at 14:45
  • your method is $\log n$ steps with the bisection method to find the right breakpoints – LinAlg May 27 '20 at 15:10
  • Both methods could use bisection (at least bisection in terms of the indices) to get $O(n \log n)$. I do not have any intuition regarding the behaviour from a probabilistic perspective. – copper.hat May 27 '20 at 16:16