Skip to content

Commit 2548973

Browse files
committed
Comment out unnecessary gradient hessian estimation steps, hessian is anyways unused (c_hess=0)
1 parent 23dd2a2 commit 2548973

1 file changed

Lines changed: 26 additions & 25 deletions

File tree

flocking_analysis/simulation_scripts/FlockingVehicleAgent.m

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -128,35 +128,36 @@
128128
% This function estimates the gradient and the hessian of the
129129
% field at the current agent location.
130130

131-
field_estimate = obj.position'*obj.QuadModelEst.Q_id*obj.position+obj.QuadModelEst.b_id'*obj.position+obj.QuadModelEst.c_id;
132-
field_data_self = field_data.values(1);
133-
134-
% We use the following heuristic for identifying the underlying
135-
% field which has been observed to work for an inverted gaussian field:
136-
% 1. If we have less than three data points, we assume a zero
137-
% model since the identfied model wouldn\t be reliable
138-
% 2. If we have three to ten data points, we try to identify a
139-
% linear model which has three model parameters (grad and bias)
140-
% 3. If we have more than ten data points, we identify a
141-
% quadratic model which has 6 model parameters (hess, grad and bias)
142-
data_size=size(field_data.values,2);
143-
if abs(field_estimate-field_data_self) >= obj.field_sensor.noise_bound
144-
if (data_size>=3) && (data_size<10)
145-
obj.QuadModelEst=obj.field_sensor.linear_regression(field_data);
146-
elseif (data_size>=10)
147-
obj.QuadModelEst=obj.field_sensor.quadratic_regression(field_data);
148-
else
149-
obj.QuadModelEst.Q_id = zeros(obj.dim);
150-
obj.QuadModelEst.b_id = zeros(obj.dim,1);
151-
obj.QuadModelEst.c_id = 0;
152-
end
153-
end
154-
grad = 2*obj.QuadModelEst.Q_id*obj.position+obj.QuadModelEst.b_id;
155-
hess = 2*obj.QuadModelEst.Q_id;
131+
% field_estimate = obj.position'*obj.QuadModelEst.Q_id*obj.position+obj.QuadModelEst.b_id'*obj.position+obj.QuadModelEst.c_id;
132+
% field_data_self = field_data.values(1);
133+
%
134+
% % We use the following heuristic for identifying the underlying
135+
% % field which has been observed to work for an inverted gaussian field:
136+
% % 1. If we have less than three data points, we assume a zero
137+
% % model since the identfied model wouldn\t be reliable
138+
% % 2. If we have three to ten data points, we try to identify a
139+
% % linear model which has three model parameters (grad and bias)
140+
% % 3. If we have more than ten data points, we identify a
141+
% % quadratic model which has 6 model parameters (hess, grad and bias)
142+
% data_size=size(field_data.values,2);
143+
% if abs(field_estimate-field_data_self) >= obj.field_sensor.noise_bound
144+
% if (data_size>=3) && (data_size<10)
145+
% obj.QuadModelEst=obj.field_sensor.linear_regression(field_data);
146+
% elseif (data_size>=10)
147+
% obj.QuadModelEst=obj.field_sensor.quadratic_regression(field_data);
148+
% else
149+
% obj.QuadModelEst.Q_id = zeros(obj.dim);
150+
% obj.QuadModelEst.b_id = zeros(obj.dim,1);
151+
% obj.QuadModelEst.c_id = 0;
152+
% end
153+
% end
154+
% grad = 2*obj.QuadModelEst.Q_id*obj.position+obj.QuadModelEst.b_id;
155+
% hess = 2*obj.QuadModelEst.Q_id;
156156

157157
% Can get the true gradient and hessians at obj.position
158158
% for a posterior analysis
159159
grad=obj.conc_field.get_true_gradient(obj.position);
160+
hess=0;
160161
%hess=obj.conc_field.get_true_hessian(obj.position);
161162
end
162163

0 commit comments

Comments
 (0)