Optimal control of quantum systems