# Computer Mathematical Modeling Based on the Improved Genetic Algorithm and Mobile Computing

Authors: Huixian Wei; Jia Liu
Journal: Wireless Communications and Mobile Computing
 (2021)

---

## Abstract

In order to change the problem of data redundancy in a genetic algorithm, this paper proposes a computer mathematical model based on the combination of an improved genetic algorithm and mobile computing. Combined with the least square method, MATLAB software is used to solve the equations, determine the range of parameters, and solve the estimation parameter range and identification problems. The improved genetic algorithm combined with mobile computing and least square method to establish a mathematical model greatly increased the individual search space and increased the operation rate of 90% compared to the basic genetic algorithm or mobile computing. The results show that the improved genetic algorithm and mobile computing have a certain ability to identify the optimal solution and greatly improve the work efficiency.


---

## Body

## 1. Introduction

For big data, an efficient optimization calculation process is very important. With the rapid update of computer science, various mathematical methods have been widely used in natural science and play a key role in social science. And mathematics technology has also realized the transformation from basic mathematics to an important component of high technology. In mass mathematical analysis methods, mathematical modeling can usually be closely combined with practical problems [1]. Generally speaking, mathematical modeling is not a direct reproduction of practical problems but requires an in-depth study, detailed observation and analysis, and rational use of various mathematical theories and knowledge. In this process, a system model framework should be established first. In most cases, experiments are started through known models [2]. In fact, model solving is to build functional relations based on the known system model framework through mathematical theory and skills and estimate model parameters with system input and output data. The estimation of model parameters is closely related to data, curve fitting, and experimental error analysis, and the key lies in the application of the least square method [3]. In data fitting, the least square method is the most commonly used method, which is the main method of observation data research. It can observe two variables repeatedly and ensure the accuracy of data. A genetic algorithm does not limit the scope of the problem, has strong robustness, and has a variety of compatible general modes. It has been widely used in many fields, such as function optimization, automatic control, production scheduling, and image processing, and the effect is remarkable. Therefore, this paper studies the construction of a computer mathematical model based on the improved genetic algorithm and least square method [4].


## 2. Literature Review

