#### Abstract

Traditional residential lighting systems have the problem of high energy consumption. Based on artificial neural network (ANN), combined with particle swarm optimization algorithm, and genetic algorithm to optimize the initial weights and thresholds, an improved ANN prediction model for residential energy-saving lighting is proposed, and an actual residential lighting project is taken as an example to verify it. The results show that the proposed method can quickly predict the number of residential lighting lamps under the premise of meeting the standard illumination of residential lighting. The prediction accuracy can reach 98.45%, which has the characteristics of high prediction accuracy and small error. Compared with the ANN model and ANFIS model, the average relative error of the proposed prediction model is reduced by 2.29% and 0.87%, respectively, which has certain effectiveness and superiority. It provides a new idea for residential energy-saving lighting.

#### 1. Introduction

In line with the concept of scientific and sustainable development, people’s awareness of energy conservation and environmental protection has gradually been raised, which is manifested in water conservation, energy conservation, and emission reduction. Moreover, residential buildings are the essential material form of human beings, and their energy conservation and environment protection can save social resources to a large extent, which has important significance for the environment protection and pollution abatement. Energy-saving and environmental protection of residential buildings can be realized in various ways. For example, N. Thejo Kalyani et al studied different organic materials synthesized by organic light-emitting diodes. A new organic light-emitting diode (OLED) is prepared, and energy-saving lighting is realized [1]. Sadeghian Omid et al analyzed the potential of different energy-saving schemes and their environmental impact, discussed the use of renewable energy and energy-saving lamps and other direct energy-saving schemes, and realized the energy-saving and emission reduction by using alternating energy storage system control strategies and technologies [2]. Under different climate conditions, Maučec Damjan et al. carried out sensitivity analysis on different input parameters where global sensitivity analysis technology based on elementary effect is adopted. The main design parameters affecting energy saving are determined, and the energy saving of timber structure building is realized by adjusting these parameters [3]. Grobe Oliver Lars innovated the windowing irregular reflection and transmission, and thus, the solar radiation is redirected, selectively admitted, or blocked. Also, the modeling technology of optical complex fenestration is proposed. Finally, the design of energy-saving green buildings is realized [4]. In the environment of the oil crisis and global warming caused by emissions of greenhouse gases, Vasiliu A et al. took Romania residence as the research object and adopted a cross-dialectical analysis method to analyze passive energy-saving buildings, such as low energy consumption, green house, and net zero-energy buildings. Thus, they thought that residential building designed according to Nzeb standard can meet the low energy consumption residential minimum requirements [5]. Rijal Hom B et al collected 19,081 pieces of thermal comfort data from 94 households in 69 apartments in Japan, connected indoor comfort temperature with outdoor temperature, quantified changes in the thermal environmental comfort temperature of Japanese residential buildings with seasons, and established a domestic adaptability model of Japanese high-insulation residential buildings. Adaptive thermal comfort energy-saving building is designed [6]. Based on data mining techniques, Himmetoğlu Salih et al. proposed a multifactor PSACONN analysis framework to study the influence of climate and building enclosure structure on building heat (heat and cold) energy consumption at the design stage. It is found that the estimation accuracy of this framework reaches 99% and 98%, respectively, which can effectively find the envelope combination that provides the minimum energy consumption for different climate regions and realize the residential energy saving [7]. Wu Weidong et al. reconstructed the reference building envelope and renewable energy system with zero-energy consumption, constructed the control function, and optimized the solution to obtain the optimal reconstruction scheme, which provides guidance for the reconstruction of zero-energy residential buildings [8]. Among them, under the premise of ensuring the standard lighting intensity, using limited resources to create a good lighting environment and realize energy saving is the most common way at present. However, as the characteristics of three-dimensional spatial distribution and dynamic time change of residential lighting, there are many nonlinear relationship problems in residential lighting, which is a great challenge to the design of residential energy-saving lighting.

#### 2. Basic Methods

##### 2.1. ANN Networks

