# Low-Carbon Logistics Distribution Vehicle Routing Optimization Based on INNC-GA
## 4 INNC-GA
### Innc-Ga  
In some instances, when implementing a genetic algorithm, the conventional NNC method is used to start the population. Despite multiple generations of iteration, the constraints continue to be violated, preventing the attainment of the optimal solution. To tackle this challenge, a modification is made to the traditional NNC method, resulting in the introduction of the INNC method for initializing the genetic algorithm population. The workflow diagram of the INNC-GA can be seen in Figure 1.  
(1) Coding  
Common chromosome encoding methods include binary encoding, decimal encoding, integer encoding, etc. Because integer encoding directly represents the order in the path using integers, it is easier to understand and implement, and is more advantageous for solving vehicle routing problems. In this paper, integer encoding is used to encode the chromosome. Assuming the number of customers to be served is N and the maximum number of vehicles used by the distribution center is K, where 0 represents the distribution center, the chromosome length is N + K\(-\)1. For example, if a chromosome is given as 0 5 3 6 7 0 1 2 8 9 0, it represents the following:  
Path 1: 0-5-3-6-7-0,  
Path 2: 0-1-2-8-9-0. (2) Initialization of the population  
Figure 1: Workflow diagram. In genetic algorithms, population initialization is a critical factor that influences the algorithm's performance and convergence speed. Two important considerations in population initialization are determining the population size and generating initial solutions. The choice of population size significantly impacts the algorithm's performance. A larger population size in a complex solution space usually results in higher diversity within the population but requires more computational resources. On the other hand, a smaller population size may lead to premature convergence, trapping the algorithm in a local optimum. The initial solutions are crucial for initializing the population. This study utilizes the Improved Nearest Neighbor Chain (NNC) algorithm to generate a set of high-quality feasible solutions, aiming to enhance the quality and feasibility of the initial population and improve the overall performance of the genetic algorithm. (3) Fitness Function  
The fitness function is a key determinant of an individual or solution's quality, playing a vital role in selecting individuals with higher evolutionary potential. This process directs the algorithm towards achieving a better solution for the problem at hand. In the context of the vehicle routing problem with time windows, it is essential to adhere to time window constraints. To tackle the risk of violating these constraints, a penalty function is used in this study to meet customer demands [19]. The formula for this penalty function is detailed below. \[F=T+mq(s)+nw(s) \tag{16}\]  
where \(F\) is the penalty function, \(T\) is the total cost incurred in the distribution process, \(q(s)\) is the sum of load constraints violated for each path, and \(w(s)\) is the sum of time window violations. n is set to be larger, and m is set to be relatively small because the VRPTW problem is more likely to violate time window constraints than load constraints. The advantage of the objective function utilized in this study lies in its ability to minimize total distribution costs, resulting in a more efficient path. During the selection process, it is crucial to assess the level of adaptation and prioritize individuals with a higher degree of adaptation. As a result, this paper defines the degree of adaptation as the inverse of the penalty function. Consequently, as the objective function decreases (indicating lower distribution costs), the degree of adaptation increases, and vice versa. Put simply, individuals with lower objective function values demonstrate greater degrees of adaptation and are more likely to be chosen.