管道网络优化的变异

时间:2012-05-29 12:44:39

标签: genetic-algorithm evolutionary-algorithm

我正在进行管道网络优化,我将染色体表示为一串数字,如下所示

示例

chromosome [1] = 3 4 7 2 8 9 6 5

其中,每个数字指的是井,井之间的距离是定义的。因为,一条染色体的孔不能复制。例如

chromosome [1]' = 3 4 7 2 7 9 6 5 (not acceptable) 

什么是可以处理这种表示的最佳突变?提前致谢。

1 个答案:

答案 0 :(得分:1)

不能说“最好”,但我用于图形问题的一个模型是:对于每个节点(井号),从整个总体计算相邻节点/井的集合。如,

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在原始版本中显示1倍,6->2显示为2x,2->1显示为5x,1->5显示为0,5->7显示为0,7->4显示为0。因此,您保留了最常见的邻接(2-> 1)和另外两个“可能很重要”的邻接关系。否则,您正在解决方案空间中尝试新的邻接关系。

更新:最初我忘记了一个关键点,即在递归时,您选择连接最多的到刚刚选择的节点。这对保持高健身链至关重要!我已经更新了说明。

相关问题