了解随机登山者

发布于 2024-10-27 00:12:57 字数 532 浏览 5 评论 0原文

一段时间以来,我一直在尝试理解随机登山者,但没有任何运气。我浏览了一本关于启发式的书并得到了伪代码。我不明白概率函数应该是什么样子。我知道新的解决方案是随机选择的,并根据某种概率被接受,我不明白的是如何对这个概率进行编程。 感谢

PSUEDO-CODE - 来自如何解决它:现代启发式 - Zbugniew Michalewicz、David Fogel

procedure stochastic hill-climber
begin
     t <- 0
     select a current string vc at random
     evaluate vc
     repeat
          select the string vn from the neighbourhood of vc
          select vn with probability 1/(1+(e^(evaluation(vc) - evaluation(vn))/T))
          t <- t + 1
     until t=MAX
end

I've been trying to understand the stochastic hill climber for a while, but not having any luck with it. I've looked through a book on heuristics and got a pseudo code. I don't understand what the probability function should look like. I understand that the new solution is piked randomly and accepted based on some probability, what I don't get is how to program this probability.
Thanks

PSUEDO-CODE - from How to Solve it: Modern Heuristics - Zbugniew Michalewicz, David Fogel

procedure stochastic hill-climber
begin
     t <- 0
     select a current string vc at random
     evaluate vc
     repeat
          select the string vn from the neighbourhood of vc
          select vn with probability 1/(1+(e^(evaluation(vc) - evaluation(vn))/T))
          t <- t + 1
     until t=MAX
end

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

×眷恋的温暖 2024-11-03 00:12:57

这是遗传算法的一种形式,具有称为评估的适应度函数。它选择当前邻居和邻居之间具有较大正差的邻居。它有一个 sigmoid 激活函数 1/(1 + e^(something)),这意味着它将映射到区间 (0,1)。我相信 T 是随着时间的推移减少差异的大小,以使答案最终收敛到一个极限。 t 只是一个计数器,代表算法中的一代。一旦 t 达到最大代数,算法就会结束。希望这有帮助。

This is a form of Genetic algorithm which has a fitness function called evaluation. It chooses a neighbor with a large positive difference between the current and neighbor. It has a sigmoid activation function 1/(1 + e^(something)) which means that it will map to the interval (0,1). I believe that the T is to reduce the size of the differences over time to allow the answer to eventually converge to a limit. t is just a counter which represents a generation in the algorithm. The algorithm will end as soon as t reaches the max generation. Hope this helps.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文