Energy Transition and Optimal Diversification