A data structure for efficiently managing a set of energy functions