I am currently performing optimization onto a quadratic function by manually coding the algorithm:
$$\min f = x^T v x - r^T x\\ \text{subject to } x \geq 0\, .$$
Here, optimizing the function without the constraint above is not a problem at all. However, if I want to add this inequality constraint, I do not know how can I implement it in Python. I have seen Scipy Optimization Package uses np.clip
to clamp the array within the bound, but it is forcing negative values to 0, thus somehow affecting the answer to finding the minimum point.
I wish to know if there is any other method to naturally ensure the array of numeric values always stays positive in every iteration?