# Route Optimization of Agricultural Product Distribution Based on Agricultural Iot and Neural Network from the Perspective of Fabric Blockchain

Authors: Xin Zuo; Zhongwei Cui; Hong Lin; Dong Wang
Journal: Wireless Communications and Mobile Computing
 (2022)

---

## Abstract

With the fast growth of AI and Internet of Things (IoT) technology, many agricultural product sales businesses and logistics sectors have started to concentrate on agricultural product distribution information operations. The requirements for the delivery service time are very high due to the features of perishable and highly easy dehydration of fresh agricultural goods. To preserve the freshness and quality of agricultural goods, the logistics and distribution process must be completed as rapidly as possible via appropriate low temperature control and the use of IoT technology. IoT technology will surely bring about the intelligent operation in the circulation of agricultural products. With the decentralized management of the Fabric blockchain, the investment and maintenance costs of the agricultural IoT will be reduced, which will help to improve the intelligence and scale of the agricultural IoT. Aiming at the specific problems, the path optimization problem in the process of agricultural product distribution is brought out. This paper completes the following work: (1) the traditional agricultural product distribution process is roughly described, and the shortcomings and problems of the traditional mode are explored and studied. On this basis, the agricultural product circulation mode under the IoT and neural network technology is introduced. (2) The TSP problem is defined, then some algorithms commonly used to solve the TSP problem are introduced, and then the theory and method of the SOM neural network and the basic principle of the ORC_SOM algorithm are introduced in detail. (3) Through a large number of experiments, the results prove the validity of the algorithm in this paper and the rationality of the theory.


---

## Body

## 1. Introduction

The fast expansion of the social economy has raised people’s living standards, and people’s expectations for quality of life are increasing, with agricultural goods being no exception as essentials of life. Because agricultural goods are perishable and easily destroyed, the refrigerated shipping of agricultural products is an essential transit requirement for cold chain logistics [1]. Due to the significant time and effort involved in transporting and distributing agricultural goods, it is essential that the transportation infrastructure be fit for such a long journey. It not only saves energy and labor resources but it also ensures the quality of agricultural products, increases word-of-mouth and sales income for enterprises, and provides customers with high-quality agricultural goods. It is vital to speed up the logistics and distribution of agricultural goods to maximize shelf life and quality by using appropriate low temperature control and IoT technology to pick ideal pathways, in order to guarantee freshness and quality [2]. The process and methodology used in agriculture food distribution depend on location and mostly the type of food. There are various risk factors that need to be considered that affect this distribution process. As an example, weather conditions, economic failure, and political issues play a vital role in the efficiency of food distribution system.With the expansion of e-commerce channels, the fresh food field has occupied a certain proportion, and the demand for logistics in the distribution environment of agricultural products has also increased. However, the development of agricultural product logistics in my country is currently lagging behind. In this regard, a representative of the National People’s Congress put forward a suggestion that logistics enterprises should strengthen the construction of the logistics model of “production area warehouse + cold chain dedicated line” and improve the construction level of basic logistics facilities in the production area, reduce the loss of agricultural products, and improve the quality of agricultural products. It can be seen that my country has paid enough attention to the standardization, branding, and safety traceability of agricultural products [3, 4]. Therefore, how to scientifically and rationally use AI technology and the currently popular IoT technology to improve the standardization of agricultural product distribution and improve the construction of cold chain logistics will become problems to be solved in the future. The IoT technology is based on the revolutionary innovation of Internet technology and mobile communication technology. The current agricultural IoT has adopted a decentralized management method, that is, the use of blockchain technology. The development of modern agricultural product logistics industry will mainly rely on the innovation of IoT information technology [5, 6]. The need to transmit and transfer encrypted information ensuring security is one of the basic needs of modern life. Similarly, the stakeholders in the agricultural sector also want their data to remain stored securely without it being revealed to any third party organizations or people. The use of blockchain helps in achieving this aforementioned objective by providing effective protection and security while exchanging the data. The information is written in the blocks in the blockchain network which cannot be modified or accessed by unauthorized users. The data also gets stored in decentralized networks preventing occurrences of hacking or other fraudulent activities. This reduces the cost of risk mitigation relevant to security hacks. The comprehensive application of IoT technology in the logistics industry will inevitably lead to the intelligent transformation of the supply chain, thus ushering in an era of “smart logistics.” It brings the visualization and real-time management of goods in logistics distribution and storage and realizes the traceable management of goods logistics. It is against this background that this paper conducts an in-depth discussion on the optimization of agricultural product distribution routes; that is, by formulating reasonable and efficient logistics transportation routes, delivery is carried out in a high-efficiency and low-cost way. The logistics transportation path optimization problem is similar in essence to the classic TSP problem; that is, all customer points must be traversed, but the difference between the two is that the logistics distribution is covered and traversed by one or more delivery vehicles. It is determined according to different constraints and goals. The customer point and the distribution path of each vehicle are uncertain. This is the core problem to be solved in this paper. There are many algorithms for dealing with the TSP problem. Among them, the simulated annealing algorithm and the traditional SOM algorithm have some defects such as slow convergence speed and easy to fall into local optimum, which makes the system unsatisfactory to solve the path optimization problem [7, 8]. Consequently, this paper proposes the ORC_SOM algorithm, which ensures global and local optimization of the path through traditional SOM learning and competitive generalization and penetration, so that the algorithm can find a solution that is closer to an optimal solution than can be achieved by traditional SOM learning alone. The algorithm proposed has been applied in the actual system, and the operation results show that it can reduce the transportation cost of the vehicle and improve the economic benefit of the enterprise, which has high practical value.


## 2. Related Work

The main work content of the IoT is to realize intelligent identification and management. Since the concept of the IoT was put forward, countries all over the world have established special institutions to realize the research and development of the IoT. The prototype of the concept of the IoT was first proposed by the Massachusetts Institute of Technology in 1999. It was proposed that all things in the world could be connected to each other through the network, which vividly clarified the basic meaning of the IoT. Mobile Internet and IoT technology is used to scan barcodes and monitor the transit and storage environment of agricultural goods, so that efficient and intelligent operations may be achieved in all areas of agricultural products from production to sales. IoT and mobile communication technologies have led to a rise in study on this topic both domestically and internationally. Scholars from other countries are primarily interested in how the IoT might be used to track agricultural goods’ information. Reference [9] used RFID technology and public key technology when developing a fresh agricultural product management information system. The saved self-information allows customers to gain adequate right to know about agricultural goods, and it is easier to track and trace the origin of agricultural products when safety concerns develop. Information technologies like the Internet and electronic commerce are used in reference [10] to ensure the quality of agricultural goods by tracking their movement. In reference [11], in order to improve the quality and safety of agricultural products, the IoT technology is used to conduct all-round monitoring from product planting to agricultural harvesting and ultimately maximize profits. With the development of IoT technology, some scholars have begun to pay attention to the problem of agricultural IoT. Reference [12] takes the intelligent greenhouse where agricultural planting is located as the research object and introduces in detail the key technologies used and the example application of the specific system. Reference [13] analyzed and designed the overall architecture of the intelligent system of agricultural IoT technology in detail and proposed technical solutions for agricultural information intelligence, including agricultural product growth environment detection and quality and safety monitoring. Reference [14] mainly takes the agricultural production as the research background and proposes the use of RFID and sensor technology to monitor the growth environment of agricultural products, as well as the collection and storage of its own information, in the form of data encoding. The agricultural product information is stored in the electronic label to achieve the purpose of safety and quality tracking and traceability. Reference [15], when studying the risk assessment and process control of agricultural product supply chain in the IoT environment, specifically identifies the three-layer architecture of the IoT: the perception layer, the network layer, and the application layer in the supply chain. The three levels of the IoT identify risks in the agricultural supply chain and put forward measures and suggestions for related risks. The adoption of IoT in agriculture has huge benefits but there are associated challenges as well. The major challenges in this sector are lack of information, extremely high adoption expenses, and security concerns. Currently, the agricultural IoT is governed by a single point of contact. Software and hardware infrastructure, maintenance expenses, and energy usage in data centers are experiencing unprecedented problems as the number of smart devices linked to the IoT grows. Agriculture IoT investment and operating expenses may be significantly reduced via a decentralized management approach [16–18]. The linked monitoring equipment can self-manage and maintain itself, saving cloud-based control as the hub, thanks to a combination of blockchain technology and agriculture IoT. Agriculture IoT is more intelligent and scalable because of the high cost of infrastructure creation and maintenance, as well as the high energy consumption.The vehicle routing problem (VRP) has been studied for a long time at home and abroad, mainly to optimize the objective function value under the condition of satisfying the constraints. The vehicle routing model established by reference [19] includes the functions of simultaneous delivery and pickup, and a variety of approaches are used to solve the problem. D-W techniques, state-space relaxation methods, and dynamic programming methods are only a few of the options available today. In reference [20], a vehicle routing mathematical model with a fuzzy time window for the characteristics of fresh agricultural products as perishable food is established and solved. The model is then evaluated, analyzed, and optimized. There is a logistics distribution issue for frozen food with unpredictable time that can be solved using the fuzzy optimization approach in reference [21]. A mathematical model of routing optimization was established, and three heuristic algorithms were used to solve the model, namely, the tabu search algorithm, simulated annealing algorithm, and local search algorithm, and design examples were used to demonstrate the superiority of each algorithm and find the optimal delivery route, according to reference [22]. Using the Petri net approach, reference [23] created a model of the logistics system and ran a simulation. Reference [24] mainly focuses on the various costs incurred in the logistics distribution process when studying the vehicle routing problem, establishes a cold chain routing optimization model that minimizes the total distribution cost, and uses an appropriate algorithm to solve the model. Reference [25] mainly focuses on the level of consumer satisfaction when studying the VRP problem. Taking this as the starting point, a multiobjective route optimization model with the highest consumer satisfaction and the lowest distribution cost is constructed, and the genetic algorithm is used to solve it. Reference [26] mainly uses simulation software to design case data and solve the problem of cold chain path selection to verify the validity of the model and propose a method to optimize the model. Reference [27] considers the use of cloud computing when studying the VRP problem. The technology obtains traffic information in real time, and based on this, analyzes the travel time and distribution cost of cold chain logistics distribution vehicles, and establishes a path optimization model based on this. Reference [16, 17, 28] mainly focuses on the cold chain distribution of urban agricultural products. According to the characteristics of urban cold chain logistics distribution, the VRP optimization model is constructed, the genetic algorithm is used to analyze and solve it, and an example is designed to verify the effectiveness of the model. A study of and VRP problems shows that scholars primarily use heuristic intelligent algorithm, accurate algorithm, or improved related algorithm to solve the model and come up with a solution. It is impossible to utilize these models in all situations due to the dynamic aspects involved, such as delivery truck speeds that may vary, traffic congestion, and/or damaged parts of road that must be considered. In the future, while examining the VRP issue, there may be a lot more research on these features of typical traffic.The consolidation of food retail and the relevant aspects in its supply chain, namely, the distribution process has immense possibilities of fraudulent activities to be introduced leading to derogatory effect on the agricultural distribution system. This increase in concentration has been observed as a trend in the food retail sector since the past decades. The role of single share firms and local chains has declined considerably from 55 percent to 35 percent from 1977 to 2007. On the contrary, the concentration ratio of the largest four retailers has increased to 34 percent in 2019. The increase in food retail and distribution concentration has impacted the agro producers, namely, the small, midsized, and other independent processors. The increase in demand of food supplies has thus acted as the need for an effective and efficient distribution system [29–31].


