Optimization with equilibrium constraints: A piecewise SQP approach; Sequential quadratic programming: Interior point me