fixed issues in sigmoid sensor model causing inverted response (annular partitions)

This commit is contained in:
2025-11-24 17:39:16 -08:00
parent 66bbfe52ca
commit f7b28cdf4f
55 changed files with 44 additions and 31 deletions

View File

@@ -0,0 +1,21 @@
function [values, positions] = sense(obj, agent, sensingObjective, domain, partitioning)
arguments (Input)
obj (1, 1) {mustBeA(obj, 'sigmoidSensor')};
agent (1, 1) {mustBeA(agent, 'agent')};
sensingObjective (1, 1) {mustBeA(sensingObjective, 'sensingObjective')};
domain (1, 1) {mustBeGeometry};
partitioning (:, :) double;
end
arguments (Output)
values (:, 1) double;
positions (:, 3) double;
end
% Find positions for this agent's assigned partition in the domain
idx = partitioning == agent.index;
positions = [sensingObjective.X(idx), sensingObjective.Y(idx), zeros(size(sensingObjective.X(idx)))];
% Evaluate objective function at every point in this agent's
% assigned partiton
values = sensingObjective.values(idx);
end