## 5 Optimization
### Agents  
A smart grid is, by itself, a decentralized network, where intelligence is distributed across several devices. These devices may have to take autonomous decisions, in order to react quickly and efficiently to changes in energy demands, faults, and such events. Thus, the Software Agents paradigm may provide a way to implement a system like that. In fact, in this paradigm, it is possible to design a distributed system with specific functionalities through the cooperation of autonomous, intelligent components. _\"A multi-agent system (MAS) is a system of multiple interacting software agents. A software agent is a self-contained software program that acts as a representative of something or someone (e.g., a device  
Figure 10: The smart grid information flows [40]. Figure 9: Smart grid web application scheme [40]. or a user). A software agent is goal-oriented: it carries out a task, and embodies knowledge for this purpose. For this task, it uses information from and performs actions in its local environment or context. Further, it is able to communicate with other entities (agents, systems, humans) for its tasks\"_[42]. [PERSON] _et al._[43] presented a Multi-Agent System (MAS) simulating a Smart City. The simulated entities were:  
* Houses;
* Appliances (Single devices, of different classes, installed into a house);
* Vehicles (Electric Vehicles able to store energy into batteries);
* Cities;
* Power Stations. The system was implemented using JADE (Java Agents Development Environment). Each entity was represented by a software agent. Then, an energy controller agent is able to act in order to balance power demand and power generation (for example, turning off some devices when power consumption is too high). Authors performed a simulation of their system to demonstrate how it is able to dynamically adjust generation, keeping the difference between generation and consumption within ideally close limits. The proposed scenario involved 300 houses evenly divided into three cities, and a total of 3840 appliances. MAS are often associated to _electronic markets_, computing frameworks for distributed decision making based on microeconomics and Game Theories. By applying this paradigm to the energy distribution networks, we can make use of the already developed techniques and methodologies to realize the so-called _Market-Based Control_. Several works following this idea have been proposed. [PERSON] _et al._[44], for example, presented a complex multi-agent architecture composed of different components: the Problem Formulator and Attributes Evaluator (PROFATE), the Scenarios Builder, the Electricity Market Multi-Agent System (EMMAS), the Decision Making Assistant (DMA) (see Figure 11). Of these components, the most interesting is without any doubt the EMMAS. In order to forecast market prices, both at medium and long-term, accurate simulation models are needed, able to react to structural changes. The EMMAS realizes these models, by means of a complex taxonomy of software agents that represent every actor in the transaction process. Another example of a MAS designed for controlling energy networks is PowerMatcher [42]. _\"The Power Matcher is a general-purpose coordination mechanism for balancing demand and supply in clusters of Distributed Energy Resources. These 'clusters' might be electricity networks with a high share of distributed generation or commercial trading portfolios with high levels of renewable electricity  
Figure 11: Outline of the IDSS structure [44]. sources, to name a few. Within a PowerMatcher cluster, the agents are organized into a logical tree. The leaves of this tree are a number of local device agents and, optionally, a unique objective agent. The root of the tree is formed by the auctioneer agent, a unique agent that handles the price forming, i.e., the search for the equilibrium price. In order to obtain scalability, concentrator agents can be added to the structure as tree nodes\"_[42]. In Figure 12 an overview of a cluster structure is given.