I'm trying to solve a system of linear equations (5 variables on 11 different equations/restrictions).
The problem I'm having is that the solution I'm looking for can't be only equal since I'm trying to optimize for a budget, it has to be >= or <= but I'm not sure how write that in numpy.
The equations are as follow (only a few to simplify):
- X/.07 >= 1728
- Y/.02 >= 4431
- Z/.05 >= 5409
- A/.005 >= 7138
- B/.01 >= 4897
- A + B + X + Y + Z >= 100781
Ideally I'd like to include others like:
- 9000 <= X <= 60000
- 9000 <= Y <= 60000
- 9000 <= Z <= 60000
- 9000 <= A <= 60000
- 9000 <= B <= 60000
But I'm not sure how to include them.
So far I Have
a = np.array([[1,0,0,0,0],
[0,1,0,0,0],
[0,0,1,0,0],
[0,0,0,1,0],
[0,0,0,0,1],
[1,1,1,1,1]])
b = np.array([121204, 81069, 263260, 23541, 42964, 100781])
print(np.linalg.lstsq(a,b,rcond=None))
But clearly that's not what im looking for. (Notice b is simply the result of multiplying the right side by the denominator of the left hand)
Thank you!