entirely rewrite the solve_minimization function in the local problem.

The previous bug of not able to get local problem converged should be solved by this commit.