Nowadays identifying techniques aimed at a rational use of electric power has become even more important than the production of energy itself. This is caused by different factors, as the progressive saturation of the electricity grid, which is increasingly subject to connection requests, mainly due to the development of plants which exploit renewable energy sources. This work suggests a new approach based on the combination of the optimizer and the simulator developed in the MATLAB/Simulink environment, in order to reduce the energy costs in buildings during the summer while taking into consideration the user comfort. The electrical consumption of the entire building is taken into consideration is here examined with the aim of applying an air-conditioning system. The goal is to find, the day before, which is the optimal hourly scheduling of the control variables that must be applied the next day, taking into consideration all external conditions; weather conditions and the hourly energy price. In order to achieve this objective, the control variables, that have been changed, are the room temperature set points and the flow water temperature set point. As required by the UNI EN ISO 7730:2006 standard, comfort measurement is calculated by PPD (Predicted Percentage of Dissatisfied) index. Different scenarios are investigated and two optimization algorithms are compared. The results show that there is an average of 10−28% potential cost saving, while maintaining a high level of comfort (PPD ≤ 12). The study is carried out by simulating a real office building in Italy, and the comparisons are shown regarding the actual settings applied to it.