Implemented the quadratic optimization problem