ANN network is a complex network system that simulates human brain behavior and consists of a large number of neurons. It has intelligent processing functions such as learning and computing. There are many ANN network models, including the Hopfield model and BP model. For the convenience of explanation, the BP network model is used to illustrate where the input and output of BP network model can be expressed by activation function or transfer function, and neurons at each layer have a certain threshold and internal state [9]. In the BP model, there are three layers: input layer, hidden layer, and output layer. Furthermore, each layer of neurons only receives the neurons’ output of the previous layer, and output information is generated through the weight of each layer and changes of each neuron, which are shown in Figure 1.

As can be seen from the figure, input *X*_{j} and output *O*_{j} of the neuron at layer *j* can be expressed aswhere *W*_{ji} is the weight of layer *j* and layer *i*; *f* is the activation function, usually an S-type function.where is the slope of the activation function; is the neuron threshold.

For *k* samples, BP network training output error iswhere *t*_{k} and *O*_{k} are the target output and real output of *k*.

The total error function is

In the whole BP network training, the adjustment rule of weight is as follows [10]:where is the learning rate. By substituting the above formula into (4), the adjustment rules of weight can be obtained.

Node of hidden layer and node of output layer can be expressed as

In practical application, the momentum factor is usually introduced to adjust weight, so (6) and (7) can be rewritten aswhere *a* is the momentum factor, and its value range is (0,1).

The threshold values of the hidden layer and output layer can be used as the expansion of neuron input of this layer, and its adjustment rules can be expressed as

BP network has powerful computing capacity and can process more data quickly, but it also has certain limitations. For initial weight and threshold assignment, the different assignment has a certain influence on the performance of the network. In order to avoid this problem, this paper combines the highly complementary searching ability to conduct search optimization on the optimal assignment of initial weights and thresholds, so as to improve the prediction accuracy of the ANN network [11].

##### 2.2. Improvement of ANN Algorithm

The specific operation process of adopting PSO and GA to optimize the initial weights and thresholds of the ANN network is as follows:(1)Combine initial weights and thresholds of the ANN network according to the binary real-number coding method. The parameters to be optimized in each coding group represent genes, and each coding group is an individual. In reverse solution, binary numbers can be converted into decimal numbers through (11) [12]. where is the *i* section with *l* length, and = 0 or = 1. *T*_{i} and *R*_{i} are the endpoints of the definition domain *i*. The population containing *S* individuals is denoted as *M*, and the genome of individual *u* is , which are denoted as where is the total number of weights and thresholds.(2)The purpose of ANN network training is to make the predicted value *y* approximate the real value *b*, so the fitness function can be determined as [13](3)Calculate individual fitness values and population fitness values of PSO and GA initial populations, respectively, and select the optimal value as the optimal value group to form the initial parent population. Where the update formulas for the position and speed of PSO are where represents inertia weight; and are particle accelerations; and are random vectors; represents the local optimal value of the current particle; represents the global optimal value.(4)For the initial parent population, the PSO algorithm and GA algorithm are adopted to update the population, respectively, which means that the PSO algorithm updates the population by updating individual speed and position space [14]. GA algorithm realizes population renewal through selection, mutation, and crossover operation [15].(5)When the PSO algorithm and GA algorithm meet the termination conditions, the best individual is selected and input it into the ANN network for training;(6)Calculate the network error, and stop the iteration when the termination condition is met.

The process can be illustrated in Figure 2.

##### 2.3. Prediction Model Construction of Residential Energy-Saving Lighting Based on Improved ANN

According to the residential energy-saving lighting requirements, the specific design of the PSO algorithm and GA algorithm optimizing and improving the ANN network model is as follows.

###### 2.3.1. Network Layers

The theory proves that a three-layer neural network structure can achieve any nonlinear mapping [16]. Therefore, this paper sets the residential energy-saving lighting prediction ANN network as a three-layer network model that includes an input layer, hidden layer, and output layer.

###### 2.3.2. Neurons of Input Layer

