On the optimal timing of switching from non-renewable to renewable resources: dirty vs clean energy sources and the relative efficiency of generators