Optimal switching for systems governed by nonlinear evolution equations