The function of the input layer is to receive the input model data and transmit it to the hidden layer. According to the residential energy-saving lighting requirements, it can be seen that the efficiency of lamps, luminous flux of light source, average reflectance ratio of wall surfaces, the installation height of lamps, working area, maintenance coefficient of lamps, effective floor reflectance, and effective ceiling reflectance have a significant impact on residential energy-saving lighting [17–21]. Therefore, the above 8 types of data are selected as input data, and the number of neurons in the input layer is 8.

###### 2.3.3. Neurons of Output Layer

The prediction of residential energy-saving lighting is mainly to determine the number of lamps and illumination value, so the number of neurons in the output layer can be determined as 2.

###### 2.3.4. Neurons of Hidden Layer

For a three-layer ANN network, the number of neurons *X* in the hidden layer is generally determined by the following equation [21]:where *m* and *n* are the number of nodes in the input layer and output layer, respectively; a is a constant between 0 and 10. Combined with PSO and GA algorithm to optimize ANN parameters, the number of neurons in the hidden layer is 15.

Based on the above analysis, the structure of the improved ANN network is shown in Figure 3.

Therefore, according to the actual situation of residential lighting, the realization process of residential energy-saving lighting prediction is shown in Figure 4. Firstly, the model sample data are determined, and the samples after preprocessing are divided into the training set, testing set, and cross-validation set according to a certain proportion. Moreover, the initial weights and thresholds of the network are optimized. Thus, the network structure and related model parameters are determined, and the optimal ANN network model is obtained. Finally, the number of lamps and illumination of residential energy-saving lighting are predicted through the optimal ANN network model.

#### 3. Simulation Experiment

##### 3.1. Experimental Environment

In this experiment, the improved PSO prediction model is constructed on MATLAB2014 software. The operating system is Windows7, and the CPU is Intel(R) Core(TM) i7-7770hq 2.8 GHz. Moreover, the memory is 8G.

##### 3.2. Data Sources and Preprocessing

Data in this experiment are the lighting-related data of dozens of residential buildings of different sizes from May to December 2020 in Xi’an, Shaanxi, including 100 sets of data, such as indoor area, isometric efficiency, and the number of lamps [22, 23].

Considering that the dimensions of sample data are different and the span of data is large, it is easy to cause difficulties in subsequent model analysis. To solve this problem, deviation standardization is adopted to normalize sample data in the experiment, as shown in the following equation [24]:where A is the data whose value range is [0,1]; *A*_{0} is the original data value; Amax and Amin are the maximum and minimum values of *A*_{0}.

There are 70 groups of samples randomly selected from the experimental samples as the training set, 15 groups of samples as the testing set, and 15 groups of sample data as the cross-validation set.

##### 3.3. Evaluation Indicators

In the experiment, average relative error (MAPE) is selected as the indicator to evaluate model performance, and its calculation method is as follows [25]:

##### 3.4. Experimental Results

###### 3.4.1. Model Verification

To verify the effectiveness of the proposed model, the predicted results of the model on the number of lights and illuminance are tested experimentally and compared with the actual values, which are shown in Figure 5 where the predicted value curve of the proposed model for the number of lights and illumination has a good fitting effect with the actual value curve, which almost coincides with each other, indicating that the proposed model has a good prediction accuracy.

**(a)**

**(b)**

Figure 6 shows the error convergence curves on the training set, testing set, and cross-validation sample set before and after the ANN model is improved. It can be seen that when it is iterated for 9 times before improvement, the mean square error of the ANN model is 44.45. When it is iterated for 14 times after improvement, the mean square error is 5.89. Therefore, PSO and GA algorithms can improve the convergence speed of the ANN model.

Figure 7 shows the linear regression diagram of the proposed model before and after improvement. As can be seen that the fitting accuracy of training samples and cross-validation samples before model improvement is *R* = 0.9768, the fitting accuracy of validation samples is *R* = 0.9538, and the overall fitting accuracy is *R* = 0.9845. After model improvement, the fitting accuracy of training samples, cross-validation samples, validation samples, and overall fitting samples is *R* = 0.99999. Therefore, after optimizing the ANN network by PSO and GA algorithms, the prediction accuracy of the model can be improved, and the proposed model has a high prediction accuracy of residential energy-saving lighting.

