Optimal control of hybrid qubits: Implementing the quantum permutation algorithm