A genetic algorithm (GA), based on genetic theory, simulates a survival mechanism of the fittest and exchanges information randomly, which is more suitable for optimization of complex systems. It originated in the 1960s and is a very practical optimization technology, which can be applied to multidisciplinary research [5]. The genetic algorithm will not limit the field of the problem and has strong robustness. There are many compatible and universal modes. The genetic algorithm has an obvious application effect in the fields of function optimization, combination optimization, automatic control, production scheduling, image processing, artificial life, structure optimization, and so on. In data fitting, the least square method is often used as an important method to study observation data [6]. The least square method can observe two variables for many times, so as to obtain more accurate data. The genetic algorithm simulates the reproduction and evolution of natural biological groups from generation to generation and generates a new generation of better individuals as the solution to the problem through iteration, just as biological groups multiply and evolve from generation to generation and finally converge to a generation of biological individuals most suitable for the living environment [7]. That is the optimal solution of the problem. The genetic algorithm is widely used in engineering optimization and industrial control. Wu et al. used the genetic algorithm to optimize the cantilever structure of a certain machine, which has fast convergence speed and high calculation accuracy, and established a single-objective nonlinear optimization design mathematical model. It provides a powerful method and tool for multiobjective nonlinear structural optimization design. Gong et al. introduced an immune algorithm to improve the genetic algorithm [8]. In solving the complex problem of too many iterations of a population in TSP application, the probability of algorithm degradation was reduced by a vaccine test and annealing selection, and the phenomenon of population degradation was avoided. The sowing quality, sowing efficiency, and energy consumption of the seeder cannot be brought into full play due to the influence of sowing terrain and region [9]. Hua and others put forward a multiobjective speed control genetic algorithm optimization model based on BTO mode, determined the initial parameters of the performance optimization of the seeder under BTO mode, and obviously improved the sowing quality, sowing efficiency, and sowing energy consumption of the seeder [10]. And the operation performance of the seeder is improved. In view of the shortcomings of the basic genetic algorithm, such as slow convergence speed and premature convergence, Lei proposed an improved adaptive genetic algorithm, which automatically adjusted the crossover probability and mutation probability according to the size of the fitness value in the evolution process, so that the algorithm could jump out of the local optimal solution [11]. The simulation experiment of mobile robot path planning shows that. The improved genetic algorithm is effective and feasible and obviously improves the quality of robot path planning. The genetic algorithm is also used to solve the optimization problem of mathematical modeling in the annual college students’ mathematical modeling competition [12]. Liu and others used the genetic algorithm to establish a VRP model for efficient dispatching of public bicycles in large- and medium-sized cities and tested the algorithm with standard examples [13]. The results show that the genetic algorithm can effectively solve the bicycle scheduling model. According to the principle of “seeing the sun immediately” and making a shadow sunshine map, Fu and Li put forward a method of sun shadow location [14]. They first combine the solar altitude angle and the solar declination angle. A multiobjective optimization model for sun shadow location is established with the maximum correlation coefficient between theoretical shadow length and actual shadow length and the minimum sum of error squares as objective functions. The genetic algorithm is used to solve the problem, and the result is superior to the traditional enumeration algorithm in both accuracy and convergence speed [15]. In the annual teaching and guidance of mathematical modeling for college students, how to make college students’ master genetic algorithm quickly in a short period of time is a thorny problem. The genetic algorithm has its own advantages in solving problems. It has been widely used in various researches by many scholars. Through continuous improvement, more advantages of the genetic algorithm have been gradually excavated, and some new theories and research methods about the genetic algorithm have been developed rapidly in constant practice [16]. And some new application fields have emerged, such as the application in machine learning. It has found a solution to the thorny problems left by scholars in artificial intelligence for many years. The crosscombination with some intelligent algorithms such as neural network points out the direction for solving the difficulties in computational intelligence conveniently and quickly. The characteristics of parallel processing carried by the genetic algorithm itself have greatly promoted the research of computer parallel architecture. However, the traditional standard genetic algorithm adopts fixed control parameters, which leads to poor global searching ability and immature convergence [17]. The research results of many researchers show that the traditional standard genetic algorithm cannot guarantee convergence to the global optimal solution. In recent years, the research on the improvement of the genetic algorithm has not stopped, and the optimization ability of the genetic algorithm has been greatly improved both in the direction of improvement and in the content of improvement.The genetic algorithm used in this paper is an advanced modern optimization algorithm, which has strong parallelism and global search ability. Its coding technology and genetic operation are relatively simple, and it has low requirements on the restrictive conditions of optimization problems. At present, various genetic algorithms have been well applied in the fields of machine learning, image processing, pattern recognition, optimization control, combination optimization, management decision-making, etc. The research and popularization of genetic algorithms are of great significance to economic and social development.


## 3. Research Methods

### 3.1. Improved Genetic Algorithm

#### 3.1.1. Operating Principle of the Basic Genetic Algorithm

The genetic algorithm, as a new computing method, is based on the basic principles of genetics, imitates the mutation and crossover mechanism of biological genetic evolution, and makes a global search for specific problems to obtain a basic genetic algorithm (SGA), which is the basis of improving the genetic algorithm.Coding operation is adopted to express the solution space as structural data in genetic information, thus completing genetic operation. According to the precision requirement, the binary symbol is used as the fixed coding string to represent the gene model between individuals. According to the structure of space, its value range is defined, and after coding, it is necessary to generate a number of individuals as the initial population [18]. By calculating the individual fitness evaluation function value, the individual’s pros and cons are calculated. The selection operator needs to judge the fitness of the individual according to the fitness function of the individual, so as to complete the whole operation process. Matching each other according to a certain rule and generating new data individuals, the genetic algorithm is the most important method for crossoperation. For each random mutation point, the gene value is inversely calculated, thus forming a new individual.


#### 3.1.2. Mobile Computing Model

A mobile computing model is the basic framework and principle that the computer system must follow to complete calculation. The mobile computing model is significantly different from the distributed computing model due to special requirements such as device disconnection, communication and computing imbalance, and energy saving caused by mobility. Therefore, support for mobility and weak connectivity should be added. The core problem of the mobile computing model is to determine how the functions of the mobile terminal and server are allocated and how to adjust dynamically according to the needs.The concepts of location and movement determine that the architecture of the mobile computing system is loosely coupled and strongly autonomous. Loose coupling means that a group (application or device) continues to work when it is disconnected or weakly connected to the server. And as long as the connection is available, make the connection. Strong autonomy in mobile computing is determined by the characteristics of mobile computing environment. That is, it must have very little self-tolerance and very strong initiative. Due to loose coupling, strong autonomy and mobility of computing components, mobile computing systems need dynamic configuration. Component movement and management regionalization require mobile computing to fully consider resource access control policies and mechanisms.π-calculus is a method of describing and analyzing concurrent systems and is an extension of CCS. The base entity is the channel name and the process made up of the name. The syntactic definition of the monospora π-calculus process is as follows:
(1)P⋅⋅⋅⋅=∑i∈IαiPiP1P2P1+P2vxPP,α⋅⋅⋅⋅=xyxy,where x,y stands for name and has two forms: the input prefix xy means that the name y is received on channel x and the output prefix xy means that the name y is sent on channel x.


