Optimization methods for active and passive localization