我只是注意到,当我将代码片段中的最后一行从 更改potential =+ rep_pot
为 时potential = potential + rep_pot
,我得到了完全不同的行为。有人知道为什么会这样吗?
double potential = euclideanDistance(i, goal);
for (IntPoint h: hits){
double dist = euclideanDistance(i, h);
double a = range - dist;
double rep_pot = (Math.exp(-1/a)) / dist;
potential =+ rep_pot;
}