## 3. Method

### 3.1. Self-Organizing Mapping Neural Network

In this paper, the optimization problem of agricultural product distribution path is transformed into a combinatorial optimization problem. The traveling salesman problem (TSP) is one of the well-known combinatorial optimization problems. To study the TSP problem, we must first introduce the NP-complete problem. In computer science, all problems to be solved by computers can be divided into two categories:P and NP. Modern computer science is based on Turing machine theory. There are two types of Turing machines: deterministic and nondeterministic. Computer science study only includes issues that can be answered by Turing machines. Problems of P-type can be solved in polynomial time by a deterministic Turing computer, whereas problems of NP-type can be solved in polynomial time by a nondeterministic Turing machine. If one NP-complete problem has a polynomial-time solution, all other problems have polynomial-time algorithms. This is an important feature of NP-complete problems; that is, all NP-complete problems satisfy reflexivity, symmetry, and transitivity, and they belong to the same equivalence class. The TSP problem is a well-known NP-complete problem. If we solve the TSP problem, we can solve other NP-complete problems. This is the point of studying the TSP problem. The model used in this paper is a well-known ANN: the self-organizing map (SOM) neural network, which has a series of output neurons and input neurons, as shown in Figure 1.Figure 1
Self-organizing map network structure diagram.Neurons in a SOM are arranged on grid nodes, which are either one-dimensional or two-dimensional in nature. Higher dimension mappings are also feasible; although, they are not as frequent as lower-level mappings. In competitive learning, neuronal modifications are tailored to the specific input patterns that are being received. A meaningful coordinate system is generated for diverse input properties on the grid when the placements of neurons after correction are arranged with each other. As a result of this, the SOM network’s topological mapping structure is defined by its grid neurons’ spatial representations of input patterns’ fundamental statistical properties. An important property of the human brain is that distinct sensory inputs are represented by topologically ordered computational maps. SOM networks, as neural models, are inspired by this feature. There are four distinct areas of the human brain that receive sensory, tactile, visual, and auditory information in a topologically organized way. As a result, computational mapping is a fundamental component of the nervous system’s information processing architecture. Sensory inputs are processed in parallel by an array of neurons in a computational map. So, the neuron transforms the input signal into a probability distribution encoding the spatial position, the distribution representing the calculated value of the parameter by the position of the largest relevant activation in the map. In a SOM network, the location of neurons is very important. Each incoming piece of information is kept in its right position at each level of representation, and neurons that process strongly correlated bits of information are densely coupled, allowing them to communicate via short synaptic connections. There are three main processes in the formation of self-organizing networks, as follows:(1)
Competitive process: letm denote the dimension of the input space and randomly select the input mode from the input space as(1)X=x1,x1,⋯,xmT.The synaptic weight vector of each neuron in the network has the same dimension as the input space. The synaptic weight vector of neuronj is denoted as
(2)Wj=wj1,wj2,⋯,wjm,j=1,2,⋯,k,where k is the total number of neurons in the network.To find the best match of the input vectorX and the synaptic weights Wj, compare the inner products WjTX for j=1,2,⋯,k and choose the largest one. This assumes that all neurons have the same threshold, and the threshold makes the bias negative. In this way, by selecting the neuron with the largest inner product WjTX, we actually determine the location of the topological neighborhood center of the excitatory neuron. Using iX to identify the neuron that best matches the input vector X, we can determine iX by the following conditions:
(3)iX=argminX−Wj,j=1,2,⋯,k.This recapitulates the nature of the neuronal competition process. The particular neuroni that satisfies this condition is called the winning neuron of the input vector X.
(2)
Cooperation process: winning neurons are located in the center of the topological field of cooperating neurons, and a firing neuron tends to activate neurons in its immediate neighborhood rather than neurons farther away. LetFj,i denote the topological field centered on the winning neuron i. Let Si,j denote the lateral distance between winning neuron i and excitatory neuron j. Then, we can assume that the topological neighborhood Fj,i is a unimodal function of the lateral distance Si,j so that it satisfies two different requirements: one is that the topological neighborhood Fj,i is symmetric with respect to the maximum point defined by Si,j=0; that is, the maximum value is reached at the winning neuron i whose distance Si,j is zero. The second is that the amplitude value of the topological neighborhood Fj,i decreases monotonically with the increase of the lateral distance Si,j and tends to zero when Si,j⟶∞, which is a necessary condition for network convergence. A typical choice of an Fj,i satisfying these conditions is a Gaussian function(4)Fj,iX=exp−Sj,i22σ2.Equation (4) is translation invariant; that is, it does not depend on the position of the winning neuron. For the cooperation between the neighborhood function neurons, the topological domain function Fj,i must depend on the lateral distance Si,j of the winning neuron i and the excitatory neuron in the output space, rather than relying on some measure of the original input space. For a one-dimensional grid, it can be defined as follows:
(5)Si,j=j−i.On the other hand, in the case of a two-dimensional grid, it can be defined as(6)Si,j=hj−hi,where the discrete vector hj defines the position of excitatory neuron j and hi defines the position of winning neuron i, both measured in discrete output space.As the SOM method becomes better, the topological field gets smaller. The breadth of the topological domain functionFj,i must decrease with time to meet this condition. This is a common way of describing how a variable’s value changes over time:
(7)σn=σ0exp−nτ1,n=0,1,2,⋯,where σ0 is the initial value of σ in the SOM algorithm, and τ1 is the time constant. In this way, the assumed form of the topological neighborhood has a time-varying form, which is expressed as follows:
(8)Fj,iXn=exp−−Sj,i22σ2n,n=0,1,2,⋯,.(3)
Adaptive process: in order to make the network self-organizing, the synaptic weight vectorWj of neuron j is required to change with the input vector X. By setting a scalar function gyj and requiring g0=0, the weight vector change of neuron j in the grid can be expressed as followsThe input vectorX must affect the synaptic weight vector Wj of neuron j in order for the network to self-organize. Neuron j’s weight change may be described in terms of a scalar function gyj and the g0=0 condition.
(9)ΔWj=μyjX−gyjWj,where μ is the learning rate parameter of the algorithm, gyjWj is the forgetting term, and gyj can be selected as a linear function:
(10)gyj=μyj.Simplifyyj to the following form:
(11)yj=Fj,iXand further get(12)ΔWj=μFj,iXX−Wj.Finally, using the discrete-time form, assuming that the weight vector of neuronj at time n is Wjn, the update weight vector Wjn+1 at time n+1 is defined as
(13)Wjn+1=Wjn+μnFj,iXnX−Wjn.Equation (13) has a tendency to move the synaptic weight vector Wi of neuron i to the input vector X. The neighborhood update makes the synaptic weight vector follow the distribution of the input vector when the training data recurs. As a consequence, the feature mappings in the input space are ordered topologically by the algorithm, resulting in identical synaptic weight vectors for nearby neurons in the grid.In the above equation, the learning rate parametern becomes a function μn that changes with time, which is the requirement of random approximation. It should start from the initial value of μ0 and then gradually decrease with increasing time n. μn can be chosen to be expressed as follows:
(14)μn=μ0exp−nτ2,n=0,1,2,⋯,where τ2 is a time constant of the SOM algorithm.Self-organizing maps (SOM) are one of the most predominantly used artificial neural network (ANN) models. This technique has been used popularly in agriculture sector. As an example, the study in [32] implemented SOM for classifying the influential factors of soil fertility. The study in [33] implemented Kohonen Self Organizing Feature Maps (SOFM) to analyze the effect of various soil properties that impacted the chemical and hydraulic processes in the soil. SOM was also used to predict the crop water stress index (CWSI) based on various precision agricultural variables, namely, the microclimatic variables, air temperature, canopy temperature, and relative humidity [34].


