The result of program is giving very different solutions CVXpy

Here is my optimization code:

        x = cvxpy.Variable(d) 
        constraints = [M.T @ x >= 1]
        constraints += [x>=0]
        prob = cvxpy.Problem(cvxpy.Minimize(x @ v0),constraints ) #x@v11 v0

    # Print result. c.T@x
    print("\nThe optimal value is", prob.value)
    print("A solution x is")
    print("A dual solution is")

M is a constant matrix and it is correct
v0 is changing
When I run the program, sometimes I am getting the correct answer which is approximately 0.42 but sometimes I am getting very weird result like 2.45673e-11. I know the result can be different but not that much
What can I do for that?

This is the CVX forum, and does not address CVXPY. I suggest you post at . When you post there, perhaps you’ll show the values of v0 you used, and the corresponding solutions, as well as all input data to make it a completely reproducible problem.

1 Like