  We study the effects of imperfections on the fidelity of the Toffoli gate
recently realized in a circuit~QED setup using quantum control methods. The
noise is introduced in the interqubits interactions. The coupling constants are
no longer fixed; instead, they fluctuate around average values obeying some
given probability density functions characterizing the dynamical-imperfection
case. We also consider the static-imperfection case in which the values of the
coupling constants are not exactly known. We obtain a more robust gate by
modifying the quantum optimization problem using a weighted average of the
fidelity over an interval of coupling values as the objective functional.
