# What's the best way to handle a quadratic constraint

What is the best way to handle a constraint of the type $ax_1^2+x_2^2+...+x_n^2=c$ in a gradient descent algorithm?

I would like to solve an optimization problem of the type: $$\min J(x_1,..,x_n)$$ with this constraint using gradient descent. I tried to think of a way to alter the gradient so that it doesn't affect the constraint, but I didn't manage to do something useful.

What I did was that after each gradient descent, I projected (in a more or less correct way...) the result onto the constraint. I got the results I wanted, but I don't think my approach was 100% valid...

• Your constraint is an ellipsoid. It shouldn't be very difficult to just find the closest point on the surface from $x_k+\delta x_k$. Sep 5, 2013 at 2:17