In this study, we use the neighborhoods as the main unit of investigation. In order to represent the activity relationships between neighborhoods, we designed a spatiotemporal simulation model containing both short and long connections. Short connections were established based on interactions within the same activity, and connections between neighborhoods were facilitated due to the activities of individuals within them. On the other hand, longlasting connections were established between distant neighborhoods where individuals engage in common activities.
COVID19 spatiotemporal propagation simulation model
In the context of the COVID19 pandemic, it is crucial to accurately determine various epidemiological parameters for the disease. To achieve this, we utilized the RungeKutta method and fitted the fmincon function to minimize the sum of squared residuals, resulting in optimal parameter values. These values were then integrated into the SEIR (SusceptibleExposedInfectiousRemoved) model to predict the number of COVID19 cases. It is worth noting that the transmission of the virus primarily occurs among acquaintances within individuals' daily activities, emphasizing the importance of understanding social networks in disease transmission.
Agent model
The agent model mainly consists of agents with specific action objectives, which can perceive the environment and decisionmaking behavior under certain conditions. By defining the attributes and behaviors of agents, some phenomena in the real world can be simulated. Agents may represent a single individual or a homogeneous class of individuals. When constructing infectious disease models, modeling objects are mainly divided into microscopic individuals and single/mixed groups [32]. The microscopic individual considers a single individual as the research object while taking into account differences between individuals, while the single group regards a class of individuals with the same characteristics and explores the differences between individuals with different characteristics. The composite group represents individuals living in a relatively independent geographical area and the migration of internal individuals links the subgroups. In order to explore the epidemic situation of COVID19 in urban areas, this paper adopts the mixed group method, where the population in the neighborhood is regarded as a subgroup, the agent represents all the individuals in a single cell, and the network represents the connections between cells due to the movement of the internal individuals.
The population division method of the SEIR (SusceptibleExposedInfectiousRecovered) model can be used to divide the population into four categories: susceptible agent S (healthy individual), latent agent E (infected but asymptomatic individual, infectious), the infected agent I (infected and symptomatic individual) and remover agent R (cured or dead individual). Defining agent attributes, social relations, and state transition rules construct the agent model of COVID19. The agent attributes can be described as follows:
Definition 1
Agent attributes. Agent attributes refer to the properties of agents. The agent attributes of this paper include agent identification, agent location, latent days, infection days and agent category, which are expressed as:
$$\begin{array}{c}A=\left(O, P, {D}_{e},{D}_{i} , K\right)\#\left(1.\right)\end{array}$$
In the formula, O represents the number of the agent, P denotes the geographical location of the agent in the virtual space, De represents the number of days when the latent agent is in the incubation period, Di represents the number of days when the infected agent is in the infection period, K represents the type of agent, that is, an agent at a particular time belongs to the susceptible agent, the latent agent, the infected agent or the evacuee agent. It is crucial to note that each agent can only belong to a particular type of agent at each time.
Simulation of COVID19 spatiotemporal propagation of smallworld networks with cooperative multiagent
The impact of interpersonal relationships on the prevalence of epidemics is significant. In everyday life, individuals tend to have fixed social networks with stable relationships. Viral infections are usually spread among acquaintances in these networks. Understanding the patterns of viral transmission within individual social networks is crucial for controlling the epidemic. The smallworld network model is a widely used method for describing social relationships between people. In this paper, we use the smallworld network to model these relationships and construct a spatiotemporal simulation m called the COVID19 SmallWorld Network Collaborative MultiAgent Model. This model combines the smallworld network approach with multiagent modeling techniques to simulate the spread of COVID19.
The smallworld network model captures the clustering and separation of nodes in realworld systems. Within social networks, this property means that individuals who do not know each other can be connected by short chains of acquaintances, leading to the smallworld phenomenon. Many empirical network diagrams exhibit smallworld phenomena, such as social networks, the underlying architecture of the Internet, Wikipedia's encyclopedia sites, and genetic networks. The clustering coefficient and average path length can identify whether the network has smallworld characteristics. Two parameters that characterize smallworldness are the clustering coefficient and the average path length. The clustering coefficient measures the proximity of neighbor nodes, while the average path length indicates the typical distance between any two nodes in the network. A smallworld network falls between regular and random networks, with a significant clustering coefficient and a small path length. The nodes in the smallworld network can represent the agents, and the connection between the nodes can represent the social relationship between the agents. To understand the role of social connections in spreading the COVID19 epidemic, the number of agents ' neighbors and the average degree of the network are defined as:
Definition 2
Number of agent neighbors. The number of edges directly connected to the agent node i, that is, the degree (Ui) of node i, is expressed as:
$$\begin{array}{c}{U}_{i}={\sum }_{b\in L}{A}_{b}^{i}\#\left(2.\right)\end{array}$$
In Eq. 2, L is the set of all sides; \({A}_{b }^{i}\)takes a value of 1 or 0, mainly determines whether b contains node i; if it does, \({A}_{b}^{i}\)value takes 1, otherwise take 0. Generally, a more extensive Ui indicates that the node is more important in the network.
Definition 3
Network average degree. The average degree of all agents in the network is the average degree of the network (< k>), expressed as:
$$\begin{array}{c}<k\ge \frac{\sum {U}_{i}}{N}\#\left(3.\right)\end{array}$$
In Eq. 3, N denotes the number of nodes in the network, and Ui denotes the number of neighbors of node i.
Jia, et al. [31] proposed constructing a smallworld network by "random edging." They used this method to establish an agent model of the smallworld network to simulate the social relationship between agents.
Definition 4
Agent social relationship. The connection between the nodes indicates the social connection between the agents. If there is a connected edge between the agents, it indicates that there is a social relationship between the two agents. Otherwise, there is no social relationship, expressed as:
$$\begin{array}{c}w={A}_{ij}^{l}\#\left(4\right)\end{array}$$
In Eq. 4, i and j represent node i and node j in the network. If there is an edge l connection between node i and node j, w is 1, otherwise w is 0.
In an agent model using a smallworld network, the social relationship between agents is expressed by constructing short and long connections based on the network's topology. A short connection is randomly established within a specific distance, representing an activity range of people's daily lives. The long connection selects an agent with a more significant node degree to connect randomly with other agents, reflecting far commuting or participation in largescale activities. Fardistance cells are connected when internal individuals participate in the same activity. Figure 1 illustrates the structure of the COVID19 propagation model, where green circles represent susceptible agents, yellow circles represent latent agents, red circles represent infected agents, and blue circles represent removed agents.
The steps to build the social network of the agent is as follows:
(1) According to the range of people's daily activities, the amicable relationship between the daily activities of the agent is randomly established.
(2) Select an agent with a certain degree of high modality and randomly connect with other agents to construct a distant relative relationship for longdistance commuting. Barabási, et al. [33] proposed the "preference dependency" network model, emphasizing that the probability of connecting edges between nodes in real networks often has the characteristics of "heavytail distribution," and subsequent studies have also shown that this network structure has essential applications in epidemic transmission and cluster behavior [34, 35].
Propagation mechanism
The state of an agent can change at any time. Disease transmission mainly occurs between agents through short and long connections. Infected and latent agents are infectious, and those in contact with them within the infection period have a certain probability of contracting the disease. Susceptible agents can be infected by either infected or latent agents and become latent agents. Latent agents will transition to infected after incubation, and infected agents will become removed agents after the end of the infection period, which prevents them from being reinfected. The state transition rules of the agent are shown in Fig. 2.
The agent propagation mechanism is shown in Fig. 3. Firstly, the adjacent agents of the infected agent in the social relationship network are obtained as the infected contacts. The infected contacts generate a random number r to compare with the actual infection rate to determine whether the infected contacts are infected with the latent agent. If the random number r exceeds the infection rate, the infected contacts are not infected. Conversely, if the random number r is less than or equal to the infection rate, the infected contacts are infected into the latent agent. Similarly, the latent agent obtains the adjacent agent of the latent person in the social relationship network as the latent contact. The latent contact generates a random number r2 to compare with the latent rate to determine whether the latent contact ends the latent contact period and becomes the infected agent. If the random number r2 exceeds the latent rate, the latent contact remains in the latent period. Otherwise, the random number r2 is less than or equal to the latent rate, and the latent contact ends the latent period and becomes the infected agent.
Model simplification
To simplify the implementation of the COVID19 spacetime propagation model using smallworld network collaborative multiagent, several assumptions are proposed:
(1) It is assumed that the infection and the removal probability between cells are the same without considering the impact of factors such as the internal size of the cell.
(2) All lurking agents will be transformed into infected agents, and there are no cases of selfhealing or death of lurking agents or reinfection of removed agents.
(3) Neighborhood social network relationships are mainly concentrated within a specific range of surrounding communities. If a city is under comprehensive control management and all public transport in the urban area is closed, remote communities have no social relationships. When a cell is under closed management, all connections are removed, indicating no social relationship between cells.
(4) Epidemic transmission only spreads through cell connection networks. If there is a network connection between the cells, the connected cells are likely to be infected and become epidemic cells if there is an epidemic cell.
Model realization
The pseudocode for the COVID19 spatiotemporal propagation model using smallworld network collaborative multiagent is shown in Table 1.
Table 1
Spatiotemporal propagation simulation algorithm of COVID19
Spatiotemporal propagation simulation algorithm of COVID19 based on multiagents with smallworld networks