### 3.2. Classical SOM Algorithm for Solving TSP

#### 3.2.1. Kohonen Network Incorporating Explicit Statistics

The Kohonen network incorporating explicit statistics (KNIES) method takes full advantage of statistics. The network consists of a fixed number ofM neurons, and the input of the network is the coordinates of each city node, which belongs to the set P. The city nodes are mapped to the neurons of the ring structure, and the order of the neurons in the ring represents the order of the city nodes traversal. Since KNIES makes full use of the advantages of SOM, it can maintain the neighborhood structure between city nodes. The city nodes in the Kohonen network are first arranged in random order and then iteratively updated according to a certain method until a certain convergence criterion is satisfied.In each iteration, for the input city nodei in the set P, the neuron j∗ is the closest to i; then, j is the winning neuron. Some other neurons close to the neuron j∗ on the ring network together with j∗ form a set Dj∗t, where t is the number of iterations. Each neuron in Dj∗t moves to city node i according to equation (15):
(15)Yjt+1=Yjt+ψj,j∗Xi−Yjt,ifj∈Dj∗tYjt,otherwise,where Xi represents the coordinates of city node i, Yjt represents the coordinates of neuron j in the t-th iteration, and Dj∗t consists of the neighborhood of neuron j∗. ψ is a Gaussian kernel function, which is defined by function ψ, and each neuron can be updated with different weights in each iteration. Among them, the weights can be set to 0 for neurons that are not in the set Dj∗t. The disadvantage of Kohonen network is that it relies too much on the Gaussian kernel function variance, if the variance of the Gaussian kernel function is too large, and the algorithm will converge too slowly; on the contrary, if the variance of ψ is too large, the algorithm will converge too fast; so, the found solution is quite different from the optimal solution.Although the overall effect of SOM obeys a certain distribution, there is still a lot of useful information that is not used. In fact, in each iteration, the SOM ignores the statistics of data points that have already participated in the operation. Since statistics such as variance and mean of data points can be easily calculated, the SOM algorithm can be improved to take advantage of not only the information provided by the data points but also the statistical information of the data points. In other words, in each iteration, both the local information of the current data point and the global information of the potential data setP are used.


#### 3.2.2. Expanding SOM

The basic idea of “Expanding SOM” (ESOM) is to include the convex hull property in the computational rules with little computational cost. As the topological neighborhoods of city nodes are found and saved, the convex hull property of the city node set can be obtained. ESOM tries to satisfy the sufficient and necessary conditions for the optimal path, in each iteration, in addition to maintaining the convex hull property and in addition to keeping the activation neuron moving towards the input city node.


#### 3.2.3. Constructive-Optimizer Neural Network

Constructive-optimizer neural network (CONN) is a novel construction optimization neural network, which is also used to solve the TSP problem. The CONN algorithm consists of two parts, the construction part used to generate the TSP path and the optimization part used to optimize the path. The training process of the algorithm is as follows: (1) initialize a path, (2) add some cities to build a TSP path, (3) optimize this path through the optimizer, (4) when the algorithm conforms to the convergence rule and rejoin cities during go to build, and (5) the training is over until all cities have joined in.


#### 3.2.4. SOM Efficiently Applied to the TSP

The work of SOM efficiently applied to the TSP (SETSP) algorithm mainly focuses on introducing efficient neuron initialization method, learning rate parameter functionμn, and lateral distance σn. Its initialization method is at the beginning, and the neurons are distributed evenly and orderly on the rectangular box around the city point. The significance of this initialization method is that from the very beginning, the distribution of neurons in the input space is consistent with the topological neighborhood relationship in the output space; thus, the intermediate transformation process from disorder to order is avoided, and the efficiency of neuron learning is improved. As for the shape of the initial arrangement, it does not matter, and the ESOM to be introduced below uses a circular frame. The learning rate parameter function μn and the lateral distance function σn of SETSP are as follows:
(16)μn=1n3,σn=σn−1×1−0.01×n.The equation for the value ofσ0 is as follows:
(17)σ0=k4×b,where the parameter b is a constant representing the length of the diagonal of the rectangle.The effectiveness of the SETSP method has been confirmed, and its solution accuracy is generally higher than that of the KNIES method. Due to the relatively large initial value of the learning rate and the lateral distance function and the randomness of the city input order of the SOM algorithm, the fluctuations between the different operating results of the SETSP algorithm may be relatively large. SETSP does not use any neuron addition or deletion mechanism. It fixes the number of neurons to a constant larger than the number of cities. Experiments show that this method can also effectively solve the resolution problem in SOM density matching. However, the quality of the solution of SETSP depends on another disadvantage of this algorithm is the choice of the number of neurons to be initialized.


### 3.3. Overall-Regional Competitive for the TSP SOM

#### 3.3.1. Generalization Competition Mechanism and Local Penetration Mechanism

Overall-regional competition for the TSP SOM is referred to as ORC_SOM. In fact, the process of solving the TSP problem with the standard SOM algorithm is as follows: the position of the neuron is randomly initialized, and the winning neuron is continuously stimulated by the real city. The neuron continuously moves to the real city according to the learning algorithm and finally converges until the position of the neuron no longer moves. However, such a learning process can only obtain the overall optimal solution of the original TSP problem, not the global optimal solution. In order to obtain the optimal solution to the real urban TSP problem as much as possible, two new learning mechanisms, generalized competition and local penetration, are proposed and integrated into the standard SOM learning algorithm. From the solution requirements of the TSP problem, when the distance between the input city and the winning neuron is large, the displacement of the winning neuron and its neighboring neurons to the input city should be reduced, thereby allowing each neuron to compete more fairly, and we call this mechanism the generalized competition mechanism. When the distance between the input city and the winning neuron is small, the displacement of the winning neuron and its neighboring neurons to the input city should be increased, thereby weakening the competition of other neurons for the current input city and strengthening the winning neuron and its neighboring neurons compete for the current input city, and we call this mechanism a local penetration mechanism. The reduction or increase of the above displacement is relative to the standard SOM algorithm. Generalization competition is a mechanism that makes each neuron in a fairer competition, while local penetration is a mechanism that makes the winning neuron and its neighboring neurons have a better local competition ability. The former strengthens the overall optimization, and the latter strengthens local optimization. In order to realize the generalization competition and local penetration mechanism, we introduce the penetration radiusθ as the judgment threshold of the distance between the input city and the winning neuron. Once the distance between them is greater than θ, the generalization competition mechanism is adopted; otherwise, the local penetration mechanism is adopted. To do this, adjust the shift of the neuron to the input city as follows:
(18)wjn+1=wjn+PSX,jX;θnμnFj,jXnXn−wjn,wherePSX,jX;θn is used to adjust the shift amount of neuron weights and takes the value according to equation (19):
(19)PSX,iX;θn=exp−SX,iX22θ2n.The value of the coefficientP is large, so as to ensure that the winning neuron and its neighboring neurons move to the input city with a large displacement to achieve the purpose of local penetration. We refer to the area less than θ from the input city X as the infiltration area of the input city X.The TSP problem is different from the shortest path problem. Each local path in the global optimal path of the shortest path problem is locally optimal, but the local optimal path does not guarantee the global optimality of the solution. The TSP problem is much more complicated. Its global optimal path cannot guarantee the local optimality of its local path, and its local optimal path cannot guarantee the global optimality of the solution. This complexity of the TSP problem makes it a much more difficult problem than the shortest path problem: TSP has a computational complexity ofON−1!, and the shortest path problem does not exceed ON3 computational complexity, where N is the number of cities. To this end, we propose the following strategy for the TSP problem first overall optimization and then local optimization, and then local optimization is carried out on the basis of overall optimization, so that the overall optimization and local optimization are organically combined to find a learning mechanism for the global optimal solution. In order to realize this learning strategy, the penetration area should gradually expand from small to large with time. Here, we set the following:
(20)θn=θ011+exp−cn−12,where θ0 and c are constants. In this experiment, θ0=pq/4, c=1/2, pq, is a distance constant, and its value is selected as the diagonal length of the neuron initialization rectangle.In this way, the algorithm steps of our ORC_SOM algorithm for solving the TSP problem are as follows: (1) determine the number of neuronsM and distribute the neurons on the rectangular box outside the city in an orderly manner, (2) randomly takes a sample X from the input space as the input city, (3) determine the winning neuron X at time n according to equation (3), (4) update neuron weights by equation (18), where SX,jX;θn and μn are determined by equations (19) and (20) calculated, and (5) set n=n+1, continue (2)-(4) until the width of the neighborhood function σn≤1. The order determines the access path. If there are cities that are not mapped one by one, go back to (1) and increase the number of neurons M.The radius of the penetration area changes continuously with the operation of the algorithm. The radius is small at the beginning, which strengthens the overall competition, and the penetration radius gradually increases with the operation of the algorithm, thereby strengthening the local penetration. We introduce such a mechanism into SOM to achieve both overall competition and local penetration, first tending to overall competition and then local penetration, and local penetration based on overall competition, so as to achieve local optimization on the basis of overall optimization.


