  The control of flying qubits carried by itinerant photons is ubiquitous in
quantum communication networks. In addition to their logical states, the shape
of flying qubits must also be tailored to match the remote receiver. In this
paper, we introduce the quantum optimal control theory to the design of
flying-qubit shaping protocols. A gradient-based algorithm is proposed for the
generation of arbitrary-shape flying qubits with general non-ideal emitters.
Simulations show that, as a joint control with the traditionally used tunable
coupler, coherent driving fields can be applied to the shaping when the
coupling strength is fixed or limited. The optimized control protocols can
effectively suppress unwanted level leakage and multi-photon radiation. The
method provides a systematic approach to high-fidelity control of flying qubits
using realistic quantum devices.
