The paper discusses the optimization of the array factor pattern of a 49-element active planar phased array using Particle Swarm Optimization (PSO) in response to antenna element failures. It highlights the challenges posed by element failures leading to degraded performance, and presents a computational approach for recovering the array pattern efficiently without the need for physical repairs. Through multiple case studies, the effectiveness of the PSO method is evaluated, demonstrating a successful recovery of the array factor pattern even with up to 20% element failures.