### 3.4. The Role of Blockchain

The food production in agriculture is potentially going to increase by almost 70% by 2050 due to almost 34% predicted increase in world population. Hence, the farmers would have to produce more food using limited food resources which creates lot of pressure to optimize productivity. The agriculture sector not only has the challenge to produce more food but it has issues pertinent to limitations in data collection, storing, securing, and sharing of data. Also, there are additional concerns relevant to climate change, increase in input prices, and the challenges of traditional food supply systems where there is almost negligible connection between the farmers and the buyers. The existing agriculture systems are based on IoT devices that follow centralized frameworks and operate in isolation. These types of frameworks have associated challenges pertinent to data security, manipulation, and single point of failure. The use of blockchain helps in addressing the aforementioned challenges. Blockchain is a distributed database system wherein the data are recorded and shared using a decentralized computational network ensuring privacy and security. The data can be accessed only by the owner who has the private key to perform the transactions. Due to the unique characteristics of blockchain, it contributes in exchanging accurate data between the supply chain stakeholders ensuring optimum security. The integration of IoT and blockchain in food supply management increases the overall visibility of the related products in the supply chain. The use of blockchain and IoT helps in monitoring and sensing of the authentic and fresh food items at its origin. It helps in identifying cases wherein farmers use harmful and hazardous chemicals, fertilizers, insecticides, and other related materials to improve productivity at the cost of health hazards. It would also help to identify perishable items which no longer can be consumed during the delivery or transition process.


## 3.1. Self-Organizing Mapping Neural Network

In this paper, the optimization problem of agricultural product distribution path is transformed into a combinatorial optimization problem. The traveling salesman problem (TSP) is one of the well-known combinatorial optimization problems. To study the TSP problem, we must first introduce the NP-complete problem. In computer science, all problems to be solved by computers can be divided into two categories:P and NP. Modern computer science is based on Turing machine theory. There are two types of Turing machines: deterministic and nondeterministic. Computer science study only includes issues that can be answered by Turing machines. Problems of P-type can be solved in polynomial time by a deterministic Turing computer, whereas problems of NP-type can be solved in polynomial time by a nondeterministic Turing machine. If one NP-complete problem has a polynomial-time solution, all other problems have polynomial-time algorithms. This is an important feature of NP-complete problems; that is, all NP-complete problems satisfy reflexivity, symmetry, and transitivity, and they belong to the same equivalence class. The TSP problem is a well-known NP-complete problem. If we solve the TSP problem, we can solve other NP-complete problems. This is the point of studying the TSP problem. The model used in this paper is a well-known ANN: the self-organizing map (SOM) neural network, which has a series of output neurons and input neurons, as shown in Figure 1.Figure 1
Self-organizing map network structure diagram.Neurons in a SOM are arranged on grid nodes, which are either one-dimensional or two-dimensional in nature. Higher dimension mappings are also feasible; although, they are not as frequent as lower-level mappings. In competitive learning, neuronal modifications are tailored to the specific input patterns that are being received. A meaningful coordinate system is generated for diverse input properties on the grid when the placements of neurons after correction are arranged with each other. As a result of this, the SOM network’s topological mapping structure is defined by its grid neurons’ spatial representations of input patterns’ fundamental statistical properties. An important property of the human brain is that distinct sensory inputs are represented by topologically ordered computational maps. SOM networks, as neural models, are inspired by this feature. There are four distinct areas of the human brain that receive sensory, tactile, visual, and auditory information in a topologically organized way. As a result, computational mapping is a fundamental component of the nervous system’s information processing architecture. Sensory inputs are processed in parallel by an array of neurons in a computational map. So, the neuron transforms the input signal into a probability distribution encoding the spatial position, the distribution representing the calculated value of the parameter by the position of the largest relevant activation in the map. In a SOM network, the location of neurons is very important. Each incoming piece of information is kept in its right position at each level of representation, and neurons that process strongly correlated bits of information are densely coupled, allowing them to communicate via short synaptic connections. There are three main processes in the formation of self-organizing networks, as follows:(1)
Competitive process: letm denote the dimension of the input space and randomly select the input mode from the input space as(1)X=x1,x1,⋯,xmT.The synaptic weight vector of each neuron in the network has the same dimension as the input space. The synaptic weight vector of neuronj is denoted as
(2)Wj=wj1,wj2,⋯,wjm,j=1,2,⋯,k,where k is the total number of neurons in the network.To find the best match of the input vectorX and the synaptic weights Wj, compare the inner products WjTX for j=1,2,⋯,k and choose the largest one. This assumes that all neurons have the same threshold, and the threshold makes the bias negative. In this way, by selecting the neuron with the largest inner product WjTX, we actually determine the location of the topological neighborhood center of the excitatory neuron. Using iX to identify the neuron that best matches the input vector X, we can determine iX by the following conditions:
(3)iX=argminX−Wj,j=1,2,⋯,k.This recapitulates the nature of the neuronal competition process. The particular neuroni that satisfies this condition is called the winning neuron of the input vector X.
(2)
Cooperation process: winning neurons are located in the center of the topological field of cooperating neurons, and a firing neuron tends to activate neurons in its immediate neighborhood rather than neurons farther away. LetFj,i denote the topological field centered on the winning neuron i. Let Si,j denote the lateral distance between winning neuron i and excitatory neuron j. Then, we can assume that the topological neighborhood Fj,i is a unimodal function of the lateral distance Si,j so that it satisfies two different requirements: one is that the topological neighborhood Fj,i is symmetric with respect to the maximum point defined by Si,j=0; that is, the maximum value is reached at the winning neuron i whose distance Si,j is zero. The second is that the amplitude value of the topological neighborhood Fj,i decreases monotonically with the increase of the lateral distance Si,j and tends to zero when Si,j⟶∞, which is a necessary condition for network convergence. A typical choice of an Fj,i satisfying these conditions is a Gaussian function(4)Fj,iX=exp−Sj,i22σ2.Equation (4) is translation invariant; that is, it does not depend on the position of the winning neuron. For the cooperation between the neighborhood function neurons, the topological domain function Fj,i must depend on the lateral distance Si,j of the winning neuron i and the excitatory neuron in the output space, rather than relying on some measure of the original input space. For a one-dimensional grid, it can be defined as follows:
(5)Si,j=j−i.On the other hand, in the case of a two-dimensional grid, it can be defined as(6)Si,j=hj−hi,where the discrete vector hj defines the position of excitatory neuron j and hi defines the position of winning neuron i, both measured in discrete output space.As the SOM method becomes better, the topological field gets smaller. The breadth of the topological domain functionFj,i must decrease with time to meet this condition. This is a common way of describing how a variable’s value changes over time:
(7)σn=σ0exp−nτ1,n=0,1,2,⋯,where σ0 is the initial value of σ in the SOM algorithm, and τ1 is the time constant. In this way, the assumed form of the topological neighborhood has a time-varying form, which is expressed as follows:
(8)Fj,iXn=exp−−Sj,i22σ2n,n=0,1,2,⋯,.(3)
Adaptive process: in order to make the network self-organizing, the synaptic weight vectorWj of neuron j is required to change with the input vector X. By setting a scalar function gyj and requiring g0=0, the weight vector change of neuron j in the grid can be expressed as followsThe input vectorX must affect the synaptic weight vector Wj of neuron j in order for the network to self-organize. Neuron j’s weight change may be described in terms of a scalar function gyj and the g0=0 condition.
(9)ΔWj=μyjX−gyjWj,where μ is the learning rate parameter of the algorithm, gyjWj is the forgetting term, and gyj can be selected as a linear function:
(10)gyj=μyj.Simplifyyj to the following form:
(11)yj=Fj,iXand further get(12)ΔWj=μFj,iXX−Wj.Finally, using the discrete-time form, assuming that the weight vector of neuronj at time n is Wjn, the update weight vector Wjn+1 at time n+1 is defined as
(13)Wjn+1=Wjn+μnFj,iXnX−Wjn.Equation (13) has a tendency to move the synaptic weight vector Wi of neuron i to the input vector X. The neighborhood update makes the synaptic weight vector follow the distribution of the input vector when the training data recurs. As a consequence, the feature mappings in the input space are ordered topologically by the algorithm, resulting in identical synaptic weight vectors for nearby neurons in the grid.In the above equation, the learning rate parametern becomes a function μn that changes with time, which is the requirement of random approximation. It should start from the initial value of μ0 and then gradually decrease with increasing time n. μn can be chosen to be expressed as follows:
(14)μn=μ0exp−nτ2,n=0,1,2,⋯,where τ2 is a time constant of the SOM algorithm.Self-organizing maps (SOM) are one of the most predominantly used artificial neural network (ANN) models. This technique has been used popularly in agriculture sector. As an example, the study in [32] implemented SOM for classifying the influential factors of soil fertility. The study in [33] implemented Kohonen Self Organizing Feature Maps (SOFM) to analyze the effect of various soil properties that impacted the chemical and hydraulic processes in the soil. SOM was also used to predict the crop water stress index (CWSI) based on various precision agricultural variables, namely, the microclimatic variables, air temperature, canopy temperature, and relative humidity [34].


