A genetic software program is developed to provide seamless integration among commercial codes for analysis and simulation of electromagnetic problems. Combined with the genetic algorithm, the developed program is able to perform automatic tuning of the structures for optimized design of the polarizers in horn antennas. Numerical results show that proper stub insertions may provide additional freedoms to optimally design the polarizer with a better return loss and a flexible phase tuning, which is particularly useful to compensate the deficiency of a horn antenna to radiate better circularly polarized fields. Improvement of the circularly-polarized(CP) radiation of horn antennas is achieved through the insection of either dielectric or metallic about stubs inside the waveguides.