## 2 Methodology
### Problem Formulation  
The proposed framework integrates an LSTM-CNN model for accurate prediction of load demand, energy costs, and carbon emissions with Multi-Objective Particle Swarm Optimization (MOPSO). The LSTM-CNN model employs the Mean Squared Error (MSE) as the lossfunction  
\[\text{MSE}=\frac{1}{n}\sum_{i=1}^{n}(\text{Predicted}_{i}-\text{Actual}_{i}) ^{2}, \tag{1}\]  
where Predicted\({}_{i}\) is the model prediction for the \(i\)th sample, Actual\({}_{i}\) is the corresponding actual value, and \(n\) is the number of samples. These predictions serve as inputs for the MOPSO algorithm to ensure reliable and efficient solutions [15]. This integration provides scalable, adaptive, and robust real-time load optimization [16]. The MOPSO algorithm employs a swarm of \(N=60\) particles, each representing a potential solution. Particle \(i\) is initialized with position vector \(\mathbf{X}_{i}(0)\) and velocity vector \(\mathbf{V}_{i}(0)\). Random initialization is employed to ensure diverse exploration of the solution space, reducing bias and aiding in discovering global optima. The multi-objective function is  
\[f(\mathcal{X})=\alpha\cdot\text{Cost}(\mathcal{X})+\beta\cdot\text{Emissions}( \mathcal{X})-\gamma\cdot\text{Efficiency}(\mathcal{X}), \tag{2}\]  
where  
\[\mathcal{X}=\{P_{\text{grid}}(t),P_{\text{renewable}}(t),P_{\text{ battery}}(t),P_{\text{demand}}(t)\}, \tag{3}\]  
is the vector of decision variables defined as follows. * \(P_{\text{grid}}(t)\) is the power supplied from the grid at time \(t\). * \(P_{\text{renewable}}(t)\) is the power from RESs (solar panels) at time \(t\). * \(P_{\text{battery}}(t)\) is the power discharged from the battery at time \(t\). * \(P_{\text{demand}}(t)\) is the total load demand at time \(t\). The weights \(\alpha=0.3\), \(\beta=0.4\), and \(\gamma=0.3\) reflect the importance of each objective. This function ensures balanced solutions that address the tradeoffs between economic, environmental, and performance goals. While smart inverter functionalities such as Voltage-Ampere Reactive Control (Volt-VAR) control can contribute to grid stability by injecting or absorbing reactive power, they are more suitable for utility-scale applications and commercial microgrids. In residential settings, customers are typically billed for active power (kWh) rather than reactive power (kVARh), and smart inverters are not necessary to provide voltage regulation. Therefore, this paper focuses on optimizing active power to minimize costs, improve efficiency, and reduce emissions. The total operational cost is  
\[\text{Cost}(\mathcal{X})=\sum_{t=1}^{T}P_{\text{demand}}(t)\cdot C_{\text{ electricity}}, \tag{4}\]  
where \(C_{\text{electricity}}\) is the electricity cost per kWh. The carbon emissions are  
\[\text{Emissions}(\mathcal{X})=\sum_{t=1}^{T}P_{\text{demand}}(t)\cdot E_{\text{ factor}}, \tag{5}\]  
where \(E_{\text{factor}}\) is the emission factor in kg CO\({}_{2}\)/kWh. The efficiency is expressed as  
\[\text{Efficiency}(\mathcal{X})=\frac{\text{Useful Load Output}}{\text{Total Load Input}}, \tag{6}\]  
At time \(t\), particles update their velocities and positions according to  
\[\mathbf{V}_{i}(t) =\omega\cdot\mathbf{V}_{i}(t-1)+c_{1}r_{1}(\mathbf{P}_{i}- \mathbf{X}_{i}(t-1))+c_{2}r_{2}(\mathbf{G}-\mathbf{X}_{i}(t-1)), \tag{7}\] \[\mathbf{X}_{i}(t) =\mathbf{X}_{i}(t-1)+\mathbf{V}_{i}(t), \tag{8}\]  
where \(\mathbf{V}_{i}(t)\) is the velocity of particle \(i\), \(\mathbf{X}_{i}(t)\) is the position of particle \(i\), \(\omega\) is the inertia weight balancing exploration and exploitation, \(c_{1},c_{2}\) are acceleration coefficients guiding particles towards their personal best \(\mathbf{P}_{i}\) and the global best \(\mathbf{G}\), and \(r_{1},r_{2}\) are random numbers in the range 0 to 1 to provide stochastic exploration. These updates ensure adaptive exploration to prevent premature convergence and allow the system to respond dynamically to changes. The algorithm terminates when it has converged or the maximum number of iterations (100) is reached.