## 3.2. Classical SOM Algorithm for Solving TSP

### 3.2.1. Kohonen Network Incorporating Explicit Statistics

The Kohonen network incorporating explicit statistics (KNIES) method takes full advantage of statistics. The network consists of a fixed number ofM neurons, and the input of the network is the coordinates of each city node, which belongs to the set P. The city nodes are mapped to the neurons of the ring structure, and the order of the neurons in the ring represents the order of the city nodes traversal. Since KNIES makes full use of the advantages of SOM, it can maintain the neighborhood structure between city nodes. The city nodes in the Kohonen network are first arranged in random order and then iteratively updated according to a certain method until a certain convergence criterion is satisfied.In each iteration, for the input city nodei in the set P, the neuron j∗ is the closest to i; then, j is the winning neuron. Some other neurons close to the neuron j∗ on the ring network together with j∗ form a set Dj∗t, where t is the number of iterations. Each neuron in Dj∗t moves to city node i according to equation (15):
(15)Yjt+1=Yjt+ψj,j∗Xi−Yjt,ifj∈Dj∗tYjt,otherwise,where Xi represents the coordinates of city node i, Yjt represents the coordinates of neuron j in the t-th iteration, and Dj∗t consists of the neighborhood of neuron j∗. ψ is a Gaussian kernel function, which is defined by function ψ, and each neuron can be updated with different weights in each iteration. Among them, the weights can be set to 0 for neurons that are not in the set Dj∗t. The disadvantage of Kohonen network is that it relies too much on the Gaussian kernel function variance, if the variance of the Gaussian kernel function is too large, and the algorithm will converge too slowly; on the contrary, if the variance of ψ is too large, the algorithm will converge too fast; so, the found solution is quite different from the optimal solution.Although the overall effect of SOM obeys a certain distribution, there is still a lot of useful information that is not used. In fact, in each iteration, the SOM ignores the statistics of data points that have already participated in the operation. Since statistics such as variance and mean of data points can be easily calculated, the SOM algorithm can be improved to take advantage of not only the information provided by the data points but also the statistical information of the data points. In other words, in each iteration, both the local information of the current data point and the global information of the potential data setP are used.


### 3.2.2. Expanding SOM

The basic idea of “Expanding SOM” (ESOM) is to include the convex hull property in the computational rules with little computational cost. As the topological neighborhoods of city nodes are found and saved, the convex hull property of the city node set can be obtained. ESOM tries to satisfy the sufficient and necessary conditions for the optimal path, in each iteration, in addition to maintaining the convex hull property and in addition to keeping the activation neuron moving towards the input city node.


### 3.2.3. Constructive-Optimizer Neural Network

Constructive-optimizer neural network (CONN) is a novel construction optimization neural network, which is also used to solve the TSP problem. The CONN algorithm consists of two parts, the construction part used to generate the TSP path and the optimization part used to optimize the path. The training process of the algorithm is as follows: (1) initialize a path, (2) add some cities to build a TSP path, (3) optimize this path through the optimizer, (4) when the algorithm conforms to the convergence rule and rejoin cities during go to build, and (5) the training is over until all cities have joined in.


### 3.2.4. SOM Efficiently Applied to the TSP

The work of SOM efficiently applied to the TSP (SETSP) algorithm mainly focuses on introducing efficient neuron initialization method, learning rate parameter functionμn, and lateral distance σn. Its initialization method is at the beginning, and the neurons are distributed evenly and orderly on the rectangular box around the city point. The significance of this initialization method is that from the very beginning, the distribution of neurons in the input space is consistent with the topological neighborhood relationship in the output space; thus, the intermediate transformation process from disorder to order is avoided, and the efficiency of neuron learning is improved. As for the shape of the initial arrangement, it does not matter, and the ESOM to be introduced below uses a circular frame. The learning rate parameter function μn and the lateral distance function σn of SETSP are as follows:
(16)μn=1n3,σn=σn−1×1−0.01×n.The equation for the value ofσ0 is as follows:
(17)σ0=k4×b,where the parameter b is a constant representing the length of the diagonal of the rectangle.The effectiveness of the SETSP method has been confirmed, and its solution accuracy is generally higher than that of the KNIES method. Due to the relatively large initial value of the learning rate and the lateral distance function and the randomness of the city input order of the SOM algorithm, the fluctuations between the different operating results of the SETSP algorithm may be relatively large. SETSP does not use any neuron addition or deletion mechanism. It fixes the number of neurons to a constant larger than the number of cities. Experiments show that this method can also effectively solve the resolution problem in SOM density matching. However, the quality of the solution of SETSP depends on another disadvantage of this algorithm is the choice of the number of neurons to be initialized.


## 3.2.1. Kohonen Network Incorporating Explicit Statistics

The Kohonen network incorporating explicit statistics (KNIES) method takes full advantage of statistics. The network consists of a fixed number ofM neurons, and the input of the network is the coordinates of each city node, which belongs to the set P. The city nodes are mapped to the neurons of the ring structure, and the order of the neurons in the ring represents the order of the city nodes traversal. Since KNIES makes full use of the advantages of SOM, it can maintain the neighborhood structure between city nodes. The city nodes in the Kohonen network are first arranged in random order and then iteratively updated according to a certain method until a certain convergence criterion is satisfied.In each iteration, for the input city nodei in the set P, the neuron j∗ is the closest to i; then, j is the winning neuron. Some other neurons close to the neuron j∗ on the ring network together with j∗ form a set Dj∗t, where t is the number of iterations. Each neuron in Dj∗t moves to city node i according to equation (15):
(15)Yjt+1=Yjt+ψj,j∗Xi−Yjt,ifj∈Dj∗tYjt,otherwise,where Xi represents the coordinates of city node i, Yjt represents the coordinates of neuron j in the t-th iteration, and Dj∗t consists of the neighborhood of neuron j∗. ψ is a Gaussian kernel function, which is defined by function ψ, and each neuron can be updated with different weights in each iteration. Among them, the weights can be set to 0 for neurons that are not in the set Dj∗t. The disadvantage of Kohonen network is that it relies too much on the Gaussian kernel function variance, if the variance of the Gaussian kernel function is too large, and the algorithm will converge too slowly; on the contrary, if the variance of ψ is too large, the algorithm will converge too fast; so, the found solution is quite different from the optimal solution.Although the overall effect of SOM obeys a certain distribution, there is still a lot of useful information that is not used. In fact, in each iteration, the SOM ignores the statistics of data points that have already participated in the operation. Since statistics such as variance and mean of data points can be easily calculated, the SOM algorithm can be improved to take advantage of not only the information provided by the data points but also the statistical information of the data points. In other words, in each iteration, both the local information of the current data point and the global information of the potential data setP are used.


## 3.2.2. Expanding SOM

