CASSCF optimization problem for a group of excited states