1

Consider the problem of minimizing $f : D \to \mathbb{R}$, over its domain, being $$ f(\lambda) = -\lambda \alpha + \sum_{i=1}^n \beta_i \vert u_i - \lambda \vert, $$ where $\alpha \in \mathbb{R}$, $\{\beta_i\}_{i=1}^n \subset \mathbb{R}_{\geq 0}$ and $\{u_i\}_{i=1}^n \subset \mathbb{R}$ are given. Note that the factors $\beta_i$ are nonnegative. I'm only interested in either $D = \mathbb{R}$ or the half-line $D = \mathbb{R}_{\geq 0}$.


I know that this problem can be reformulated as a linear programming (LP) problem and I can solve it with a generic LP solver. But is there an alternative, more direct solution? (in terms of computational efficiency). For instance, if $\alpha = 0$ and $\beta_i = 1$ for all $i$, the solution (at least for $D = \mathbb{R}$) is the median of the $u_i$'s as shown here.

mforets
  • 545

1 Answers1

2

Below is a partial solution which may or may not be helpful.

If $\alpha=0$, I would think the answer is a sort of generalized median. Sort the $u_i$ values; I'll call the value with position $j$ in the sorted list $u_{(j)}$, and the corresponding weight $\beta_{(j)}$. Then find where you have half the weight on the left and half the weight on the right: that is,

$$\underset{m}{\text{arg min}} \left| \sum_{j=1}^m \beta_{(j)} - (1/2) \sum_{j=1}^n \beta_{(j)} \right| $$

Then $\lambda=u_{(m)}$ would be the solution. I don't have a proof that this works and maybe it only works if all the $\beta_i$ values are positive. I assume they are not necessarily positive though or you would have mentioned that.

For extending this beyond $\alpha=0$, you can actually absorb $\alpha$ into the original problem: set $u_0=0$ and $\beta_0=-\alpha$. EDIT: Only if $D$ is the half-line, though.

user54038
  • 367
  • 1
  • 9
  • Interesting, thanks! I have to think about it though, but seems to go in the right direction. Indeed, I'm only interested in non-negative $\beta_i$'s, let me add that information to the OP. $\alpha$ can have any sign though. – mforets Apr 08 '20 at 17:12
  • I'm thinking about making the derivative as close as possible to zero. If I think about the derivative for a given $\lambda$, it's the beta values on the left, minus the beta values on the right, minus $\alpha$. So the effect of $\alpha$ is that instead of looking to balance the weight evenly on both sides of $\lambda$, you are looking for an imbalance equal to $\alpha$. This should be solvable by sorting by $u$ ($O(n \log n)$), cumulatively summing $\beta$ ($O(n)$), and scanning for where the imbalance is closest to $\alpha$ ($O(n)$). – user54038 Apr 08 '20 at 23:18