# A Novel Opportunistic Network Routing Method on Campus Based on the Improved Markov Model
## 4 Routing Algorithms Based on Node Path Prediction and Cache Management
### Markov Path Prediction and Cache Management  
The probability that any node \(N_{a}\) will arrive at any place \(v\) at any time \(t\) can be calculated using the approach described above. A destination set \(\mathrm{V}=\{\mathrm{v}_{1},\mathrm{v}_{2},\mathrm{v}_{3},\ldots,\mathrm{v}_{n}\}\) is created based on the places that students frequently visit.  
To accurately model the movement characteristics of learner nodes, several representative locations on campus are selected, including dormitory, classroom, canteen, playground, supermarket and library. The node arrives at a region and stays there for a random period and then chooses the next region, assuming that transferring between regions is not time consuming. Two main parameters affect the nodes' mobile behavior, mobile trajectory offset probability \(p_{offset}\) and dwell time \(w_{time}\), indicating that the nodes move to the pre-set location with a probability of \(p_{offset}\) and to any location with a probability of \(1-p_{offset}\). To reflect the predictability of students' movement behavior, \(p_{offset}\) is set to 0.8, where \(w_{time}\in[1h,2h]\).  
This study suggests a Modified Markov Path Prediction and Cache Management Routing (MPCM) based on the classification of destinations mentioned above. The learner nodes are grouped to reflect the collaboration between the nodes and to minimize resource waste by forecasting the learner nodes' trajectories and forwarding the messages. The nodes in this experiment are split into five groups, and each group chooses one of five possible destinations. Once at the destination, the nodes travel arbitrarily within the range of the destination. The pseudo code for the node forwarding process is shown in Algorithm 1.  
Figure 2: Delivered Message Collection.  
If the free cache space of a node is insufficient to keep the message received this time when two nodes meet in the opportunity network, the utility value \(U^{m}\) of the message in the cache of node \(N_{b}\) is calculated and the message with the lowest utility value is deleted until the message m can be put. If the free cache space of node \(N_{b}\) is large enough to accommodate this received message: If node \(N_{a}\) carries message m and node \(N_{b}\) does not, the message is forwarded to node \(N_{b}\) if it is the intended recipient. Otherwise, node \(N_{a}\) checks to see if it has already transmitted this message to node \(N_{b}\), if it has, the message cannot be transmitted.  
This message will be forwarded only within the group if nodes \(N_{a}\) and \(D_{m}\) are members of the same group. The message is forwarded if nodes \(N_{b}\) and \(D_{m}\) are in the same group and centrality of \(N_{b}\) is greater than \(N_{a}\), otherwise, it is not forwarded. Conversely, if \(N_{a}\), \(N_{b}\) and \(D_{m}\) are not in the same group, and the probability of meeting between \(N_{b}\) and \(D_{m}\) is not less than \(N_{a}\), the message is forwarded, otherwise it is not forwarded. Additionally, the message is forwarded if nodes \(N_{a}\) and \(D_{m}\) are not in the same group but nodes \(N_{b}\) and \(D_{m}\) are.