This paper presents a mixed-agent (MoA) approach for code optimization in regulated industries. In environments where the use of commercial LLMs is limited due to regulatory compliance and data privacy concerns, we propose MoA, which combines multiple specialized open-source LLMs to generate code. We compare it with TurinTech AI's genetic algorithm (GA)-based ensemble system and individual LLM optimizers. Experimental results using real-world industrial codebases demonstrate that MoA achieves cost savings of 14.3% and 22.2%, respectively, and optimization time reductions of 28.6% and 32.2%, respectively, using open-source models. Furthermore, we demonstrate the superiority of the GA-based ensemble on commercial models, and both ensembles outperform individual LLMs. We validate its applicability in real-world environments using 50 code fragments and seven LLM combinations. Ultimately, we provide practical guidance on balancing regulatory compliance and optimization performance.