def pushAwayFrom(self, otherPositions, rng):
<EOL>if self.max == self.min:<EOL><INDENT>return<EOL><DEDENT>numPositions = len(otherPositions) * <NUM_LIT:4><EOL>if numPositions == <NUM_LIT:0>:<EOL><INDENT>return<EOL><DEDENT>stepSize = float(self.max-self.min) / numPositions<EOL>positions = numpy.arange(self.min, self.max + stepSize, stepSize)<EOL>numPositions = len(positions)<EOL>weights = numpy.zeros(numPositions)<EOL>maxDistanceSq = -<NUM_LIT:1> * (stepSize ** <NUM_LIT:2>)<EOL>for pos in otherPositions:<EOL><INDENT>distances = pos - positions<EOL>varWeights = numpy.exp(numpy.power(distances, <NUM_LIT:2>) / maxDistanceSq)<EOL>weights += varWeights<EOL><DEDENT>positionIdx = weights.argmin()<EOL>self._position = positions[positionIdx]<EOL>self._bestPosition = self.getPosition()<EOL>self._velocity *= rng.choice([<NUM_LIT:1>, -<NUM_LIT:1>])<EOL>
See comments in base class.