I'm trying to find what combination and quantity of crops I should grow to provide a complete diet. Basically, I have a set of n possible crops that I can grow, and I have m nutritional requirements. So, I need to solve an underdetermined m x n matrix to find the quantities needed of each crop. It seems simple at first, but there are a couple other requirements:
First, I'd like to minimize the number of things I have to grow. Obviously growing every possible crop in sufficient quantity will provide a complete diet, but that's obviously not feasible. From what I've researched, solving the system while minimizing the $l_0$ norm will minimize the number of crops.
Secondly, for many dietary requirements, there is a maximum allowable amount. So, in addition to the minimum requirements, the solution should also be subject to maximum inequality constraints. For example, if I consumed only Spirulina, I could meet many of the minimum nutritional requirements, but I would consume too much Copper, Magnesium, etc.
Seriously, though, I'm just trying to grow a garden here. The only way I know to compute all this is with NumPy and friends, and it seems like a lot of work for what I'd think was a common kind of problem. Is there an easier/better way to solve this problem?
As @P.Lawrence mentioned in a comment, your problem is an extension of https://en.wikipedia.org/wiki/Stigler_diet, which is a linear programming problem. In your extension, instead of minimizing cost, you want to minimize the number of crops. For each crop $j\in\{1,\dots,n\}$, let nonnegative decision variable $x_j$ indicate the amount of crop $j$ used, and let binary decision variable $y_j$ indicate whether crop $j$ is grown. Let $M_j$ be a constant upper bound on $x_j$. The (mixed integer linear programming) problem is to minimize the $\ell_0$ norm $\sum_{j=1}^n y_j$ subject to linear "big-M" constraints $$x_j \le M_j y_j \quad \text{for all $j$} \tag1\label1$$ and Stigler's original linear constraints on $x$. Constraint \eqref{1} enforces the logical proposition $x_j > 0 \implies y_j = 1$.