Quantum Optimal Control Theory of High Harmonic Generation