Optimal preparation of the $W$ state for qubits with XY coupling
Using simulated annealing, we find optimal protocols that evolve a simple product state into a three-qubit $W$ state with a Hamiltonian that describes XY coupling and single-qubit gates, and determine the associated quantum speed limit. Applying Pontryagin's minimum principle, we fully characterize the optimal bang-bang protocols. While leakage affects performance, the protocols remain robust to implementation errors and operate well within relaxation and decoherence times. Our findings highlight Pontryagin's principle as a powerful tool for designing pulse shapes that directly link device interactions to specific quantum gates and target states.