#### 3.1.3. Convergence Verification

Function optimization is a very important part of the genetic algorithm. Given an objective function, it is necessary to find the best quality in the solution space without any constraints. With the Rastrigin function as the test function, the convergence effects of crossover probability and mutation probability are analyzed.


#### 3.1.4. Analysis of the Improvement Scheme

In the process of running the algorithm, crossover and mutation will increase the search range. At the end of the running of the algorithm, it is necessary to control the search within a certain range for the protection of individual position. If the algorithm can find a group point with high average fitness in the initial running stage, the optimal solution can be obtained. In order to keep the best individuals better, it is necessary to accelerate the convergence speed in the iterative process and ensures that the optimal value which is found before the maximum value of average fitness is obtained.


### 3.2. Least Square Method

The least square method has a good effect on the study of observation data. For known variables, it is necessary to satisfy a specific linear relationship and observe the variables for many times, so as to obtain observation data. The basic idea of the least square method is to find the straight line with the shortest distance between multiple groups of observations. If ann contains m unknowns, it is necessary to find the optimal value according to the linear equations. In regression analysis and variance analysis, the least square method is the best theoretical basis, and many mathematical statistics theories are developed on the basis of the least square method. In the least square method, it is known that the observed data x1,y1,x2,y2⋯xn,yn need to satisfy the condition y=gx+εx, where y=gx is a function and εx=y−gx is an error function. εix=yi−gxi is an observation function. This method is called the least square method. The fitting function can be expressed as
(2)y=a1φ1x+a2φ2x+⋯asφsx,where φ1x,φ2x⋯φsx is the basis function and the undetermined function aii=1,2,⋯,s. In order to determine aii=1,2,⋯,s, it is necessary to minimize the sum of squares of observed data distances between Y and N, so that the formula can get the minimum value.


### 3.3. Construction of the Computer Mathematical Model

#### 3.3.1. Ask Questions

(1) Question 1. There is a straight bar with a length of 3.5 m in the square. Based on the square position, the longitude and latitude (θ) can be roughly determined to obtain the sun altitude angle and azimuth angle. The shadow length of the straight rod can be obtained according to the change of parameters, and the correlation between the coordinates of the shadow endpoint and the height of the straight rod is not high. The curve fitting analysis can be carried out by the least square method to solve the corresponding irradiation time of the shadow minimum point and then calculate the longitude. At the same time, solving latitude is constructed based on a nonlinear equation. The longitude and latitude are not unique, which directly increases the difficulty of solving, which can be solved by the improved genetic algorithm to determine the measuring points.(2) Question 2. Based on the improved genetic algorithm, the optimal solution is found, and the relevant parameters are obtained through its discrimination ability. Distinguish the model specifically:
(3)yt=−f1yt−1−⋯−fmyt−1+g1kt−1+⋯+gnkt−1+γt.The least square method is regarded as one of the most commonly used methods to solve and distinguish the parameters.


#### 3.3.2. Building a Model

