demonstrated test iteration over parameters, scales really poorly

This commit is contained in:
2026-01-13 16:37:39 -08:00
parent df31c2f03c
commit 08e396c155
3 changed files with 40 additions and 14 deletions

View File

@@ -5,7 +5,6 @@ classdef agent
% Sensor % Sensor
sensorModel; sensorModel;
sensingLength = 0.05; % length parameter used by sensing function
% State % State
lastPos = NaN(1, 3); % position from previous timestep lastPos = NaN(1, 3); % position from previous timestep

View File

@@ -1,18 +1,47 @@
classdef parametricTestSuite < matlab.unittest.TestCase classdef parametricTestSuite < matlab.unittest.TestCase
properties (Access = private)
% System under test
testClass = miSim;
domain = rectangularPrism;
objective = sensingObjective;
obstacles = cell(1, 0);
methods (TestClassSetup) %% Diagnostic Parameters
% Shared setup for the entire test class % No effect on simulation dynamics
timestep = 1;
makeVideo = true; % disable video writing for big performance increase
makePlots = true; % disable plotting for big performance increase (also disables video)
plotCommsGeometry = false; % disable plotting communications geometries
protectedRange = 0;
end
properties (TestParameter)
%% Simulation Parameters
maxIter = num2cell([200, 400]); % number of timesteps to run
% Domain parameters
minAlt = num2cell([1, 3]); % minimum allowed agent altitude, make sure test cases don't conflict with this
% Sensing Objective Parameters
discretizationStep = num2cell([0.01, 0.05]);
% Agent Parameters
collisionRange = num2cell([0.1, 0.5]);
% Sensor Model Parameters
betaDist = num2cell(3:6:15);
betaTilt = num2cell(3:6:15);
alphaDist = num2cell([2.5, 5]);
alphaTilt = num2cell([15, 30]); % (degrees)
% Communications Parameters
comRange = num2cell(1:2:5);
end end
methods (TestMethodSetup) methods (Test, ParameterCombination = "exhaustive")
% Setup for each test
end
methods (Test)
% Test methods % Test methods
function unimplementedTest(testCase) function single_agent_gradient_ascent(tc, maxIter, minAlt, discretizationStep, collisionRange, alphaDist, alphaTilt, betaDist, betaTilt, comRange)
testCase.verifyFail("Unimplemented test"); 1;
end end
end end

View File

@@ -10,8 +10,7 @@ classdef test_miSim < matlab.unittest.TestCase
% Sim % Sim
maxIter = 250; maxIter = 250;
timestep = 0.05 timestep = 0.05;
partitoningFreq = 5;
% Domain % Domain
domain = rectangularPrism; % domain geometry domain = rectangularPrism; % domain geometry
@@ -33,7 +32,6 @@ classdef test_miSim < matlab.unittest.TestCase
% Agents % Agents
minAgents = 3; % Minimum number of agents to be randomly generated minAgents = 3; % Minimum number of agents to be randomly generated
maxAgents = 4; % Maximum number of agents to be randomly generated maxAgents = 4; % Maximum number of agents to be randomly generated
sensingLength = 0.05; % length parameter used by sensing function
agents = cell(0, 1); agents = cell(0, 1);
% Collision % Collision
@@ -429,7 +427,7 @@ classdef test_miSim < matlab.unittest.TestCase
tc.verifyEqual(unique(tc.testClass.partitioning), [0; 1]); tc.verifyEqual(unique(tc.testClass.partitioning), [0; 1]);
tc.verifyLessThan(sum(tc.testClass.partitioning == 1, 'all'), sum(tc.testClass.partitioning == 0, 'all')); tc.verifyLessThan(sum(tc.testClass.partitioning == 1, 'all'), sum(tc.testClass.partitioning == 0, 'all'));
end end
function test_single_partition_basic_GA(tc) function test_single_agent_gradient_ascent(tc)
% make basic domain % make basic domain
l = 10; % domain size l = 10; % domain size
tc.domain = tc.domain.initialize([zeros(1, 3); l * ones(1, 3)], REGION_TYPE.DOMAIN, "Domain"); tc.domain = tc.domain.initialize([zeros(1, 3); l * ones(1, 3)], REGION_TYPE.DOMAIN, "Domain");