## 4 BILSTM-Transformer Based Bems Model
### Microgrid Optimization Method Based on Cognitive Control
#### 4.5.3 Quantification of Information Gap  
In the cognitive control model, CPS serves as the core support system for quantifying information gaps. Through its distributed sensors and communication network, CPS not only collects information in real time but also ensures the reliability of data transmission, enabling the system to accurately assess data uncertainties caused by communication instability. The information gap quantification function utilizes CPS-transmitted data to measure the uncertainties the system faces in decision-making and scheduling. When information gaps are large, CPS collaborates with the cognitive control system to minimize these gaps through Q-learning or behavior adjustment mechanisms, thereby enhancing the system's adaptability in complex environments. The Function (21) for quantifying the information gap is as follows:  
\[\Delta I(t)=I_{\text{expected}}(t)-I_{\text{received}}(t) \tag{21}\]  
where \(I_{\text{expected}}(t)\) represents the complete information that the system expects to receive at time step \(t\), and \(I_{\text{received}}(t)\) represents the data information that the system actually receives. In offline training, Equation (21) is used to quantify the information uncertainty caused by incomplete data transmission. When the information gap \(\Delta I(t)\) is large, the cognitive control system will minimize the gap through \(Q\) learning or behavior adjustment mechanisms on the UCC and MCC sides to ensure the accuracy of scheduling decisions and the stability of BEMS. The program implementation of the \(Q\) learning algorithm is shown in Algorithm 3. ```
Initialize Q-values Q(s, a) for all states and actions  for each time step t do  Observe current state s_t  Choose action a_t based on exploration-exploitation trade-off  Execute action a_t and receive reward r_t  Update information gap \(\Delta\)I(t) = I_expected(t) - I_received(t)  Update Q-value:  Q(s_t, a_t) = Q(s_t, a_t) + \(\alpha\)* [r_t + \(\gamma\)* max_a Q(s_[t+1], a) - Q(s_t, a_t)]  if information gap persists then  Use estimated values and Q-learning to adjust strategy  end if end for
```  
**Algorithm 3** Quantification of information gap and optimization strategy of Q learning  
As the core learning mechanism of cognitive control model, the \(Q\) learning algorithm is used to optimize scheduling decisions under uncertainty. \(Q\) learning updates the \(Q\) value iteratively, gradually learns and finds the optimal scheduling strategy, and the update Function (22) of \(Q\) learning is as follows:\[Q(s_{t},a_{t})=Q(s_{t},a_{t})+\alpha[r_{t}+\gamma\text{max}Q(s_{t+1},a)-Q(s_{t},a_{ t})] \tag{22}\]  
Among them, \(s_{t}\) is the current system state, \(a_{t}\) is the action taken in that state, \(r_{t}\) is the immediate return, which reflects the effect of the current action, \(\alpha\) is the learning rate, which determines the update speed of the \(Q\) value, and \(\gamma\) is the discount factor, which controls the trade-off between immediate return and long-term return. In offline training, the \(Q\) learning algorithm dynamically adjusts the \(Q\) value at each time step based on the actions taken by the current state \(s_{t}\), and the immediate return \(r_{t}\). When data are lost or information uncertainty increases, \(Q\) learns to evaluate the current and long-term returns by estimating future returns and gradually optimizes the scheduling strategy. Through the feedback mechanism of \(Q\) learning, the cognitive control model can find the best balance between long-term benefits and immediate returns and ultimately reduce the negative impact of information gap on BEMS scheduling. It is worth noting that in order to consider the impact of both energy cost and information gap, the cognitive control model introduces a joint-cost function. By striking a balance between energy management and information uncertainty, this function helps BEMS optimize energy use while minimizing the cost caused by information loss.