A novel simulation strategy is proposed for searching for semiconductor quantum devices that are optimized with respect to required performances. Based on evolutionary programming, a technique that implements the paradigm of genetic algorithms in more-complex data structures than strings of bits, the proposed algorithm is able to deal with quantum devices with preset nontrivial constraints (e.g., transition energies, geometric requirements). Therefore our approach allows for automatic design, thus avoiding costly by-hand optimizations. We demonstrate the advantages of the proposed algorithm through a relevant and nontrivial application, the optimization of a second-harmonic-generation device working in resonance conditions.