One way to think about the optimization problem (actually more of a control problem) is that you'll want to make periodic adjustments to your portfolio (like a thermostat regulates temperature). For a portfolio, in the end, it is a vector of N weights (i.e. a vector in N-dimensional space), normalized to 1 (which is then multiplied times a leverage scale factor, which ranges from 0 to ~6). So, the problem comes down to updating the portfolio vector such that the "distance" between the old and new vectors is minimized, i.e. my objective function is an expression of the relationship between the old and new allocations. One approach is to use the square of the Euclidean distance between the old and new vectors.
So, with only one equality constraint that the new portfolio vector be normalized to 1, one ends up doing nothing. By adding additional constraints, the portfolio vector can be rotated in its N-dimensional space. I am still getting up the learning curve, but using the square of the Euclidean distance as an objective function puts one in the domain of quadratic programming. If the equality and inequality constraints can be expressed as linear functions of the portfolio weights, then there is computational machinery that can handle the problem. I'm not yet clear whether one is guaranteed of convergence to the constrained global minimum, and how long it might take, based on the number of weights (N), and the details of the constraints.
A relevant paper on the topic is http://icml.cc/2012/papers/168.pdf along with its references.
For other optimizers available on Quantopian, see: