  Optimal control theory is a powerful tool for improving figures of merit in
quantum information tasks. Finding the solution to any optimal control problem
via numerical optimization depends crucially on the choice of the optimization
functional. Here, we derive a functional that targets the full set of two-qubit
perfect entanglers, gates capable of creating a maximally-entangled state out
of some initial product state. The functional depends on easily-computable
local invariants and uniquely determines when a gate evolves into a perfect
entangler. Optimization with our functional is most useful if the two-qubit
dynamics allows for the implementation of more than one perfect entangler. We
discuss the reachable set of perfect entanglers for a generic Hamiltonian that
corresponds to several quantum information platforms of current interest.
