I'm trying to solve a system $Ax = b$ where all entries of $x$ are nonnegative, and most are zero. So if $x$ has $N$ entries, then $\epsilon N$ of them are nonzero, where $\epsilon > 0$ is some small constant. Is it possible to use linear programming in this setting?
-
Is $\epsilon$ given? – Rodrigo de Azevedo May 03 '17 at 09:30
-
@RodrigodeAzevedo Since you've create the tag [tag:sparsity], can you update the tag info, possibly explaining how its usage is different from [tag:sparse-matrices]? – pjs36 May 08 '17 at 21:42
-
@pjs36 Would finding a sparse solution to $\rm A x = b$ fall under the "sparse matrices" category? Yes, a column vector can be viewed as a matrix, but that is unsatisfying. – Rodrigo de Azevedo May 09 '17 at 00:47
1 Answers
I assume you want to solve for $x$ where $$\begin{align} & Ax=b \\ & x_i\ge 0 \\ & \sum_{i|x_i>0} 1 \le m \end{align}$$ Counting non-zero elements is not easy in an LP, but we can use a MIP model: $$\begin{align} & Ax=b \\ & x_i \le M y_i \\ & \sum_i y_i \le m\\ & x_i\in [0,M] \\ & y_i \in \{0,1\} \end{align}$$ where $M$ is an upper bound on $x_i$ and $y_i$ are binary variables.
This approach requires some reasonable upper bound on $x$. Otherwise many MIP solvers nowadays have a concept called indicator variables, allowing a model like this to be solved without a big-$M$. I.e.:
$$\begin{align} & Ax=b \\ & y_i = 0 \Rightarrow x_i=0 \\ & \sum_i y_i \le m\\ & x_i\ge 0 \\ & y_i \in \{0,1\} \end{align}$$
- 4,367
- 2
- 13
- 16