(1) Question 1. Set the height of the straight rod as u, projecting on the end point of the ground based on the highest point of the straight rod, and the shadow length as OH, and set the included angle between the sun ray and the ground as β; then,
(4)PU=cotβ.Then,△klatitude=12×f−120/180. The specific relationship between the flat sun and the true sun is as follows:
(5)where m represents the date and n represents the minute. Then,
(6)(7)ω=23.5sin2π287+m365,sinh=sinαsinωcosαcosωcosθ.Get azimuth, i.e.,(8)P=OH=x0−02+y0−02,PS=cotβ,S⋅cotβ=x02+y02.Fitting analysis is for the least square method, in which the quadratic curve expression is(9)y=fx2+gx+l.Set the parameter asf; when f is the minimum state, take it as the basis of optimization evaluation, and define ω based on the model to obtain the relationship between dimension and height angle. Through the least square fitting analysis, the least square model is constructed at the same time. When f is the smallest, the obtained quadratic fitting function is as follows:
(10)minFf,g,l=∑w=1mxw−xw′2+yw−yw′2.Based on this research, the nonlinear equation can be obtained, namely,(11)sinA=cosωsinθcosarcsinsinαsinωcosαcosωcosθ.The equation is solved by MATLAB software to obtain the date serial number, i.e., 108, andω is 10.6. Based on this value, the measuring place can be determined.(2) Question 2. Firstly, the rows and columns of matrix strings are defined, and the number of parameters is defined. Once the parameters exceed six, the matrix distribution mode needs to be defined, and the corresponding parameters should be defined through multiple elements. Secondly, determine the specific search range, define the search range based on the improved genetic algorithm, and determine the use range for practical problems. According to the specific situation, the estimation parameter range and discrimination of measurement data are defined. Evaluate the individual’s fitness again. Based on the least square method, we know that
(12)L=∑yt−λKtβ2,where L represents the difference between the experimental estimated value and the measured value, and the smallest group is selected as the high-quality data to be output. The improved genetic algorithm combined with the least square method can effectively solve the key problems. Based on the genetic algorithm, the difference between the parameter value and the measured value is searched, and the fitness function of the genetic algorithm is obtained.
(13)ux=1L=1∑yt−λKtβ2.Finally, to avoid the damage during mutation, in order to avoid parent string mutation, it is necessary to find the optimal solution without crossover and mutation and directly input the offspring. In order to facilitate the improved genetic algorithm to quickly and accurately obtain the global optimal solution, it is also necessary to construct crossover function and mutation probability to obtain(14)H<Q2,Pαh=Pαmax−2Pαmax−PαminQ⋅H,Q2≤H≤Q,Pαh=Pαmin,H≤Q2,Pnh=Pnmax−2Pαmax−PαminQ⋅H,Q2≤H≤Q,Pnh=Pnmin.Pah and Pnh represent crossover probability and mutation probability, respectively. Q stands for algebra. Pamax and Pa and Pn represent the upper limit and the lower limit. During the simulation test, the range of Pa and Pn can be set according to the actual needs. There are too many parameters, so there will be long codes when identifying problems, and single-point crossover will be adopted, but it will hinder the expansion of the search space, which can be calculated and analyzed through two-point crossover or multipoint crossover. The whole process needs to be obtained based on the genetic algorithm. After crossover and mutation, the individual search space generated is relatively large, which can maximize the optimization.


## 3.1. Improved Genetic Algorithm

### 3.1.1. Operating Principle of the Basic Genetic Algorithm

The genetic algorithm, as a new computing method, is based on the basic principles of genetics, imitates the mutation and crossover mechanism of biological genetic evolution, and makes a global search for specific problems to obtain a basic genetic algorithm (SGA), which is the basis of improving the genetic algorithm.Coding operation is adopted to express the solution space as structural data in genetic information, thus completing genetic operation. According to the precision requirement, the binary symbol is used as the fixed coding string to represent the gene model between individuals. According to the structure of space, its value range is defined, and after coding, it is necessary to generate a number of individuals as the initial population [18]. By calculating the individual fitness evaluation function value, the individual’s pros and cons are calculated. The selection operator needs to judge the fitness of the individual according to the fitness function of the individual, so as to complete the whole operation process. Matching each other according to a certain rule and generating new data individuals, the genetic algorithm is the most important method for crossoperation. For each random mutation point, the gene value is inversely calculated, thus forming a new individual.


### 3.1.2. Mobile Computing Model

A mobile computing model is the basic framework and principle that the computer system must follow to complete calculation. The mobile computing model is significantly different from the distributed computing model due to special requirements such as device disconnection, communication and computing imbalance, and energy saving caused by mobility. Therefore, support for mobility and weak connectivity should be added. The core problem of the mobile computing model is to determine how the functions of the mobile terminal and server are allocated and how to adjust dynamically according to the needs.The concepts of location and movement determine that the architecture of the mobile computing system is loosely coupled and strongly autonomous. Loose coupling means that a group (application or device) continues to work when it is disconnected or weakly connected to the server. And as long as the connection is available, make the connection. Strong autonomy in mobile computing is determined by the characteristics of mobile computing environment. That is, it must have very little self-tolerance and very strong initiative. Due to loose coupling, strong autonomy and mobility of computing components, mobile computing systems need dynamic configuration. Component movement and management regionalization require mobile computing to fully consider resource access control policies and mechanisms.π-calculus is a method of describing and analyzing concurrent systems and is an extension of CCS. The base entity is the channel name and the process made up of the name. The syntactic definition of the monospora π-calculus process is as follows:
(1)P⋅⋅⋅⋅=∑i∈IαiPiP1P2P1+P2vxPP,α⋅⋅⋅⋅=xyxy,where x,y stands for name and has two forms: the input prefix xy means that the name y is received on channel x and the output prefix xy means that the name y is sent on channel x.


