DOI: 10.1002/ese3.568
Grammatical Swarm is a search and optimization algorithm that belongs to the more general Grammatical Evolution family, which works with a set of solutions called individuals or particles. It uses the Particle Swarm Optimization algorithm as the search engine in the evolution of solutions. In this paper, we present a Grammatical Swarm algorithm for total energy demand estimation in a country from macroeconomic variables. Each particle in the Grammatical Swarm encodes a different model for energy demand estimation, which will be decoded by a predefined grammar. The parameters of the model are also optimized by the proposed algorithm, in such a way that the model is adjusted to a training set of real energy demand data, selecting the more appropriate variables to appear in the model. We analyze the performance of the Grammatical Swarm evolution in two real problems of one‐year ahead energy demand estimation in Spain and France. The proposal is compared with previous approaches with competitive results.