From db20f11ea81dc4959f4cd5b7212afd0859fc70eb Mon Sep 17 00:00:00 2001 From: Kevin D Date: Sun, 16 Nov 2025 15:59:55 -0800 Subject: [PATCH] added sensor performance metric --- @agent/agent.m | 3 +++ @miSim/partition.m | 14 ++++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/@agent/agent.m b/@agent/agent.m index 51af2db..ac9a731 100644 --- a/@agent/agent.m +++ b/@agent/agent.m @@ -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; diff --git a/@miSim/partition.m b/@miSim/partition.m index 44782f9..1e91285 100644 --- a/@miSim/partition.m +++ b/@miSim/partition.m @@ -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 \ No newline at end of file