0

我找到了一段伪代码,它解释了最长路径问题的模拟退火,但有一些我不明白的细节。

目前我已经实现了一个表示图的结构,以及在图中生成随机图和随机路径的方法——两者都是统一的。

这是模拟退火的伪代码:

Procedure Anneal(G, s, t, P)
P = RandomPath(s, t, G)
temp = TEMP0
itermax = ITER0
while temp > TEMPF do
  while iteration  < itermax do
    S = RandomNeighbor(P, G)
    delta = S.len - P.len
    if delta > 0 then
       P = S
    else
      x = random01
      if x < exp(delta / temp) then
        P = S
      endif
    endif
    iteration = iteration + 1
  enddo
  temp = Alpha(temp)
  itermax = Beta(itermax)
enddo

我觉得不够清楚无法理解的细节是:

随机邻居(P,G)

阿尔法(温度)

itermax = Beta(itermax)

这些方法应该做什么?

4

1 回答 1

1

RandomNeighbor(P, G):这可能是从当前解决方案(随机选择邻居)创建新解决方案(或新相邻解决方案)的函数。

Alpha(temp):这是降低温度的函数(可能temp *= alpha

itermax = Beta(itermax):我只能假设这个计数器正在更改(很可能是重置)迭代时的计数器,因为它被用于 inner while。因此,当您的迭代计数器达到最大值时,它会被重置。

于 2019-04-25T02:32:59.733 回答