So I have a set of linear homogeneous equations $A\vec{x}=0$. I would like to solve this for non-negative solutions. I can solve the system in general and I get the two vectors that span the solution space, but one of the vectors has negative entries. I would like to restrict the solution space to $\mathbb{R}_{\geq0}^n$. I should add that the vector $\vec{x}$ is a vector of symbolic variables (Sympy), not sure if this is important.
I have been told that one way to do this is to use the simplex method of linear programming and set the objective function to be the zero function. When I do this in SciPy I only get one solution vector and not the two I want (the output seems to be the sum of the two I want).
Questions
How could I go tweak the algorithm so that it spits out the vectors (extremal rays) that span the solution space (cone)?
Are there any other libraries that I can use that will do this for me in Python?
Example Let's say I have the system:
- $\lambda_0 - \lambda_3 = 0$
- $\lambda_1 + \lambda_4 - \lambda_0 = 0$
- $\lambda_2 - \lambda_1 = 0$
- $\lambda_3 - \lambda_2 - \lambda_4 = 0$
Solving this system is equivalent to finding the nullspace of,
\begin{bmatrix} 1&0&0&-1&0\\ -1&1&0&0&1\\ 0&-1&1&0&0\\ 0&0&-1&1&-1\\ \end{bmatrix}
Using a SciPy method to find the nullspace of the matrix gives me the solution space spanned by the vectors, $$ [1, 1, 1, 1, 0] , [0, -1, -1, 0, 1]$$ I would like to restrict this to non-negative solutions. I believe the two vectors that span the solution space restricted to the positive reals is, $$ [1, 1, 1, 1, 0] , [1, 0, 0, 1, 1] $$ So far I have tried to use the linear programming method with the simplex method by setting the objective function to the zero function. The output there is, $$ [2, 1, 1, 2, 2]$$ This is the sum of the two I want. The least-squares method gives the same result under bounds (0.5,2).