This document presents the optimization of the array factor (AF) pattern of a 49-element active planar phased array using particle swarm optimization (PSO) to recover from antenna element failures. It discusses the effects of up to 20% non-working elements on the AF pattern and demonstrates how PSO can effectively restore the pattern without physical repairs or replacements. The study includes detailed evaluations and statistical analyses of multiple recovery cases, showcasing the efficiency of the developed software tool in achieving optimal solutions.