# A Combinational Buffer Management Scheme in Mobile Opportunistic Network
## 3 Buffer Management
### Evaluation Method  
Algorithm 1 presents the steps performed by CBM strategy. It starts whenever any two nodes contact. The node can be a sender or a receiver and it exchanges message information during contact (as line 2). We first determine whether the node buffer overflows before two nodes send messages to each other. If the node \(A\) has enough available buffers \(A_{a}\), we calculate the utility value of the new coming message \(i\) and insert it into the node buffer queue (as lines 4-5). Otherwise, we calculate the utility value of the node \(A\) and compare it with the newly arrived message \(i\) utility value (as lines 6-7). We give up the transfer when the utility value of the message \(i\) is less than the utility value of the node \(A\) (as lines 8-9). However, when the utility value of the message \(i\) is bigger than the utility value of the node \(A\), we forward the message with the lowest utility value in node \(A\) to the neighbor node based on the migration policy to ensure that message \(A\) has enough buffer space to receive message \(i\), where \(q\) is the message with the lowest utility value in node \(A\), thereby increasing the utility value of node \(A\) (as lines 10-11). We select one node from neighbors as an object to be migrated. Then, according to Equation (4) [25], where \(A_{v(C)}\) is the ratio of available capacity of node \(C\), we determine whether the ratio of available capacity of node \(C\) to its buffer storage capacity \(\mu_{(C)}\) is more than \(\mu_{0}\) (in experiments, we set \(\mu_{0}=0.3\)). Meanwhile, we calculate the utility value of the neighbor node (as lines 12-14). Here, we specify the value of \(\mu_{0}\) to ensure that the buffer of the neighbor node does not become congested after receiving the migration message. If the utility value of the message \(q\) is bigger than the utility value of the node \(C\) and the \(\mu_{(C)}\) is less than \(\mu_{0}\), we forward the message to the neighbor node and insert it into the buffer queue (as lines 15-17). Otherwise, we give up the transfer of the message (as lines 18-19). When all neighbor nodes do not satisfy the migration condition, we directly delete the message with the minimum utility value in the buffer of the node \(A\) until the available buffer space can accommodate the message \(i\) (as line 21). The above is the whole process of CBM policies for the message transfer and the message migration. \[\mu_{(C)}=\left\{ \begin{array}{ccc}A_{v(C)}\div S,&if&s_{i}<A_{v(C)},\\ \infty&,&if&s_{i}\geq A_{v(C)}.\end{array} \right. \tag{4}\]  
When the node is close to overflow, the migration method is also applicable to transfer part of messages in the node to the neighbor with a relatively sufficient available buffer to ensure that it has the cache space to save other messages at the next contact. It is worth noting that the neighbor node as the migrated object has adequate available buffer. If we do not consider the existing space of the neighbor node and directly transfer the message to the neighbor node, it is not possible to determine whether the neighbor node has enough buffers to receive the message. Meanwhile, it may lead to the buffer of the neighbor node overflowing in the subsequent moment, which not only leads to reduce message delivery ratio and unreasonable buffer utilization, but also wastes a lot of network resources.