### 3.1.3. Convergence Verification

Function optimization is a very important part of the genetic algorithm. Given an objective function, it is necessary to find the best quality in the solution space without any constraints. With the Rastrigin function as the test function, the convergence effects of crossover probability and mutation probability are analyzed.


### 3.1.4. Analysis of the Improvement Scheme

In the process of running the algorithm, crossover and mutation will increase the search range. At the end of the running of the algorithm, it is necessary to control the search within a certain range for the protection of individual position. If the algorithm can find a group point with high average fitness in the initial running stage, the optimal solution can be obtained. In order to keep the best individuals better, it is necessary to accelerate the convergence speed in the iterative process and ensures that the optimal value which is found before the maximum value of average fitness is obtained.


## 3.1.1. Operating Principle of the Basic Genetic Algorithm

The genetic algorithm, as a new computing method, is based on the basic principles of genetics, imitates the mutation and crossover mechanism of biological genetic evolution, and makes a global search for specific problems to obtain a basic genetic algorithm (SGA), which is the basis of improving the genetic algorithm.Coding operation is adopted to express the solution space as structural data in genetic information, thus completing genetic operation. According to the precision requirement, the binary symbol is used as the fixed coding string to represent the gene model between individuals. According to the structure of space, its value range is defined, and after coding, it is necessary to generate a number of individuals as the initial population [18]. By calculating the individual fitness evaluation function value, the individual’s pros and cons are calculated. The selection operator needs to judge the fitness of the individual according to the fitness function of the individual, so as to complete the whole operation process. Matching each other according to a certain rule and generating new data individuals, the genetic algorithm is the most important method for crossoperation. For each random mutation point, the gene value is inversely calculated, thus forming a new individual.


## 3.1.2. Mobile Computing Model

A mobile computing model is the basic framework and principle that the computer system must follow to complete calculation. The mobile computing model is significantly different from the distributed computing model due to special requirements such as device disconnection, communication and computing imbalance, and energy saving caused by mobility. Therefore, support for mobility and weak connectivity should be added. The core problem of the mobile computing model is to determine how the functions of the mobile terminal and server are allocated and how to adjust dynamically according to the needs.The concepts of location and movement determine that the architecture of the mobile computing system is loosely coupled and strongly autonomous. Loose coupling means that a group (application or device) continues to work when it is disconnected or weakly connected to the server. And as long as the connection is available, make the connection. Strong autonomy in mobile computing is determined by the characteristics of mobile computing environment. That is, it must have very little self-tolerance and very strong initiative. Due to loose coupling, strong autonomy and mobility of computing components, mobile computing systems need dynamic configuration. Component movement and management regionalization require mobile computing to fully consider resource access control policies and mechanisms.π-calculus is a method of describing and analyzing concurrent systems and is an extension of CCS. The base entity is the channel name and the process made up of the name. The syntactic definition of the monospora π-calculus process is as follows:
(1)P⋅⋅⋅⋅=∑i∈IαiPiP1P2P1+P2vxPP,α⋅⋅⋅⋅=xyxy,where x,y stands for name and has two forms: the input prefix xy means that the name y is received on channel x and the output prefix xy means that the name y is sent on channel x.


## 3.1.3. Convergence Verification

Function optimization is a very important part of the genetic algorithm. Given an objective function, it is necessary to find the best quality in the solution space without any constraints. With the Rastrigin function as the test function, the convergence effects of crossover probability and mutation probability are analyzed.


## 3.1.4. Analysis of the Improvement Scheme

In the process of running the algorithm, crossover and mutation will increase the search range. At the end of the running of the algorithm, it is necessary to control the search within a certain range for the protection of individual position. If the algorithm can find a group point with high average fitness in the initial running stage, the optimal solution can be obtained. In order to keep the best individuals better, it is necessary to accelerate the convergence speed in the iterative process and ensures that the optimal value which is found before the maximum value of average fitness is obtained.


## 3.2. Least Square Method

