Upstream flow conditions have a large impact on mixing in shear layers. Optimizing these flow conditions can significantly improve mixing effectiveness. We focus on the evolution of a mixing layer in a temporal framework using direct numerical simulations, and optimize the initial disturbances on the layer such that maximal mixing is achieved after a selected simulation time horizon. A gradient-based optimization strategy is used, which employs
adjoint-based gradient calculations formulated in a continuous framework. This allows us to limit disk-storage needed for the adjoint simulation. We further concentrate on algorithms which impose the necessary energy and continuity constraints on the initial perturbations. For the continuity constraints, parameter elimination is used. For the energy constraint two methods are compared: the gradient projection and the augmented Lagrangian. Optimization with the gradient projection method is shown to be the more robust methodology. We found that the augmented Lagrangian method is very sensitive to small gradient inconsistencies which originate from the adjoint-based gradient calculation. Finally, optimization results are presented for two different time windows T=20 and 40, using five different cost functionals. These are based on momentum thickness, turbulent kinetic energy, mean-flow kinetic energy, total kinetic energy, and enstrophy. It is found that the first three cost functionals lead to large-scale mixing with two-dimensional vortex structures and virtually no diffusion, while the last two promote small-scale structures in the flow.