perturb method
Returns the energy at a point selected randomly
from the region (position - deltaPosition, position + deltaPosition
).
- The quantity
deltaPosition
represents a vector. Each component specifies the max. perturbation magnitude along the corrsponding dimension. - The new position can be accessed via the getter
this.position
. The return value ofperturb()
can also be accessed viathis.value
.
Implementation
num perturb(List<num> position, List<num> deltaPosition) {
_position = space.perturb(
position,
deltaPosition,
);
_value = energy(_position);
if (_value < _minValue) {
_minValue = _value;
_minPosition = _position;
}
return _value;
}