parameterized variable gradient ascent step size
This commit is contained in:
@@ -34,6 +34,11 @@ classdef agent
|
||||
plotCommsGeometry = true;
|
||||
end
|
||||
|
||||
properties (SetAccess = private, GetAccess = public)
|
||||
initialStepSize = 0.2;
|
||||
stepDecayRate = NaN;
|
||||
end
|
||||
|
||||
methods (Access = public)
|
||||
[obj] = initialize(obj, pos, vel, pan, tilt, collisionGeometry, sensorModel, guidanceModel, comRange, index, label);
|
||||
[obj] = run(obj, domain, partitioning, t, index, agents);
|
||||
|
||||
@@ -24,6 +24,7 @@ function obj = initialize(obj, pos, vel, pan, tilt, collisionGeometry, sensorMod
|
||||
obj.sensorModel = sensorModel;
|
||||
obj.label = label;
|
||||
obj.plotCommsGeometry = plotCommsGeometry;
|
||||
obj.stepDecayRate = obj.initialStepSize / maxIter;
|
||||
|
||||
% Initialize performance vector
|
||||
obj.performance = [0, NaN(1, maxIter), 0];
|
||||
|
||||
@@ -66,7 +66,7 @@ function obj = run(obj, domain, partitioning, timestepIndex, index, agents)
|
||||
gradC = [(C_delta(2)-C_delta(3))/(2*delta), (C_delta(4)-C_delta(5))/(2*delta), (C_delta(6)-C_delta(7))/(2*delta)];
|
||||
|
||||
% Compute scaling factor
|
||||
targetRate = 0.2 - 0.0008 * timestepIndex; % slow down as you get closer
|
||||
targetRate = obj.initialStepSize - obj.stepDecayRate * timestepIndex; % slow down as you get closer
|
||||
rateFactor = targetRate / norm(gradC);
|
||||
|
||||
% Compute unconstrained next position
|
||||
|
||||
Reference in New Issue
Block a user