The least square method has a good effect on the study of observation data. For known variables, it is necessary to satisfy a specific linear relationship and observe the variables for many times, so as to obtain observation data. The basic idea of the least square method is to find the straight line with the shortest distance between multiple groups of observations. If ann contains m unknowns, it is necessary to find the optimal value according to the linear equations. In regression analysis and variance analysis, the least square method is the best theoretical basis, and many mathematical statistics theories are developed on the basis of the least square method. In the least square method, it is known that the observed data x1,y1,x2,y2⋯xn,yn need to satisfy the condition y=gx+εx, where y=gx is a function and εx=y−gx is an error function. εix=yi−gxi is an observation function. This method is called the least square method. The fitting function can be expressed as
(2)y=a1φ1x+a2φ2x+⋯asφsx,where φ1x,φ2x⋯φsx is the basis function and the undetermined function aii=1,2,⋯,s. In order to determine aii=1,2,⋯,s, it is necessary to minimize the sum of squares of observed data distances between Y and N, so that the formula can get the minimum value.


## 3.3. Construction of the Computer Mathematical Model

### 3.3.1. Ask Questions

(1) Question 1. There is a straight bar with a length of 3.5 m in the square. Based on the square position, the longitude and latitude (θ) can be roughly determined to obtain the sun altitude angle and azimuth angle. The shadow length of the straight rod can be obtained according to the change of parameters, and the correlation between the coordinates of the shadow endpoint and the height of the straight rod is not high. The curve fitting analysis can be carried out by the least square method to solve the corresponding irradiation time of the shadow minimum point and then calculate the longitude. At the same time, solving latitude is constructed based on a nonlinear equation. The longitude and latitude are not unique, which directly increases the difficulty of solving, which can be solved by the improved genetic algorithm to determine the measuring points.(2) Question 2. Based on the improved genetic algorithm, the optimal solution is found, and the relevant parameters are obtained through its discrimination ability. Distinguish the model specifically:
(3)yt=−f1yt−1−⋯−fmyt−1+g1kt−1+⋯+gnkt−1+γt.The least square method is regarded as one of the most commonly used methods to solve and distinguish the parameters.


### 3.3.2. Building a Model

(1) Question 1. Set the height of the straight rod as u, projecting on the end point of the ground based on the highest point of the straight rod, and the shadow length as OH, and set the included angle between the sun ray and the ground as β; then,
(4)PU=cotβ.Then,△klatitude=12×f−120/180. The specific relationship between the flat sun and the true sun is as follows:
(5)where m represents the date and n represents the minute. Then,
(6)(7)ω=23.5sin2π287+m365,sinh=sinαsinωcosαcosωcosθ.Get azimuth, i.e.,(8)P=OH=x0−02+y0−02,PS=cotβ,S⋅cotβ=x02+y02.Fitting analysis is for the least square method, in which the quadratic curve expression is(9)y=fx2+gx+l.Set the parameter asf; when f is the minimum state, take it as the basis of optimization evaluation, and define ω based on the model to obtain the relationship between dimension and height angle. Through the least square fitting analysis, the least square model is constructed at the same time. When f is the smallest, the obtained quadratic fitting function is as follows:
(10)minFf,g,l=∑w=1mxw−xw′2+yw−yw′2.Based on this research, the nonlinear equation can be obtained, namely,(11)sinA=cosωsinθcosarcsinsinαsinωcosαcosωcosθ.The equation is solved by MATLAB software to obtain the date serial number, i.e., 108, andω is 10.6. Based on this value, the measuring place can be determined.(2) Question 2. Firstly, the rows and columns of matrix strings are defined, and the number of parameters is defined. Once the parameters exceed six, the matrix distribution mode needs to be defined, and the corresponding parameters should be defined through multiple elements. Secondly, determine the specific search range, define the search range based on the improved genetic algorithm, and determine the use range for practical problems. According to the specific situation, the estimation parameter range and discrimination of measurement data are defined. Evaluate the individual’s fitness again. Based on the least square method, we know that
(12)L=∑yt−λKtβ2,where L represents the difference between the experimental estimated value and the measured value, and the smallest group is selected as the high-quality data to be output. The improved genetic algorithm combined with the least square method can effectively solve the key problems. Based on the genetic algorithm, the difference between the parameter value and the measured value is searched, and the fitness function of the genetic algorithm is obtained.
(13)ux=1L=1∑yt−λKtβ2.Finally, to avoid the damage during mutation, in order to avoid parent string mutation, it is necessary to find the optimal solution without crossover and mutation and directly input the offspring. In order to facilitate the improved genetic algorithm to quickly and accurately obtain the global optimal solution, it is also necessary to construct crossover function and mutation probability to obtain(14)H<Q2,Pαh=Pαmax−2Pαmax−PαminQ⋅H,Q2≤H≤Q,Pαh=Pαmin,H≤Q2,Pnh=Pnmax−2Pαmax−PαminQ⋅H,Q2≤H≤Q,Pnh=Pnmin.Pah and Pnh represent crossover probability and mutation probability, respectively. Q stands for algebra. Pamax and Pa and Pn represent the upper limit and the lower limit. During the simulation test, the range of Pa and Pn can be set according to the actual needs. There are too many parameters, so there will be long codes when identifying problems, and single-point crossover will be adopted, but it will hinder the expansion of the search space, which can be calculated and analyzed through two-point crossover or multipoint crossover. The whole process needs to be obtained based on the genetic algorithm. After crossover and mutation, the individual search space generated is relatively large, which can maximize the optimization.