Input: town data; actual infection data (SEIR)true; time intervalh

Output: number of the infected (. csv file)

// initialization

set town gis: loaddataset

while [count links < (p * numlinks)]

createshortlink with choice

while [count links >= (p * numlinks) and count links < numlinks]

createlonglink with choice

// satisfy the infection rules, agent state change

bring h and (SEIR)true into formula (7) and formula (8)

obtain predicted data (SEIR)t and best parameter valueβ、θ、α、r

if translaterate > = randomfloat 1

becomeinfected

// network degree and node distribution

setcurrentplot "agentslinksdistribution"

setcurrentplotpen "number agents"

exportworld (".csv")

end

Step 1: Initialization, mainly including agent initialization and space environment initialization. Agent initialization configures the four types of agents S, E, I, and R, according to the agent properties and methods for the acquired agent information; Space environment initialization is to process boundary data to provide a space environment basis for the activities of agents;
Step 2: Build a virtual space. Load cell vector data and urban vector data in NetLogo to build virtual space;
Step 3: Solve the model parameters. According to the COVID19 data, the RungeKutta method uses the SEIR model to obtain the predicted data. Then the fmincon function is used to solve the residual sum of squares to obtain the optimal parameter value. The specific steps are as follows:
①Considering that the COVID19 has an incubation period, this paper selects the SEIR model for simulation. The specific formula of the SEIR model is as follows:
$$\begin{gathered} \frac{{d{S_{{\text{(t)}}}}}}{{dT}}=\frac{{  \beta {I_{{\text{(t)}}}}{S_{{\text{(t)}}}}  \theta {E_{{\text{(t)}}}}{S_{{\text{(t)}}}}}}{N} \hfill \\ \frac{{d{E_{{\text{(t)}}}}}}{{dT}}=\frac{{\beta {I_{{\text{(t)}}}}{S_{{\text{(t)}}}}+\theta {E_{{\text{(t)}}}}{S_{{\text{(t)}}}}}}{N}  \alpha {E_{{\text{(t)}}}} \hfill \\ \frac{{d{I_{{\text{(t)}}}}}}{{dT}}=\alpha {E_{{\text{(t)}}}}  \gamma {I_{{\text{(t)}}}} \hfill \\ \frac{{d{R_{{\text{(t)}}}}}}{{dT}}=\gamma {I_{{\text{(t)}}}} \hfill \\ \end{gathered}$$
5
In Eq. 5, N is the total number of people, and S(t), E(t), I(t), and R(t), respectively, represent the total number of susceptible, latent, infected, and recovered people at time t, and S(t) + E(t) + I(t) + R(t) = N is satisfied at any time, which means that the total number of four types of people at time t is the total number of people, and remains unchanged; β indicates the probability of the number of infected persons; θ indicates the probability of the number of infected persons, α indicates the probability that the latent person will be transformed into an infected person, and r is the removal rate.
②Because the fourthorder RungeKutta method can solve ordinary differential equations very well [36], the RungeKutta method can save the complex process of solving differential equations using a computer simulation application when the derivative and initial value of the Equation is known. This paper uses the fourthorder RungeKutta method to numerically solve the SEIR model of Eq. 5. The fourthorder RungeKutta equation is as follows:
$$\begin{gathered} {{\text{y}}_{{\text{t+1}}}}={y_{\text{t}}}+\frac{h}{6}({k_{\text{1}}}+2{k_{\text{2}}}+2{k_3}+{k_4}) \hfill \\ {k_1}=f({x_{\text{t}}},{y_{\text{t}}}) \hfill \\ {k_2}=f({x_{\text{t}}}+\frac{h}{2},{y_{\text{t}}}+\frac{h}{2}{k_{\text{t}}}) \hfill \\ {k_3}=f({x_{\text{t}}}+\frac{h}{2},{y_{\text{t}}}+\frac{h}{2}{k_2}) \hfill \\ {k_4}=f({x_{\text{t}}}+\frac{h}{2},{y_{\text{t}}}+\frac{h}{2}{k_{\text{3}}}) \hfill \\ \end{gathered}$$
6
In Eq. 6, where k1, k2, k3, and k4 are the slopes of several points in the interval [xt, xt+1], k1 is the slope at the beginning of the period, k2 and k3 are the slopes of the midpoint of the period, k4 is the slope of the end of the time, and h is the time interval. The next value, yt+1, is determined by the product of the current value yt plus the time interval h and the estimated slope. The y in the model can be calculated as S, E, I, and R, respectively. According to the set initial values S0, E0, I0, and R0, the predicted values of the number of susceptible people St, the number of latent people Et, the number of confirmed people It, and the number of removed people Rt at each time can be obtained. Then the predicted value and the actual data of the epidemic are constructed. The sum of squares of residuals is shown in Eq. 7.
$$f=sum \left(\right({S}_{\text{true}}S{)}^{2}+({E}_{\text{true}}E{)}^{2}+({I}_{\text{true}}I{)}^{2}+({R}_{\text{true}}R{)}^{2})$$
7
In the formula, Strue, Etrue, Itrue, and Rtrue, respectively, represent the actual number of susceptible people, the number of latent people, the number of confirmed cases, and the number of transferred cases (including the number of cured cases and the number of dead cases), and S, E, I and R respectively represent the predicted number of susceptible people, the number of latent people, the number of confirmed cases and the number of transferred cases.
③The fmincon function solves the parameter solution with the minimum residual sum of squares. Finally, the fitting values of parameters β, θ, α, and r are obtained. The constraints of the function fmincon are as following equation:
$$\hbox{min} f(x) \to \begin{array}{*{20}{l}} {\begin{array}{*{20}{l}} {c(x) \leqslant 0} \\ {ceq(x)=0} \end{array}} \\ {A \cdot x \leqslant b} \\ {\begin{array}{*{20}{l}} {Aeq \cdot x=beq} \\ {lb \leqslant x \leqslant ub} \end{array}} \end{array}$$
8
In Eq. 8, c(x) is a nonlinear inequality, ceq(x) is a nonlinear equation, A●x < = b is a linear inequality, and Aeq·x = beq is a linear equation. Since there is no linear inequality constraint in the model, this paper sets A= [], b= [], Aeq= [], Beq= [], lb, and ub as the lower and upper bounds of the linear inequality constraint of variables. This paper sets parameters β、θ、α, and the r range is [0,1].
Step 4: Build a relationship network. Constructing the social network of agents represents the interaction between agents and simulates the spread of viruses in cities.
Step 5: According to the transmission mechanism of the agent, determine the infection rules of virus transmission.
Step 6: Use the experimental data to simulate and output the spatial distribution of the agent at the last moment after the simulation time and the curve of each agent over time.
Design of the study
The main objective of this study is to simulate the spread of COVID19 using a MultiAgent Simulation approach integrated with the SmallWorld Network framework. The experimental design comprises several essential components to ensure the robustness and credibility of the research findings. Firstly, a virtual space is constructed, incorporating data on neighborhoods in the main urban area of Wuhan City, including COVID19 infection counts. This data serves as the basis for building the MultiAgent Simulation model. Secondly, model parameters are computed by utilizing the RungeKutta method to predict COVID19 data, and the fmincon function is employed to obtain the optimal parameter values by minimizing the sum of squared residuals. Lastly, the MultiAgent Simulation model is constructed, and simulation results are outputted. The position of infected and exposed individuals is determined from the previous steps, and social relationship networks and infection rules are established to simulate interactions among agents. By incorporating the transition rules, the state changes of agents over time are modeled, and simulations are conducted to output the results. And the implementation steps are further detailed in Fig. 4.
Study area and data processing
Wuhan was the city most seriously affected by the early stage of the COVID19 epidemic in China. There are 13 districts in Wuhan, mainly including seven central urban areas of Jiang'an district, Jianghan district, Qiaokou district, Hanyang district, Wuchang district, Qingshan district, Hongshan district, and six administrative districts of Dongxihu district, Hannan district, Caidian district, Jiangxia district, Huangpi district and Xinzhou district. Wuhan is China's most significant inland water, land, and air transportation hub and the shipping center in the middle reaches of the Yangtze River. Its highspeed rail network radiates over half of China and is the only city in Central China that can directly travel to five continents worldwide. As of the end of 2020, Wuhan has an area of 8569.15 square kilometers, a permanent population of 12.3265 million people, and a regional GDP of 1.56 trillion yuan. This paper selects the research area as the central urban area of Wuhan (as shown in Fig. 5).
The data used in the propagation model mainly include COVID19 epidemic data and epidemic smallarea data in the urban area of Wuhan. The COVID19 epidemic data in Wuhan is sourced from the realtime data published around 7 PM on a daily basis by the DXY website ( https://ncov.dxy.cn/ ), including daily confirmed cases, cumulative confirmed cases, recovered cases, and deaths. Due to the change in the diagnosis method for COVID19 in Hubei Province on February 12th, about 12,000 clinical cases were added to the cumulative cases reported in Wuhan that day. In order to make the data more reasonable and reliable, the newly added data on February 12th was allocated to each day in the previous week according to the daily increase ratio of confirmed cases in the previous week [37], as shown in Fig. 6.
The epidemic smallarea data in the urban area of Wuhan was obtained from the lists of Wuhan's first and twentieth epidemicfree communities and villages, which were published by Changjiang Daily. Starting from March 6, 2020, the Neighborhood Prevention and Control Group of the Wuhan COVID19 Prevention and Control Headquarters released 20 batches of lists containing areas, communities, and villages (teams) with no reported cases. The designation of a noepidemic neighborhood is contingent upon meeting both the criteria of 'zero cases' and 'comprehensive control'. Since the data from the twentieth publication showed that 99.9% of the communities and villages had no cases, we regarded the communities and villages from this publication as all of Wuhan's residential areas. We obtained the location information of Wuhan's residential areas by using the Amap API according to their names and converted the obtained latitude and longitude information into vector data. We then spatially connected the vector data of residential areas with the vector data of central urban areas of Wuhan and finally obtained the residential area data for each district in the central urban area, as shown in Table 2. The epidemic residential areas were determined by comparing the first and twentieth epidemicfree neighborhood and village lists.
Table 2
Situation of epidemic residential areas in various districts of Wuhan
Area

Total number of plots

Epidemic plots

No epidemic plots

Proportion of epidemic plots

Jiang'an

1056

789

267

75%

Jianghan

668

491

177

74%

Qiaokou

489

365

124

75%

Hanyang

403

347

56

86%

Wuchang

848

424

424

50%

Qingshan

258

207

51

80%

Hongshan

949

857

92

90%

Sum

4671

3480

1191

75%

Parameter determination
When using epidemic models to study the spread of epidemics, the most important issue is to determine the transmission parameters of the epidemic, including infection rate, transition rate, and removal rate. Since the outbreak of COVID19, China has taken a series of measures to control the development of the epidemic, such as closing off communities, establishing a shelter hospital, and requiring temperature checks to enter public places. To ensure that the quantitative parameter values are closer to the actual values, we divided the epidemic into four stages based on three main time points during the Wuhan epidemic, namely the closure of traffic on January 23rd, the closure management of the neighborhood on February 10th, and the implementation of "bed waiting" on February 27th. The parameter fitting values for each stage are obtained according to Step 3, and the results are shown in Table 3.
Table 3
Quantitative values for each parameter at different stages
Time phasing

β

θ

α

r

Stage Ⅰ (2020.1.102020.1.22)

0.6101

0.1910

0.0803

0.0318

Stage Ⅱ (2020.1.232020.2.09)

0.0001

0.3267

0.1843

0.0187

Stage Ⅲ (2020.2.102020.2.26)

0.0001

0.1038

0.2803

0.0211

Stage Ⅳ (2020.2.272020.4.25)

0.0001

0.1282

0.3960

0.0761

After substituting the parameter values from Table 3 into the SEIR model, the fit curve obtained was compared with the actual epidemic data, as shown in Fig. 7. From the figure, it can be seen that the fitted values of cumulative confirmed cases, currently confirmed cases and removed cases show a similar trend to the actual epidemic data, indicating a good degree of model fitting and high accuracy of the quantified parameter fitting values in each stage.
Since the first place where the coronavirus was discovered and widely spread in Wuhan was the Huanan seafood market, we assumed it to be the initial infectious agent. Before January 23rd, 2020, the crowd was a regular activity, and the average network degree was 6; After January 23rd, Wuhan was "closed," all public transportation was halted, and all longdistance connections were cut off. On February 10th, Wuhan carried out the closed management of the neighborhood, the social contact between the communities was cut off, and all network connections were removed. The outbreak began with the discovery of the first unexplained pneumonia case on December 8th, 2019, until the existing confirmed cases in Wuhan became zero on April 25th, 2020. The period lasted 140 days, and the model set the simulation time to 140.