我正在研究管道网络优化,我将染色体表示为一串数字,如下所示
例子
chromosome [1] = 3 4 7 2 8 9 6 5
其中,每个数字指的是井,并定义了井之间的距离。因为,一个染色体的孔不能重复。例如
chromosome [1]' = 3 4 7 2 7 9 6 5 (not acceptable)
可以处理这样的表示的最佳突变是什么?提前致谢。
我正在研究管道网络优化,我将染色体表示为一串数字,如下所示
例子
chromosome [1] = 3 4 7 2 8 9 6 5
其中,每个数字指的是井,并定义了井之间的距离。因为,一个染色体的孔不能重复。例如
chromosome [1]' = 3 4 7 2 7 9 6 5 (not acceptable)
可以处理这样的表示的最佳突变是什么?提前致谢。
不能说“最好”,但我用于类似图形问题的一个模型是:对于每个节点(井号),计算整个人口中相邻节点/井的集合。例如,
population = [[1,2,3,4], [1,2,3,5], [1,2,3,6], [1,2,6,5], [1,2,6,7]]
adjacencies = {
1 : [2] , #In the entire population, 1 is always only near 2
2 : [1, 3, 6] , #2 is adjacent to 1, 3, and 6 in various individuals
3 : [2, 4, 5, 6], #...etc...
4 : [3] ,
5 : [3, 6] ,
6 : [3, 2, 5, 7],
7 : [6]
}
choose_from_subset = [1,2,3,4,5,6,7] #At first, entire population
然后通过以下方式创建一个新的个人/网络:
choose_next_individual(adjacencies, choose_from_subset) :
Sort adjacencies by the size of their associated sets
From the choices in choose_from_subset, choose the well with the highest number of adjacent possibilities (e.g., either 3 or 6, both of which have 4 possibilities)
If there is a tie (as there is with 3 and 6), choose among them randomly (let's say "3")
Place the chosen well as the next element of the individual / network ([3])
fewerAdjacencies = Remove the chosen well from the set of adjacencies (see below)
new_choose_from_subset = adjacencies to your just-chosen well (i.e., 3 : [2,4,5,6])
Recurse -- choose_next_individual(fewerAdjacencies, new_choose_from_subset)
这个想法是具有大量邻接的节点适合重组(因为总体尚未收敛,例如 1->2),较低的“邻接计数”(但非零)意味着收敛,而零邻接计数(基本上)是一种突变。
只是为了展示一个示例运行..
#Recurse: After removing "3" from the population
new_graph = [3]
new_choose_from_subset = [2,4,5,6] #from 3 : [2,4,5,6]
adjacencies = {
1: [2]
2: [1, 6] ,
4: [] ,
5: [6] ,
6: [2, 5, 7] ,
7: [6]
}
#Recurse: "6" has most adjacencies in new_choose_from_subset, so choose and remove
new_graph = [3, 6]
new_choose_from_subset = [2, 5,7]
adjacencies = {
1: [2]
2: [1] ,
4: [] ,
5: [] ,
7: []
}
#Recurse: Amongst [2,5,7], 2 has the most adjacencies
new_graph = [3, 6, 2]
new_choose_from_subset = [1]
adjacencies = {
1: []
4: [] ,
5: [] ,
7: []
]
#new_choose_from_subset contains only 1, so that's your next...
new_graph = [3,6,2,1]
new_choose_from_subset = []
adjacencies = {
4: [] ,
5: [] ,
7: []
]
#From here on out, you'd be choosing randomly between the rest, so you might end up with:
new_graph = [3, 6, 2, 1, 5, 7, 4]
完整性检查?3->6
在原始中出现 1x,6->2
出现 2x,2->1
出现 5x,1->5
出现 0,5->7
出现 0,7->4
出现 0。因此,您保留了最常见的邻接 (2->1) 和其他两个“可能很重要”的邻接。否则,您将在解决方案空间中尝试新的邻接。
更新:最初我忘记了递归时的关键点,您选择与刚刚选择的节点连接最多的节点。这对于保留高适应性链至关重要!我已经更新了描述。