import cvxpy as cp
import numpy as np
x_1 = cp.Variable()
x_2 = cp.Variable()
objective = cp.Minimize(x_1)
constraints = [2*x_1 + x_2 >= 1, x_1+3*x_2>=1, x_1>=0, x_2>=0]
prob = cp.Problem(objective, constraints)
# The optimal objective value is returned by `prob.solve()`.
result = prob.solve()
# The optimal value for x is stored in `x.value`.
print(result)
print("x_1", x_1.value)
print("x_2", x_2.value)
I specify that x_1 >= 0
, however the solver gave me this result:
-9.944117370034156e-05
x_1 -9.944117370034156e-05
x_2 3.4085428032616
Where the result x_1 is below 0