## 1 Introduction
### Background and Related Works
#### 1.1.3 Context-Aware and Energy Saving Related Studies  
In Reference [55], important features about ambient intelligent computing including embedding, personalized, adaptive, anticipatory are stated. Key factors in a smart learning environment, such as context awareness, natural user interaction, seamless learning across contexts, collaborative learning, are also stated. Technology factors such as GPS, location sensor, and RFID applications are also described in Reference [55]. In Reference [56], a framework is proposed for smart city applications. Three layers, including and IoT layer, a Fog layer, and a Cloud layer, are defined in the proposed framework. IoT related applications are categorized into three types, which are IoT based application, IoT and smartphone-based application, and smartphone as IoT based application. The proposed framework uses three steps, including data collection, data preprocessing, and data processing and analytics to manage the collected data. Two smart classroom related applications are implemented based on Arduino [57]. As a summary, context awareness is an important factor for a classroom to be \"Smart.\" Therefore, some factors related to context awareness will be included in the proposed architecture. In Reference [58], many energy operation models related to smart city are reviewed and classified into five intervention areas: generation, storage, infrastructure, facilities, and transport. The authors state that optimized operation and management can save 20% to 30% energy consumption of a building without changing the structure or hardware configuration of the system. The authors also state that a building must be an active participant in the power system, instead of being a passive and unresponsive energy consumer, to achieve the desired energy objectives. In Reference [59], a hierarchical decision-making strategy for the energy management of a smart city was proposed to identify an optimal set of action plans for urban areas. The result shows that the proposed strategy in Reference [59] can improve city energy performances, by the given budget constraint, and deal with complex problems including conflicting objectives and requirements, fragmented decision making, and subsystem cross optimization. Some studies, such as References [60; 61; 62] are focused on addressing issues related to district-level energy systems. In Reference [60], a multicommodity energy management system was proposed to address flexibility and scalability issues with decentralized resource allocation and load scheduling methods. The simulation result shows that the decentralized algorithm in Reference [60] had similar performances compared to the centralized approach so improvements in the usage of locally generated energy can be achieved. In Reference [61], a decentralized resource allocation approach for sharing renewable energy among interconnected smart homes is proposed. The simulation result shows that the proposed approach exploits the potential of renewable energy source sharing. Therefore, the cost of individual user energy consumption can be reduced. In Reference [62], an energy management was proposed to aggregate energy prosumers in an energy district which has demand response availability. The simulation result shows that the proposed scheme can reduce the reverse energy flow at night and reduce peak power in daytime hours in energy districts. Some studies, such as [63; 64; 65] were focused on developing methods to optimize energy management in building or home level. In Referece [63], a distributed optimization algorithm for scheduling the energy activities in a microgrid was proposed. The users in the microgrid have individually controllable loads, a common energy storage system, and a shared renewable energy source. The result shows that, with the proposed algorithm, energy consumption costs can be reduced by sharing energy storage. In Reference [64], an energy management platform for intelligent buildings was developed.