In conclusion, the improved ANN model has a high prediction accuracy for residential energy-saving lighting, which reaches 98.45%. In addition, the convergence speed of the model is fast. It can predict and calculate the number of lamps and illuminance degree of residences under the design requirements of the residential energy-saving lighting prediction model.

###### 3.4.2. Model Comparison

To further verify the validity of the proposed model, the experiment compares the prediction effect of the proposed model with the common prediction model ANN and fuzzy neural network model (ANFIS) on the experimental data set, and the results are shown in Table 1 where the ANFIS network structure and initial parameters are determined by the fuzzy C-means clustering algorithm. After debugging, the initial number of clusters is set to 2; the target error is set to 0.1; the classification matrix index is set to 10; and the maximum number of iterations is set to 100. At this time, ANFIS has good prediction accuracy. Compared with ANN and ANFIS models, the prediction error of the proposed model is 1.28%, and the average relative error decreases to varying degrees, which means that the proposed model has better performance and is more suitable for solving the residential energy-saving lighting problem.

###### 3.4.3. Example Verification

To verify the prediction effect of the proposed model in the actual residential energy-saving lighting, a senior residence is taken as the research object for verification. Compared with the prediction results of the ANN network and fuzzy neural network before improvement, the results are shown in Table 2. Here, the predicted results of the proposed model, ANN network model, and fuzzy neural network model all meet the standard value of illumination requirements of relevant national specifications. On this basis, the use of lamps in the proposed model is the least (69 lamps), and the value of illumination is closer to the standard value. Therefore, compared with the ANN model and fuzzy neural network model, the proposed model meets the requirements of residential energy-saving lighting and has certain effectiveness and superiority.

###### 3.4.4. Simulation Results of DIALux Modeling

To verify the generalization ability of the proposed model, DIALux lighting software is used for modeling and simulation. DIALux lighting software can provide a variety of parameters for calculation according to the actual residential building requirements and can be compared and analyzed according to the input set value. DIALux lighting software is used to simulate the residential illumination values, and the results are shown in Table 3. Compared with the ANN model and ANFIS model, the average illuminance value of the proposed model is the smallest and closest to the standard illuminance (750lx), which is 765lx. Furthermore, the illuminance uniformity is the largest, which is 0.85. So it indicates that the proposed model can provide a better lighting environment with more uniform illumination and energy saving under the premise of ensuring lighting requirements.

Table 4 shows the comparison of GR values of glare index of different models at 5 observation points. As can be seen from the table, the GR values of the five observation points of the ANN model are all over 30, and there are three observation points that GR values of the ANFIS model are all over 30. The GR values of the five observation points of the proposed model are all within 30 (including 30), which meets the maximum glare index (30) stipulated by the state. Therefore, the proposed model meets the requirements of the national specification.

#### 4. Conclusion

To sum up, the PSO and GA algorithms can optimize the initial weights and thresholds of the ANN network, and then, the proposed residential energy-saving lighting prediction model based on machine vision can improve the model convergence speed and prediction accuracy. The prediction accuracy can reach 99.999%. Compared with the ANN model and ANFIS model, the prediction average relative error of the proposed model is reduced by 2.29% and 0.87%, respectively. Under the premise of meeting the standard illumination of residential energy-saving lighting, the proposed model can use fewer lamps, and it can get closer to the standard illumination value, which has certain effectiveness and superiority. The innovation of this research is to apply artificial intelligence algorithm to energy-saving lighting, which provides a new way and way for scientific optimization of lighting. However, due to the influence of external factors, there are still certain limitations, which are mainly the number of data samples. To meet the requirements, the next step is to expand the collection range of sample data to improve the accuracy of model training and the generalization ability of the model.

#### Data Availability

The experimental data used to support the findings of this study are available from the corresponding author upon request.

#### Conflicts of Interest

The authors declare that they have no conflicts of interest regarding this work.