## 3.3.1. Ask Questions

(1) Question 1. There is a straight bar with a length of 3.5 m in the square. Based on the square position, the longitude and latitude (θ) can be roughly determined to obtain the sun altitude angle and azimuth angle. The shadow length of the straight rod can be obtained according to the change of parameters, and the correlation between the coordinates of the shadow endpoint and the height of the straight rod is not high. The curve fitting analysis can be carried out by the least square method to solve the corresponding irradiation time of the shadow minimum point and then calculate the longitude. At the same time, solving latitude is constructed based on a nonlinear equation. The longitude and latitude are not unique, which directly increases the difficulty of solving, which can be solved by the improved genetic algorithm to determine the measuring points.(2) Question 2. Based on the improved genetic algorithm, the optimal solution is found, and the relevant parameters are obtained through its discrimination ability. Distinguish the model specifically:
(3)yt=−f1yt−1−⋯−fmyt−1+g1kt−1+⋯+gnkt−1+γt.The least square method is regarded as one of the most commonly used methods to solve and distinguish the parameters.


## 3.3.2. Building a Model

(1) Question 1. Set the height of the straight rod as u, projecting on the end point of the ground based on the highest point of the straight rod, and the shadow length as OH, and set the included angle between the sun ray and the ground as β; then,
(4)PU=cotβ.Then,△klatitude=12×f−120/180. The specific relationship between the flat sun and the true sun is as follows:
(5)where m represents the date and n represents the minute. Then,
(6)(7)ω=23.5sin2π287+m365,sinh=sinαsinωcosαcosωcosθ.Get azimuth, i.e.,(8)P=OH=x0−02+y0−02,PS=cotβ,S⋅cotβ=x02+y02.Fitting analysis is for the least square method, in which the quadratic curve expression is(9)y=fx2+gx+l.Set the parameter asf; when f is the minimum state, take it as the basis of optimization evaluation, and define ω based on the model to obtain the relationship between dimension and height angle. Through the least square fitting analysis, the least square model is constructed at the same time. When f is the smallest, the obtained quadratic fitting function is as follows:
(10)minFf,g,l=∑w=1mxw−xw′2+yw−yw′2.Based on this research, the nonlinear equation can be obtained, namely,(11)sinA=cosωsinθcosarcsinsinαsinωcosαcosωcosθ.The equation is solved by MATLAB software to obtain the date serial number, i.e., 108, andω is 10.6. Based on this value, the measuring place can be determined.(2) Question 2. Firstly, the rows and columns of matrix strings are defined, and the number of parameters is defined. Once the parameters exceed six, the matrix distribution mode needs to be defined, and the corresponding parameters should be defined through multiple elements. Secondly, determine the specific search range, define the search range based on the improved genetic algorithm, and determine the use range for practical problems. According to the specific situation, the estimation parameter range and discrimination of measurement data are defined. Evaluate the individual’s fitness again. Based on the least square method, we know that
(12)L=∑yt−λKtβ2,where L represents the difference between the experimental estimated value and the measured value, and the smallest group is selected as the high-quality data to be output. The improved genetic algorithm combined with the least square method can effectively solve the key problems. Based on the genetic algorithm, the difference between the parameter value and the measured value is searched, and the fitness function of the genetic algorithm is obtained.
(13)ux=1L=1∑yt−λKtβ2.Finally, to avoid the damage during mutation, in order to avoid parent string mutation, it is necessary to find the optimal solution without crossover and mutation and directly input the offspring. In order to facilitate the improved genetic algorithm to quickly and accurately obtain the global optimal solution, it is also necessary to construct crossover function and mutation probability to obtain(14)H<Q2,Pαh=Pαmax−2Pαmax−PαminQ⋅H,Q2≤H≤Q,Pαh=Pαmin,H≤Q2,Pnh=Pnmax−2Pαmax−PαminQ⋅H,Q2≤H≤Q,Pnh=Pnmin.Pah and Pnh represent crossover probability and mutation probability, respectively. Q stands for algebra. Pamax and Pa and Pn represent the upper limit and the lower limit. During the simulation test, the range of Pa and Pn can be set according to the actual needs. There are too many parameters, so there will be long codes when identifying problems, and single-point crossover will be adopted, but it will hinder the expansion of the search space, which can be calculated and analyzed through two-point crossover or multipoint crossover. The whole process needs to be obtained based on the genetic algorithm. After crossover and mutation, the individual search space generated is relatively large, which can maximize the optimization.


