## 1 Introduction
On the left side of Figure 1, we present a flowchart of the proposed mechanism for predicting these encounters using the random forest encounter prediction model (RFEPM). The flowchart elucidates the overall operation of the RFEPM in encounter prediction. We also propose employing supervised learning techniques, including the random forest regressor (RFR) and Gaussian process modeling, to predict future encounters based on historical patterns of individual nodes. We measured the predicted encounters at various locations using the Gaussian and RFR methods. These tests contrasted the precision of predicted encounters in similar locations in different weeks of the month. The highest accuracy achieved by the RFR was for location 5 (library), with an accuracy exceeding 85%. A Gaussian process is defined by a mean function and a covariance function (or the kernel), while the random forest is a supervised learning algorithm that randomly creates and combines multiple decision trees into one forest. In this research, we propose a generalized method of predicting future encounters using the RFR and compare it with the Gaussian process probabilistic classifier. We utilized data traces from the University of Southern California (USC) for our experiments. The traces are actual measurements taken from the USC campus, containing information about Wi-Fi associations and users' profiles. The data encompass six different buildings on the campus and access points and includes information from both weekdays and weekends. It is crucial to design a policy for Opp-Nets that dictates how a node will move a message through the network to meet latency constraints as much as possible [13]. Predicting a device's potential encounters is essential for implementing a successful opportunistic routing algorithm [14]. This paper proposes employing the random forest and Gaussian models for mobility prediction and utilizes the predicted outcomes in the energy consumption model to save energy in smart buildings. The simulation's results demonstrate that the proposed RFEPM learns occupant mobility behavioral patterns related to energy consumption within the building. The main objectives of the RFEPM and Gaussian model (GM) are to reproduce  
Figure 1: Internet infrastructure for the mobility scenario of the university campus. mobility encounters accurately, forecast the energy usage of buildings, and detect possible carbon loss zones. The main contributions of the paper are as follows:  
* We incorporate the RFR to predict human mobility encounters to optimize the resource allocation and energy-saving mechanism based on human mobility prediction. Additionally, we also incorporate the Gaussian model to predict the human mobility encounter as a benchmark scheme to compare the performance of both the RFR and the Gaussian model. * We also highlight the advantage of energy consumption using device-to-device (D2D) communication in contrast to the utilization of energy consumption. * By extensive simulations, we provide a comprehensive comparison of the proposed scheme with the existing schemes, which clearly illustrates that the proposed scheme outperforms the existing schemes. The remainder of this paper is as follows: In Section 2, we present the literature review. Section 3 outlines the methodology, including the RFR, proposed RFEPM, the Gaussian model, the scenario for the RFR encounter prediction, and the energy consumption model for the sustainable energy approach. Section 4 describes the evaluation of the RFEPM, providing results for encounters of different users through the Gaussian model and encounter prediction results. This section also includes a comparison of the accuracy between the Gaussian model and RFR. Section 5 provides a comparison of the results and a discussion. Finally, Section 6 concludes the discussion and presents future work.