An iterative metric method for solving the inverse tokamak equilibrium problem