The second edition of the Master's Degree in Smart Energy is taken place at the UPC School. In this master students are provided with a transversal knowledge about the tools that allow optimizing the operation of smart electric networks, managing users and favoring the integration of distributed energy resources. In addition, this program allows to know the operation of electricity markets and the regulatory framework at both the state and European level. I participate in this master teaching a 14 hours course on "Optimization tool for energy syustems", where both the theoretical, algorithmical and computational foundations of mathematical optimization are introduced and used to analyze some of the most important problems for the optimal operation and design of energy systems.