Optimized perturbation theory in quantum electrodynamics