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

@@ -1,18 +1,47 @@
classdef parametricTestSuite < matlab.unittest.TestCase
properties (Access = private)
% System under test
testClass = miSim;
domain = rectangularPrism;
objective = sensingObjective;
obstacles = cell(1, 0);
methods (TestClassSetup)
% Shared setup for the entire test class
%% Diagnostic Parameters
% 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
methods (TestMethodSetup)
% Setup for each test
end
methods (Test)
methods (Test, ParameterCombination = "exhaustive")
% Test methods
function unimplementedTest(testCase)
testCase.verifyFail("Unimplemented test");
function single_agent_gradient_ascent(tc, maxIter, minAlt, discretizationStep, collisionRange, alphaDist, alphaTilt, betaDist, betaTilt, comRange)
1;
end
end

View File

@@ -10,8 +10,7 @@ classdef test_miSim < matlab.unittest.TestCase
% Sim
maxIter = 250;
timestep = 0.05
partitoningFreq = 5;
timestep = 0.05;
% Domain
domain = rectangularPrism; % domain geometry
@@ -33,7 +32,6 @@ classdef test_miSim < matlab.unittest.TestCase
% Agents
minAgents = 3; % Minimum 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);
% Collision
@@ -429,7 +427,7 @@ classdef test_miSim < matlab.unittest.TestCase
tc.verifyEqual(unique(tc.testClass.partitioning), [0; 1]);
tc.verifyLessThan(sum(tc.testClass.partitioning == 1, 'all'), sum(tc.testClass.partitioning == 0, 'all'));
end
function test_single_partition_basic_GA(tc)
function test_single_agent_gradient_ascent(tc)
% make basic domain
l = 10; % domain size
tc.domain = tc.domain.initialize([zeros(1, 3); l * ones(1, 3)], REGION_TYPE.DOMAIN, "Domain");