added sensor performance metric

This commit is contained in:
2025-11-16 15:59:55 -08:00
parent 319041ce5e
commit e2d85ce6b9
2 changed files with 13 additions and 4 deletions

View File

@@ -1,4 +1,7 @@
classdef agent
properties (Access = public)
performance = NaN; % current individual sensor performance on partition
end
properties (SetAccess = private, GetAccess = public)
% Identifiers
index = NaN;

View File

@@ -15,10 +15,7 @@ function obj = partition(obj)
% Get highest performance value at each point
[~, idx] = max(agentPerformances, [], 3);
% Current total performance
obj.performance = sum(max(agentPerformances(:, :, 1:(end - 1)), [], 3), 'all');
% Collect agent indices in the same way
% Collect agent indices in the same way as performance
agentInds = cellfun(@(x) x.index * ones(size(obj.objective.X)), obj.agents, 'UniformOutput', false);
agentInds{end + 1} = zeros(size(agentInds{end})); % index for no assignment
agentInds = cat(3, agentInds{:});
@@ -27,4 +24,13 @@ function obj = partition(obj)
[m,n,~] = size(agentInds);
[i,j] = ndgrid(1:m, 1:n);
obj.partitioning = agentInds(sub2ind(size(agentInds), i, j, idx));
% Get individual agent sensor performance
for ii = 1:size(obj.agents, 1)
obj.agents{ii}.performance = sum(agentPerformances(sub2ind(size(agentInds), i, j, idx)), 'all');
end
% Current total performance
sum(arrayfun(@(x) x.performance, [obj.agents{:}]))
obj.performance = sum(max(agentPerformances(:, :, 1:(end - 1)), [], 3), 'all'); % do not count final "non-assignment" layer in computing cumulative performance
end