The basic idea of “Expanding SOM” (ESOM) is to include the convex hull property in the computational rules with little computational cost. As the topological neighborhoods of city nodes are found and saved, the convex hull property of the city node set can be obtained. ESOM tries to satisfy the sufficient and necessary conditions for the optimal path, in each iteration, in addition to maintaining the convex hull property and in addition to keeping the activation neuron moving towards the input city node.


## 3.2.3. Constructive-Optimizer Neural Network

Constructive-optimizer neural network (CONN) is a novel construction optimization neural network, which is also used to solve the TSP problem. The CONN algorithm consists of two parts, the construction part used to generate the TSP path and the optimization part used to optimize the path. The training process of the algorithm is as follows: (1) initialize a path, (2) add some cities to build a TSP path, (3) optimize this path through the optimizer, (4) when the algorithm conforms to the convergence rule and rejoin cities during go to build, and (5) the training is over until all cities have joined in.


## 3.2.4. SOM Efficiently Applied to the TSP

The work of SOM efficiently applied to the TSP (SETSP) algorithm mainly focuses on introducing efficient neuron initialization method, learning rate parameter functionμn, and lateral distance σn. Its initialization method is at the beginning, and the neurons are distributed evenly and orderly on the rectangular box around the city point. The significance of this initialization method is that from the very beginning, the distribution of neurons in the input space is consistent with the topological neighborhood relationship in the output space; thus, the intermediate transformation process from disorder to order is avoided, and the efficiency of neuron learning is improved. As for the shape of the initial arrangement, it does not matter, and the ESOM to be introduced below uses a circular frame. The learning rate parameter function μn and the lateral distance function σn of SETSP are as follows:
(16)μn=1n3,σn=σn−1×1−0.01×n.The equation for the value ofσ0 is as follows:
(17)σ0=k4×b,where the parameter b is a constant representing the length of the diagonal of the rectangle.The effectiveness of the SETSP method has been confirmed, and its solution accuracy is generally higher than that of the KNIES method. Due to the relatively large initial value of the learning rate and the lateral distance function and the randomness of the city input order of the SOM algorithm, the fluctuations between the different operating results of the SETSP algorithm may be relatively large. SETSP does not use any neuron addition or deletion mechanism. It fixes the number of neurons to a constant larger than the number of cities. Experiments show that this method can also effectively solve the resolution problem in SOM density matching. However, the quality of the solution of SETSP depends on another disadvantage of this algorithm is the choice of the number of neurons to be initialized.


## 3.3. Overall-Regional Competitive for the TSP SOM

### 3.3.1. Generalization Competition Mechanism and Local Penetration Mechanism

Overall-regional competition for the TSP SOM is referred to as ORC_SOM. In fact, the process of solving the TSP problem with the standard SOM algorithm is as follows: the position of the neuron is randomly initialized, and the winning neuron is continuously stimulated by the real city. The neuron continuously moves to the real city according to the learning algorithm and finally converges until the position of the neuron no longer moves. However, such a learning process can only obtain the overall optimal solution of the original TSP problem, not the global optimal solution. In order to obtain the optimal solution to the real urban TSP problem as much as possible, two new learning mechanisms, generalized competition and local penetration, are proposed and integrated into the standard SOM learning algorithm. From the solution requirements of the TSP problem, when the distance between the input city and the winning neuron is large, the displacement of the winning neuron and its neighboring neurons to the input city should be reduced, thereby allowing each neuron to compete more fairly, and we call this mechanism the generalized competition mechanism. When the distance between the input city and the winning neuron is small, the displacement of the winning neuron and its neighboring neurons to the input city should be increased, thereby weakening the competition of other neurons for the current input city and strengthening the winning neuron and its neighboring neurons compete for the current input city, and we call this mechanism a local penetration mechanism. The reduction or increase of the above displacement is relative to the standard SOM algorithm. Generalization competition is a mechanism that makes each neuron in a fairer competition, while local penetration is a mechanism that makes the winning neuron and its neighboring neurons have a better local competition ability. The former strengthens the overall optimization, and the latter strengthens local optimization. In order to realize the generalization competition and local penetration mechanism, we introduce the penetration radiusθ as the judgment threshold of the distance between the input city and the winning neuron. Once the distance between them is greater than θ, the generalization competition mechanism is adopted; otherwise, the local penetration mechanism is adopted. To do this, adjust the shift of the neuron to the input city as follows:
(18)wjn+1=wjn+PSX,jX;θnμnFj,jXnXn−wjn,wherePSX,jX;θn is used to adjust the shift amount of neuron weights and takes the value according to equation (19):
(19)PSX,iX;θn=exp−SX,iX22θ2n.The value of the coefficientP is large, so as to ensure that the winning neuron and its neighboring neurons move to the input city with a large displacement to achieve the purpose of local penetration. We refer to the area less than θ from the input city X as the infiltration area of the input city X.The TSP problem is different from the shortest path problem. Each local path in the global optimal path of the shortest path problem is locally optimal, but the local optimal path does not guarantee the global optimality of the solution. The TSP problem is much more complicated. Its global optimal path cannot guarantee the local optimality of its local path, and its local optimal path cannot guarantee the global optimality of the solution. This complexity of the TSP problem makes it a much more difficult problem than the shortest path problem: TSP has a computational complexity ofON−1!, and the shortest path problem does not exceed ON3 computational complexity, where N is the number of cities. To this end, we propose the following strategy for the TSP problem first overall optimization and then local optimization, and then local optimization is carried out on the basis of overall optimization, so that the overall optimization and local optimization are organically combined to find a learning mechanism for the global optimal solution. In order to realize this learning strategy, the penetration area should gradually expand from small to large with time. Here, we set the following:
(20)θn=θ011+exp−cn−12,where θ0 and c are constants. In this experiment, θ0=pq/4, c=1/2, pq, is a distance constant, and its value is selected as the diagonal length of the neuron initialization rectangle.In this way, the algorithm steps of our ORC_SOM algorithm for solving the TSP problem are as follows: (1) determine the number of neuronsM and distribute the neurons on the rectangular box outside the city in an orderly manner, (2) randomly takes a sample X from the input space as the input city, (3) determine the winning neuron X at time n according to equation (3), (4) update neuron weights by equation (18), where SX,jX;θn and μn are determined by equations (19) and (20) calculated, and (5) set n=n+1, continue (2)-(4) until the width of the neighborhood function σn≤1. The order determines the access path. If there are cities that are not mapped one by one, go back to (1) and increase the number of neurons M.The radius of the penetration area changes continuously with the operation of the algorithm. The radius is small at the beginning, which strengthens the overall competition, and the penetration radius gradually increases with the operation of the algorithm, thereby strengthening the local penetration. We introduce such a mechanism into SOM to achieve both overall competition and local penetration, first tending to overall competition and then local penetration, and local penetration based on overall competition, so as to achieve local optimization on the basis of overall optimization.


## 3.3.1. Generalization Competition Mechanism and Local Penetration Mechanism

