Development of optimization algorithms for electromagnetic characterization in free space