The costs of solar and wind energy have decreased dramatically in the last decade, making a cheap, sustainable future energy system more plausible than ever. However there remains deep uncertainty over whether and how far these trends will continue, making it difficult for investors and governments to decide how to allocate funding among promising energy technologies. Should we invest heavily in nuclear energy technologies, solar photovoltaics or lithium-ion batteries? Or an equal amount in each perhaps? Using historical technological progress rates and volatilities for various energy technologies, we show how to construct portfolios of technologies capable of meeting the (exogenous) global energy demand, then analyse them with a standard mean-variance objective function. This allows us to trade off the expected gains resulting from lower technology costs against the level of certainty with which these gains will be attained, and hence compare possible future energy scenarios. The resulting portfolio optimisation problem is far too big to solve fully and is highly non-convex, with many local optima, so we can only explore regions of the solution space via sensible guesswork. The current model includes all the main current electricity generation technologies, plus energy storage, over time scales from around 10 to 100 years. We assume a stochastic first-difference Wright’s law model for technological progress, which is simple, intuitive, and consistent with historical data. Results point to very high renewable energy scenarios being far cheaper than is widely assumed.