Overall-regional competition for the TSP SOM is referred to as ORC_SOM. In fact, the process of solving the TSP problem with the standard SOM algorithm is as follows: the position of the neuron is randomly initialized, and the winning neuron is continuously stimulated by the real city. The neuron continuously moves to the real city according to the learning algorithm and finally converges until the position of the neuron no longer moves. However, such a learning process can only obtain the overall optimal solution of the original TSP problem, not the global optimal solution. In order to obtain the optimal solution to the real urban TSP problem as much as possible, two new learning mechanisms, generalized competition and local penetration, are proposed and integrated into the standard SOM learning algorithm. From the solution requirements of the TSP problem, when the distance between the input city and the winning neuron is large, the displacement of the winning neuron and its neighboring neurons to the input city should be reduced, thereby allowing each neuron to compete more fairly, and we call this mechanism the generalized competition mechanism. When the distance between the input city and the winning neuron is small, the displacement of the winning neuron and its neighboring neurons to the input city should be increased, thereby weakening the competition of other neurons for the current input city and strengthening the winning neuron and its neighboring neurons compete for the current input city, and we call this mechanism a local penetration mechanism. The reduction or increase of the above displacement is relative to the standard SOM algorithm. Generalization competition is a mechanism that makes each neuron in a fairer competition, while local penetration is a mechanism that makes the winning neuron and its neighboring neurons have a better local competition ability. The former strengthens the overall optimization, and the latter strengthens local optimization. In order to realize the generalization competition and local penetration mechanism, we introduce the penetration radiusθ as the judgment threshold of the distance between the input city and the winning neuron. Once the distance between them is greater than θ, the generalization competition mechanism is adopted; otherwise, the local penetration mechanism is adopted. To do this, adjust the shift of the neuron to the input city as follows:
(18)wjn+1=wjn+PSX,jX;θnμnFj,jXnXn−wjn,wherePSX,jX;θn is used to adjust the shift amount of neuron weights and takes the value according to equation (19):
(19)PSX,iX;θn=exp−SX,iX22θ2n.The value of the coefficientP is large, so as to ensure that the winning neuron and its neighboring neurons move to the input city with a large displacement to achieve the purpose of local penetration. We refer to the area less than θ from the input city X as the infiltration area of the input city X.The TSP problem is different from the shortest path problem. Each local path in the global optimal path of the shortest path problem is locally optimal, but the local optimal path does not guarantee the global optimality of the solution. The TSP problem is much more complicated. Its global optimal path cannot guarantee the local optimality of its local path, and its local optimal path cannot guarantee the global optimality of the solution. This complexity of the TSP problem makes it a much more difficult problem than the shortest path problem: TSP has a computational complexity ofON−1!, and the shortest path problem does not exceed ON3 computational complexity, where N is the number of cities. To this end, we propose the following strategy for the TSP problem first overall optimization and then local optimization, and then local optimization is carried out on the basis of overall optimization, so that the overall optimization and local optimization are organically combined to find a learning mechanism for the global optimal solution. In order to realize this learning strategy, the penetration area should gradually expand from small to large with time. Here, we set the following:
(20)θn=θ011+exp−cn−12,where θ0 and c are constants. In this experiment, θ0=pq/4, c=1/2, pq, is a distance constant, and its value is selected as the diagonal length of the neuron initialization rectangle.In this way, the algorithm steps of our ORC_SOM algorithm for solving the TSP problem are as follows: (1) determine the number of neuronsM and distribute the neurons on the rectangular box outside the city in an orderly manner, (2) randomly takes a sample X from the input space as the input city, (3) determine the winning neuron X at time n according to equation (3), (4) update neuron weights by equation (18), where SX,jX;θn and μn are determined by equations (19) and (20) calculated, and (5) set n=n+1, continue (2)-(4) until the width of the neighborhood function σn≤1. The order determines the access path. If there are cities that are not mapped one by one, go back to (1) and increase the number of neurons M.The radius of the penetration area changes continuously with the operation of the algorithm. The radius is small at the beginning, which strengthens the overall competition, and the penetration radius gradually increases with the operation of the algorithm, thereby strengthening the local penetration. We introduce such a mechanism into SOM to achieve both overall competition and local penetration, first tending to overall competition and then local penetration, and local penetration based on overall competition, so as to achieve local optimization on the basis of overall optimization.


## 3.4. The Role of Blockchain

The food production in agriculture is potentially going to increase by almost 70% by 2050 due to almost 34% predicted increase in world population. Hence, the farmers would have to produce more food using limited food resources which creates lot of pressure to optimize productivity. The agriculture sector not only has the challenge to produce more food but it has issues pertinent to limitations in data collection, storing, securing, and sharing of data. Also, there are additional concerns relevant to climate change, increase in input prices, and the challenges of traditional food supply systems where there is almost negligible connection between the farmers and the buyers. The existing agriculture systems are based on IoT devices that follow centralized frameworks and operate in isolation. These types of frameworks have associated challenges pertinent to data security, manipulation, and single point of failure. The use of blockchain helps in addressing the aforementioned challenges. Blockchain is a distributed database system wherein the data are recorded and shared using a decentralized computational network ensuring privacy and security. The data can be accessed only by the owner who has the private key to perform the transactions. Due to the unique characteristics of blockchain, it contributes in exchanging accurate data between the supply chain stakeholders ensuring optimum security. The integration of IoT and blockchain in food supply management increases the overall visibility of the related products in the supply chain. The use of blockchain and IoT helps in monitoring and sensing of the authentic and fresh food items at its origin. It helps in identifying cases wherein farmers use harmful and hazardous chemicals, fertilizers, insecticides, and other related materials to improve productivity at the cost of health hazards. It would also help to identify perishable items which no longer can be consumed during the delivery or transition process.


## 4. Experiment and Analysis

### 4.1. Data Sources and Experimental Algorithms

The content of this section is to verify the feasibility, effectiveness, and robustness of the algorithm in this paper through a series of experiments. In addition, in order to prove the effectiveness of this algorithm, this chapter also compares the experimental results with other algorithms. The algorithms involved in the comparison are ESOM and KNIES, respectively. All data are two-dimensional plane data, and the distance between points is two-dimensional Euclidean distance. These points form an undirected complete graph. In order to be able to compare the performance of each algorithm, for some TSP data for which the optimal path and optimal path length have been found, we define the concept of the optimal deviation rate:(21)OPR=RPL−OPLOPL×100%,where OPR is the optimal deviation rate, RPL is the resulting path length, and OPL is the optimal path length.It can be seen from equation (21) that when the optimal path length is determined, the length of the obtained path determines the size of the deviation from the optimal rate, and the size of the deviation from the optimal rate accurately defines the pros and cons of the found path. The smaller the value of the deviation from the optimal rate, the better the path found and the better the algorithm; the larger the value of the deviation from the optimal rate, the worse the path found and the worse the performance of the algorithm. The data of this experiment is the commonly used data in the TSPLIB database.Although the data used in the study is an experimental data, but in real time, sensors can be used which would provide information pertinent to temperature and hydration level of the product indicating its freshness. The potential food products which are prone to loose freshness could be identified based on the sensor based indications generated. The data collected from these IoT devices could be used for future predictive analysis relevant to food distribution.


### 4.2. Experiments on Optimal Deviation Rate and Running Time

It recorded the results of each experiment and then averaged the deviation from optimal rate for 100 experiments with the same method on the same data. Table1 records the average deviation from the optimal rate of various methods for different data. From Table 1, we can see that for the small-scale TSP experimental data, only the ESOM algorithm is more prominent, and the deviation rates of KNIES and ORC_SOM are not much different. But once the scale of the experimental data is relatively large, the ORC_SOM algorithm has the lowest deviation from the optimal rate. This shows that for medium and large-scale TSP problems, the ORC_SOM algorithm is indeed easier to find the global optimal path. The optimal deviation rate is only one criterion we evaluate the performance of the algorithm, and the other evaluation criterion is the running time of the program. Table 2 is the statistics of the average running time of 100 experiments with different data of various algorithms, among which the bold is the shortest time. From Table 2, we can see that when the size of the data is greater than or equal to 783, ORC_SOM has the smallest running time.Table 1
Optimal deviation rate of various algorithms.
Instance nameCity sizeKNIES (%)ESOM (%)ORC_SOM (%)eil51.tsp512.922.273.28st70.tsp702.472.142.35rd100.tsp1002.672.253.98pr124.tsp1244.153.862.93rat195.tsp19512.198.356.67lin318.tsp3187.235.194.86rat783.tsp78314.3610.265.21d1291.tsp129110.158.117.97vm174817488.957.746.64u1817.tsp18179.297.767.45Table 2
Average running time of various algorithms.
Instance nameCity sizeKNIESESOMORC_SOMeil51.tsp510.750.690.81st70.tsp701.261.241.42rd100.tsp1002.913.123.08pr124.tsp1246.386.556.73rat195.tsp19521.0525.4825.37lin318.tsp31831.3736.7937.25rat783.tsp783115.46120.28112.59d1291.tsp1291248.59240.21216.78vm17481748472.65508.97408.32u1817.Tsp1817536.87582.56487.75In order to visually compare the performance of various algorithms, we made a graph for comparison. Figure2 is the performance curve diagram of the optimal offset rate under the best case of various algorithms; Figure 3 is the performance curve diagram of the program running time under the average situation of various algorithms.Figure 2
The optimal deviation rate performance curve of each algorithm.Figure 3
The running time performance curve of each algorithm.It can be found from Figure2 that when the TSP data size is greater than or equal to 500, compared with the other two algorithms, ORC_SOM has the smallest optimal deviation rate. It can be found from Figure 3 that when the TSP data size is less than or equal to 1000, the running times of various algorithms are very close. And when the TSP data size is greater than 1000, the ORC_SOM algorithm has the smallest running time, showing its own advantages. After the above comparison, it is not difficult to find that for small-scale TSP data, ORC_SOM has no outstanding features compared to other algorithms, while for larger-scale data, ORC_SOM can not only find a good path but also has a relatively small running time. This is the advantage of ORC_ROM, as well as the generalization competition mechanism and the local penetration mechanism.


### 4.3. Randomly Distributed Data Experiments