## 4. Research Results

For question 1, use MATLAB software to make the curve of shadow length change with time as shown in Figure1.Figure 1
Curve of shadow length of pole changing with time.A total of 50 sampling parameters are counted by the input and input data of the third-order linear discrete system, and the parameters are estimated according to the combination of the improved genetic algorithm and the least square method. The initial conditions are given when calculating, and theN-link deviation before the experiment and the calculation is as follows:
(15)γ′0=φ,γe′0=0,ent=y′t−yt2,Lt=∑wne2t.Therefore,yt represents the measured value, and y′t represents the optimal value sought by the improved genetic algorithm, i.e., 1.76,0.95,0.16,1.00,0.53,0.07. However, before decoding, it is necessary to clarify the parameter variation range and distinguish the results as 1.70,0.94,0.15.In the comparative test, algorithm 1 adopts binary coding, single-point crossing, and roulette; algorithm 2 adopts real coding, and a selection operator adopts an adaptive proportional selection operator. Algorithm 3 is an improved algorithm in this paper. The initial population size is set at 100, and the maximum evolutionary algebra is 500. Run each algorithm for 100 times, and when the optimal solution function is searched, it indicates that the algorithm is successful in optimization and then stops operation, and record the average error between the optimal solution function value and ideal extremum when the algorithm is stopped, the average convergence algebra of successful optimization, the number of successful optimization times, and the optimal function value obtained by 100 searches. If the algorithm does not converge when it exceeds the maximum evolutionary algebraT=500, it is considered that this experiment does not converge, as shown in Tables 1–3.Table 1
Experimental results of three algorithms on F1.
Average errorNumber of successesAverage convergence iterationOptimal function valueAlgorithm 15.9∗10−44728538.8Algorithm 22.9∗10−48414738.8Algorithm 31.9∗10−49512138.8Table 2
Experimental results of three algorithms on F2.
Average errorNumber of successesAverage convergence iterationOptimal function valueAlgorithm 16.5∗10−434387-186.8Algorithm 22.5∗10−478246-186.7Algorithm 31.2∗10−490189-186.7Table 3
Experimental results of three algorithms on F3.
Average errorNumber of successesAverage convergence iterationOptimal function valueAlgorithm 15.9∗10−4253660.5Algorithm 23.7∗10−4671840.5Algorithm 32.6∗10−4801300.5It can be seen from the above table that algorithm 1 is inferior to other algorithms in all results, which shows that the traditional genetic algorithm is difficult to adapt to this computer mathematical model. Algorithms 2 and 3 have more successful optimization times, avoiding premature convergence, which proves the superiority of the improved algorithm.


## 5. Conclusion

Mathematical modeling is to build a mathematical model according to specific problems, solve the model by mathematical methods and computer tools, and solve practical problems according to the results. In this paper, the computer mathematical model is constructed based on the improved genetic algorithm and the least square method. Through theoretical analysis, the two algorithms are verified by specific problem analysis experiments. The results show that, as a modern advanced algorithm, the improved genetic algorithm has outstanding global search ability, concise coding technology, and genetic operation method and less limitation in the optimization problem. The improved genetic algorithm has strong discrimination ability, can find the optimal solution, and greatly improves the operation efficiency and quality. The equations are solved by MATLAB software. Clear the specific use area of parameters to solve the related problems such as estimating parameter range and distinguishing. The simulation results show that the computer mathematical model based on the improved genetic algorithm and least square method can significantly expand the search space, and the operation efficiency is relatively high. The continuous improvement and perfection of the genetic algorithm are helpful to promote social progress. It is of great practical significance to the development of society.



---

*Source: 1584435-2021-12-26.xml*