This paper studies the problem of safe and optimal continuum deformation of a large-scale multi-agent system (MAS). We present a novel approach for MAS continuum deformation coordination that aims to achieve safe and efficient agent movement using a leader-follower multi-layer hierarchical optimization framework with a single input layer, multiple hidden layers, and a single output layer. The input layer receives the reference (material) positions of the primary leaders, the hidden layers compute the desired positions of the interior leader agents and followers, and the output layer computes the nominal position of the MAS configuration. By introducing a lower bound on the major principles of the strain field of the MAS deformation, we obtain linear inequality safety constraints and ensure inter-agent collision avoidance. The continuum deformation optimization is formulated as a quadratic programming problem. It consists of the following components: (i) decision variables that represent the weights in the first hidden layer; (ii) a quadratic cost function that penalizes deviation of the nominal MAS trajectory from the desired MAS trajectory; and (iii) inequality safety constraints that ensure inter-agent collision avoidance. To validate the proposed approach, we simulate and present the results of continuum deformation on a large-scale quadcopter team tracking a desired helix trajectory, demonstrating improvements in safety and efficiency.