  Pulses to steer the time evolution of quantum systems can be designed with
optimal control theory. In most cases it is the coherent processes that can be
controlled and one optimizes the time evolution towards a target unitary
process, sometimes also in the presence of non-controllable incoherent
processes. Here we show how to extend the GRAPE algorithm in the case where the
incoherent processes are controllable and the target time evolution is a
non-unitary quantum channel. We perform a gradient search on a fidelity measure
based on Choi matrices. We illustrate our algorithm by optimizing a phase qubit
measurement pulse. We show how this technique can lead to large measurement
contrast close to 99%. We also show, within the validity of our model, that
this algorithm can produce short 1.4 ns pulses with 98.2% contrast.
