copied in solver from cvxpy