Theoretical studying spectrum of the excited states for the ytterbium atom is carried out within the relativistic many-body perturbation theory with ab initio zeroth approximation and generalized relativistic energy approach. The zeroth approximation of the relativistic perturbation theory is provided by the optimized Dirac-Kohn-Sham ones. Optimization has been fulfilled by means of introduction of the parameter to the Kohn-Sham exchange potentials and further minimization of the gauge-non-invariant contributions into radiation width of atomic levels with using relativistic orbital set, generated by the corresponding zeroth approximation Hamiltonian. The obtained theoretical data on energies E and widths W of the ytterbium excited states are compared with alternative theoretical results (the Dirac-Fock, relativistic Hartree-Fock, perturbation theories) and available experimental data. Analysis shows that the theoretical and experimental values of energies are in good agreement with each other, however, the values of widths differ significantly. In our opinion, this fact is explained by insufficiently accurate estimates of the radial integrals, the use of unoptimized bases, and some other approximations of the calculation.