Problems: Convergence of the method? Is the final solution (x, r) non negative?
As for the second question modify F by asking xi ri = r > 0 rather than xi ri = = 0.