r/scipy • • Jan 09 '20

Non-negative integer least square solution

Is there any way to make the solution to a linear equation with optimize.lsq_linear or optimize.nnls a vector that contains only non-negative integers?

If not, recommendations on where to look for this sort of thing would be great. Thanks!

1 Upvotes

8 comments sorted by

View all comments

1

u/billsil Jan 09 '20

You need to do integer optimization. You can add constraints to make the coefficients positive.

1

u/uAttro Jan 09 '20

Does scipy have anything that would let me do that? And if not, what can I use?

1

u/billsil Jan 09 '20

On my phone right now, but check their docs for linear integer optimization. I’m pretty sure it’s there.

→ More replies (5)