nixed agent index property

This commit is contained in:
2026-01-01 17:02:36 -08:00
parent 06f6af1511
commit 492c5c2140
7 changed files with 29 additions and 49 deletions

View File

@@ -1,7 +1,6 @@
classdef agent
properties (SetAccess = public, GetAccess = public)
% Identifiers
index = NaN;
label = "";
% Sensor
@@ -41,7 +40,7 @@ classdef agent
methods (Access = public)
[obj] = initialize(obj, pos, vel, pan, tilt, collisionGeometry, sensorModel, guidanceModel, comRange, index, label);
[obj] = run(obj, domain, partitioning, t);
[obj] = run(obj, domain, partitioning, t, index);
[obj, f] = plot(obj, ind, f);
updatePlots(obj);
end

View File

@@ -9,7 +9,6 @@ function obj = initialize(obj, pos, vel, pan, tilt, collisionGeometry, sensorMod
sensorModel (1, 1) {mustBeSensor}
guidanceModel (1, 1) {mustBeA(guidanceModel, 'function_handle')};
comRange (1, 1) double = NaN;
index (1, 1) double = NaN;
label (1, 1) string = "";
debug (1, 1) logical = false;
plotCommsGeometry (1, 1) logical = true;
@@ -25,13 +24,12 @@ function obj = initialize(obj, pos, vel, pan, tilt, collisionGeometry, sensorMod
obj.collisionGeometry = collisionGeometry;
obj.sensorModel = sensorModel;
obj.guidanceModel = guidanceModel;
obj.index = index;
obj.label = label;
obj.debug = debug;
obj.plotCommsGeometry = plotCommsGeometry;
% Add spherical geometry based on com range
obj.commsGeometry = obj.commsGeometry.initialize(obj.pos, comRange, REGION_TYPE.COMMS, sprintf("Agent %d Comms Geometry", obj.index));
obj.commsGeometry = obj.commsGeometry.initialize(obj.pos, comRange, REGION_TYPE.COMMS, sprintf("%s Comms Geometry", obj.label));
if obj.debug
obj.debugFig = figure;

View File

@@ -1,16 +1,17 @@
function obj = run(obj, domain, partitioning, t)
function obj = run(obj, domain, partitioning, t, index)
arguments (Input)
obj (1, 1) {mustBeA(obj, 'agent')};
domain (1, 1) {mustBeGeometry};
partitioning (:, :) double;
t (1, 1) double;
index (1, 1) double;
end
arguments (Output)
obj (1, 1) {mustBeA(obj, 'agent')};
end
% Collect objective function values across partition
partitionMask = partitioning == obj.index;
partitionMask = partitioning == index;
objectiveValues = domain.objective.values(partitionMask); % f(omega) on W_n
% Compute sensor performance across partition