了解随机登山者
一段时间以来,我一直在尝试理解随机登山者,但没有任何运气。我浏览了一本关于启发式的书并得到了伪代码。我不明白概率函数应该是什么样子。我知道新的解决方案是随机选择的,并根据某种概率被接受,我不明白的是如何对这个概率进行编程。 感谢
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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是遗传算法的一种形式,具有称为评估的适应度函数。它选择当前邻居和邻居之间具有较大正差的邻居。它有一个 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.