1. A system for electricity and heat load balancing within a community of energy nodes, the system comprising: a central controller configured to solve an optimization problem over a planning horizon and to run an allocation algorithm; and a plurality of local agents configured to communicate with the central controller, each of the local agents being associated with and configured to receive input variables or parameters from a respective one of the energy nodes, each of the energy nodes having electricity generation equipment, electrical heat-generating equipment, power transmission equipment, electricity storage equipment and thermal storage equipment, at least one of the local agents being configured to operate the respective electrical heat-generating equipment based on an allocation instruction received from the central controller, wherein the central controller is configured to receive status information from each of the local agents and to use the status information, including state of charge information for each of the electrical and thermal storage equipment of the energy nodes, in the allocation algorithm to determine an amount of energy to be converted from electricity to heat by the respective electrical heat-generating equipment of at least one of the energy nodes, so as to provide the allocation instruction to the at least one of the energy nodes and cause the at least one of the energy nodes to convert the amount of energy from electricity to heat and store the heat in the thermal storage equipment of the at least one of the energy nodes.