using linear programming to find median

355 Views Asked by At

I'm trying to figure out how to transform a median solving problem for a list of number x to linear programming and with standard form of $$\text{min }c^Tx \text{ s.t: } Ax\le b \text{ and }x \geq 0$$

I know that we need to use l1 norm to find median and median = $$argmin \sum|m-xi|$$

but I'm not sure how to transform this absolute value to an optimization question in standard form.

1

There are 1 best solutions below

1
On

Let $z_i = |m-x_i|$, then the problem becomes

$$\min_{m,z_1, \ldots, z_n} \sum_i z_i$$

subject to $z_i \ge m-x_i, z_i \ge x_i -m, \forall i \in \{1, n\}$.

I will leave the task of converting it to standard form to you.