Monotonically convergent algorithms of optimal control in NMR pulse sequence design, with application also in dynamic nuclear polarization