Technology is disclosed for modeling positions of implanted devices in a patient. In various embodiments, the technology can construct a forward model that predicts an electrical impedance between electrical contacts; detects an actual electrical impedance between electrical contacts; computes a fitness value based on a comparison between the detected electrical impedance and the predicted electrical impedance; varies at least one parameter of the forward model until the computed fitness value is a maximum fitness value; and displays at a display device a estimated position of the first lead and/or second leads.