In order to examine the effectiveness of ORC_SOM from multiple perspectives, we not only conducted corresponding experiments with the data provided by TSPLIB but also randomly generated some points in a unit rectangle and used these two-dimensional points to simulate the TSP data. Find an optimal path among these points and judge the performance of the algorithm by comparing the length of the optimal path. In this experiment, a total of 10 randomly generated data, the data scale is from 100 to 1900, and the size of the data scale constitutes an arithmetic sequence with a tolerance of 200. Since the data is randomly generated, we do not know its optimal path length, but this does not prevent us from making comparisons between algorithms, as we can compare the performance of algorithms based on the path lengths found. Figure4 shows the performance curves of ORC_SOM and the other two algorithms.Figure 4
Optimal path performance curve for randomly generated data.Correspondingly, we also give a comparison of the running time of various algorithm implementations. Figure5 shows the time performance curves of ORC_SOM and the other two algorithms.Figure 5
Average running time performance curve for randomly generated data.It can be found from Figure4 that when the TSP data size is greater than or equal to 500, compared to the other two algorithms, ORC_SOM has the smallest optimal deviation rate. It can be found from Figure 5 that when the TSP data size is less than or equal to 500, the running times of various algorithms are very close, and when the TSP data size is greater than 500, the ORC_SOM algorithm has the smallest running time, showing its own advantages. Through the above experiments, we can see that for small-scale TSP data, ORC_SOM does not play its own advantages compared to other algorithms, while for larger-scale data, ORC_SOM can not only find a good path but also has a relatively small operation time. After the above comparison, it is not difficult to find that for larger-scale TSP data, ORC_ROM has better time performance and the optimal deviation rate. This further verifies the conclusion that the ORC_SOM algorithm has better results in solving medium and large-scale TSP problems.


## 4.1. Data Sources and Experimental Algorithms

The content of this section is to verify the feasibility, effectiveness, and robustness of the algorithm in this paper through a series of experiments. In addition, in order to prove the effectiveness of this algorithm, this chapter also compares the experimental results with other algorithms. The algorithms involved in the comparison are ESOM and KNIES, respectively. All data are two-dimensional plane data, and the distance between points is two-dimensional Euclidean distance. These points form an undirected complete graph. In order to be able to compare the performance of each algorithm, for some TSP data for which the optimal path and optimal path length have been found, we define the concept of the optimal deviation rate:(21)OPR=RPL−OPLOPL×100%,where OPR is the optimal deviation rate, RPL is the resulting path length, and OPL is the optimal path length.It can be seen from equation (21) that when the optimal path length is determined, the length of the obtained path determines the size of the deviation from the optimal rate, and the size of the deviation from the optimal rate accurately defines the pros and cons of the found path. The smaller the value of the deviation from the optimal rate, the better the path found and the better the algorithm; the larger the value of the deviation from the optimal rate, the worse the path found and the worse the performance of the algorithm. The data of this experiment is the commonly used data in the TSPLIB database.Although the data used in the study is an experimental data, but in real time, sensors can be used which would provide information pertinent to temperature and hydration level of the product indicating its freshness. The potential food products which are prone to loose freshness could be identified based on the sensor based indications generated. The data collected from these IoT devices could be used for future predictive analysis relevant to food distribution.


## 4.2. Experiments on Optimal Deviation Rate and Running Time

It recorded the results of each experiment and then averaged the deviation from optimal rate for 100 experiments with the same method on the same data. Table1 records the average deviation from the optimal rate of various methods for different data. From Table 1, we can see that for the small-scale TSP experimental data, only the ESOM algorithm is more prominent, and the deviation rates of KNIES and ORC_SOM are not much different. But once the scale of the experimental data is relatively large, the ORC_SOM algorithm has the lowest deviation from the optimal rate. This shows that for medium and large-scale TSP problems, the ORC_SOM algorithm is indeed easier to find the global optimal path. The optimal deviation rate is only one criterion we evaluate the performance of the algorithm, and the other evaluation criterion is the running time of the program. Table 2 is the statistics of the average running time of 100 experiments with different data of various algorithms, among which the bold is the shortest time. From Table 2, we can see that when the size of the data is greater than or equal to 783, ORC_SOM has the smallest running time.Table 1
Optimal deviation rate of various algorithms.
Instance nameCity sizeKNIES (%)ESOM (%)ORC_SOM (%)eil51.tsp512.922.273.28st70.tsp702.472.142.35rd100.tsp1002.672.253.98pr124.tsp1244.153.862.93rat195.tsp19512.198.356.67lin318.tsp3187.235.194.86rat783.tsp78314.3610.265.21d1291.tsp129110.158.117.97vm174817488.957.746.64u1817.tsp18179.297.767.45Table 2
Average running time of various algorithms.
Instance nameCity sizeKNIESESOMORC_SOMeil51.tsp510.750.690.81st70.tsp701.261.241.42rd100.tsp1002.913.123.08pr124.tsp1246.386.556.73rat195.tsp19521.0525.4825.37lin318.tsp31831.3736.7937.25rat783.tsp783115.46120.28112.59d1291.tsp1291248.59240.21216.78vm17481748472.65508.97408.32u1817.Tsp1817536.87582.56487.75In order to visually compare the performance of various algorithms, we made a graph for comparison. Figure2 is the performance curve diagram of the optimal offset rate under the best case of various algorithms; Figure 3 is the performance curve diagram of the program running time under the average situation of various algorithms.Figure 2
The optimal deviation rate performance curve of each algorithm.Figure 3
The running time performance curve of each algorithm.It can be found from Figure2 that when the TSP data size is greater than or equal to 500, compared with the other two algorithms, ORC_SOM has the smallest optimal deviation rate. It can be found from Figure 3 that when the TSP data size is less than or equal to 1000, the running times of various algorithms are very close. And when the TSP data size is greater than 1000, the ORC_SOM algorithm has the smallest running time, showing its own advantages. After the above comparison, it is not difficult to find that for small-scale TSP data, ORC_SOM has no outstanding features compared to other algorithms, while for larger-scale data, ORC_SOM can not only find a good path but also has a relatively small running time. This is the advantage of ORC_ROM, as well as the generalization competition mechanism and the local penetration mechanism.


## 4.3. Randomly Distributed Data Experiments

In order to examine the effectiveness of ORC_SOM from multiple perspectives, we not only conducted corresponding experiments with the data provided by TSPLIB but also randomly generated some points in a unit rectangle and used these two-dimensional points to simulate the TSP data. Find an optimal path among these points and judge the performance of the algorithm by comparing the length of the optimal path. In this experiment, a total of 10 randomly generated data, the data scale is from 100 to 1900, and the size of the data scale constitutes an arithmetic sequence with a tolerance of 200. Since the data is randomly generated, we do not know its optimal path length, but this does not prevent us from making comparisons between algorithms, as we can compare the performance of algorithms based on the path lengths found. Figure4 shows the performance curves of ORC_SOM and the other two algorithms.Figure 4
Optimal path performance curve for randomly generated data.Correspondingly, we also give a comparison of the running time of various algorithm implementations. Figure5 shows the time performance curves of ORC_SOM and the other two algorithms.Figure 5
Average running time performance curve for randomly generated data.It can be found from Figure4 that when the TSP data size is greater than or equal to 500, compared to the other two algorithms, ORC_SOM has the smallest optimal deviation rate. It can be found from Figure 5 that when the TSP data size is less than or equal to 500, the running times of various algorithms are very close, and when the TSP data size is greater than 500, the ORC_SOM algorithm has the smallest running time, showing its own advantages. Through the above experiments, we can see that for small-scale TSP data, ORC_SOM does not play its own advantages compared to other algorithms, while for larger-scale data, ORC_SOM can not only find a good path but also has a relatively small operation time. After the above comparison, it is not difficult to find that for larger-scale TSP data, ORC_ROM has better time performance and the optimal deviation rate. This further verifies the conclusion that the ORC_SOM algorithm has better results in solving medium and large-scale TSP problems.


## 5. Conclusion

At present, the application of the IoT in agriculture in my country is relatively small, because some technologies of the IoT are still relatively immature, However, from the application of IoT technology in agricultural logistics in developed countries in Europe and the United States, IoT technology adoption in agricultural logistics is clearly viable and will undoubtedly be the future path of growth in the future. Blockchain technology and the IoT will allow farmers and agricultural product suppliers alike to better meet the needs of agricultural informatics, allowing for a more efficient and effective flow of agricultural products, as well as a greater impact on the interests of all participants in the supply chain. IoT and neural network technology can be used to better understand how IoT technology can be used in agriculture, and it can also have a positive impact on the distribution path of agricultural products. The main contents of this paper are as follows: (1) a general description of the traditional agricultural product distribution process and exploration and research on the shortcomings and problems existing in the traditional mode. How to use the current popular technology to apply to the process of agricultural product distribution is as follows: (2) define the TSP problem, then introduce some commonly used algorithms to solve the TSP problem, and then introduce the related theories and methods of the SOM neural network and the basic principle of the ORC_SOM algorithm in detail. (3) Through a large number of experiments, the results prove the validity of the algorithm in this paper and the rationality of the theory. When the size of TSP data is large, ORC_SOM shows better performance, both in terms of the found loop length and program running time, and ORC_SOM is better than KNIES and ESOM algorithms.



---

*Source: 5106215-2022-06-28.xml*