In this paper, we chose ACS as our algorithm prototype and modified the ACS algorithm to suit the DH route design problem. Moreover, to improve the efficiency, we convert ACS to a parallel version. The principle of the algorithm is described as follows:

#### 2.4.1. Parameter Initialization

As mentioned in

Section 2.2 and

Section 2.3, the number of nodes (

n) is 361, and a 361 × 361 cost matrix (

C) has been prepared. The pheromone matrix is set the same dimension as the cost matrix, which stores the pheromone between every two nodes. The initial value of the pheromone (

${\tau}_{0}$) is set at 1.0 for all the edges. The number of ants (

m) is set to 36, considering both the diversity and the efficiency. Among the 361 nodes, the start point of the route (

Sp) is fixed on the 238th node, while the end point of the route (

Ep) is the 216th node. We also determine the heuristic information (

${\eta}_{ij}$) as the inverse of the edge’s cost, which can be expressed as Equation (5):

The index of visited nodes are stored in a m×n matrix named Tabu. As to the current ant, the index of the visited nodes are stored in a vector named visited, while the index of the candidate nodes are stored in a vector named allowed. $allowed\cup visited$ comprises the total 361 nodes.

#### 2.4.2. Route Searching

As the Sp and the Ep are fixed, the search starts from the second point and ends when meeting the Ep. The effective route is limited from Sp to Ep. There are several points that need attention in the route searching process:

• The parallelization of the route searching

The route searching algorithm is converted to a parallel one to further improve the efficiency. In this paper, the number of nodes is 361, and the number of ants is 36. The time spent on the route searching procedure takes the largest proportion. Since we develop the code with MATLAB software on a computer with a quad core CPU systems (Intel(R) Core(TM) i5-6500 CPU @3.2GHz), the route searching algorithm is divided into four parallel algorithms. Therefore, every thread has nine ants executing the searching. The angle constraint module, the state transition rule module, and the local updating rule module mentioned below are executed separately for different threads. Theoretically, the operating efficiency can be around four times compared to the sequential algorithm.

• The angle constraint module

The angle constraint is introduced to further screen the alternative nodes. In ACS, ant selects the next node to reach from the

allowed vector. However, according to the Design Code For the City Heating Network (CJJ 34-2010) [

39], the DH route should have no intersections, and the crossing angle should be more than 90°. Therefore, it is a prerequisiteto screen the nodes satisfying the angle requirement from the

allowed vector. An angle judgment model based on the cosine law is introduced as shown in Equation (6):

where

N_{allowed} is the size of the

allowed vector.

${P}_{next}({X}_{next},{Y}_{next})$ is one of the points from the

allowed vector, while

${P}_{this}({X}_{this},{Y}_{this})$ and

${P}_{last}({X}_{last},{Y}_{last})$ are the current point and the previous point. After the angle screening step, a subset of the

allowed vector, namely

sub_allowed, is acquired, and used for the subsequent calculations.

Due to the stricter angle constraints, it is possible that the search is finished without meeting the Ep. In this case, the ant and the route are given up, and they no longer participates in the updating and cost function calculation.

• The state transition rule module

The ant selects the next node according to the ACS state transition rule. A random number

q is generated and used for the next node selection. The rule is given by Equation (7):

where

q is a random number uniformly distributed in [0,1], and

q_{o} is a constant. Here, we set

q_{0} = 0.9 as a reference [

16].

i is the current node, while

j is any one candidate node from the

sub_allowed vector.

${\tau}_{ij}(t)$ is the intensity of the pheromone between

i and

j at time

t.

${\eta}_{ij}(t)$ is the heuristic information between

i and

j at time

t. sub_allowed_{k} stores the candidate nodes. α and β are two constantsthat can be described as the weighted values of the pheromone (

${\tau}_{ij}(t)$) and heuristic information (

${\eta}_{ij}$), respectively. Here, we set α = 0.1 and β = 2 as references [

16].

Since the ant favors choosing the next node with a short edge and a large amount of pheromone, when q ≤ q_{0}, we directly set the next visited node to the one with the maximum value, as shown in (7-1). Otherwise, when q > q_{0}, the roulette wheels method is executed. For every j belongs to sub_allowed_{k}, ${p}_{ij}^{k}(t)$ is calculated by Equation (7-2), given a random generated number p, and the node with ${p}_{ij}^{k}(t)$≥ p is chosen as the next visited node. If j doesn’t belong to sub_allowed_{k}, ${p}_{ij}^{k}(t)$ is set to 0 as shown in Equation (7-3). We can determine that the search is finished for one ant when Ep is chosen as the next visited node.

• The local updating rule module

A local updating rule is applied once the next node is fixed as reference [

16]. The local updating rule is described as shown in Equation (8):

where

i is the current node, and

j is the next node that the ant has chosen. 0 <

ρ < 1, and

ρ is a parameter; here, we set

ρ = 0.1.

$\u25b3{\tau}_{ij}^{}$ is set the same as the initial value of pheromone (

${\tau}_{0}$), i.e.,

$\u25b3{\tau}_{ij}^{}$= 1.0.

The first part of Equation (8) represents the evaporation of the pheromone, while the second part represents the reinforcement of the pheromone. With the help of the local updating rule, the route is shuffled dynamically, and the search can take full advantage of the pheromone information. It is worth noting that the pheromone updating is only focused on the current iteration and the segments between the start point and the end point.