fixed unit tests
This commit is contained in:
@@ -7,7 +7,6 @@ classdef parametricTestSuite < matlab.unittest.TestCase
|
||||
|
||||
%% 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
|
||||
@@ -15,16 +14,25 @@ classdef parametricTestSuite < matlab.unittest.TestCase
|
||||
end
|
||||
properties (TestParameter)
|
||||
%% Simulation Parameters
|
||||
timestep = num2cell([1]); % duration of one simulation timestep
|
||||
maxIter = num2cell([25]); % number of timesteps to run
|
||||
|
||||
% Domain parameters
|
||||
minAlt = num2cell([1]); % minimum allowed agent altitude, make sure test cases don't conflict with this
|
||||
|
||||
% Constraint parameters
|
||||
barrierGain = num2cell([100]);
|
||||
barrierExponent = num2cell([3]);
|
||||
|
||||
% Sensing Objective Parameters
|
||||
discretizationStep = num2cell([0.01]);
|
||||
sensorPerformanceMinimum = num2cell([1e-6]); % sensor performance threshhold for partition assignment
|
||||
discretizationStep = num2cell([0.01]); % sensing objective discretization step size
|
||||
% this value goes on to determine central differences used in
|
||||
% gradient ascent and partitioning element sizes
|
||||
|
||||
% Agent Parameters
|
||||
collisionRadius = num2cell([0.1]);
|
||||
initialStepSize = num2cell([0.2]); % gradient ascent step size at the first iteration. Decreases linearly to 0 based on maxIter.
|
||||
|
||||
% Sensor Model Parameters
|
||||
alphaDist = num2cell([2.5, 5]);
|
||||
@@ -38,23 +46,26 @@ classdef parametricTestSuite < matlab.unittest.TestCase
|
||||
|
||||
methods (Test, ParameterCombination = "exhaustive")
|
||||
% Test cases
|
||||
function single_agent_gradient_ascent(tc, maxIter, minAlt, discretizationStep, collisionRadius, alphaDist, betaDist, alphaTilt, betaTilt, comRange)
|
||||
function single_agent_gradient_ascent(tc, timestep, maxIter, barrierGain, barrierExponent, minAlt, sensorPerformanceMinimum, discretizationStep, collisionRadius, initialStepSize, alphaDist, betaDist, alphaTilt, betaTilt, comRange)
|
||||
% Set up square domain
|
||||
l = 10;
|
||||
tc.domain = tc.domain.initialize([zeros(1, 3); l * ones(1, 3)], REGION_TYPE.DOMAIN, "Domain");
|
||||
tc.domain.objective = tc.domain.objective.initialize(objectiveFunctionWrapper([.75 * l, 0.75 * l]), tc.domain, discretizationStep, tc.protectedRange);
|
||||
tc.domain.objective = tc.domain.objective.initialize(objectiveFunctionWrapper([.75 * l, 0.75 * l]), tc.domain, discretizationStep, tc.protectedRange, sensorPerformanceMinimum);
|
||||
|
||||
% Set up agent
|
||||
sensorModel = sigmoidSensor;
|
||||
sensorModel = sensorModel.initialize(alphaDist, betaDist, alphaTilt, betaTilt);
|
||||
agentPos = [l/4, l/4, 3*l/4];
|
||||
agentPos = [l/4, l/4, l/4];
|
||||
collisionGeometry = spherical;
|
||||
collisionGeometry = collisionGeometry.initialize(agentPos, collisionRadius, REGION_TYPE.COLLISION, "Agent 1 Collision Region");
|
||||
agents = {agent};
|
||||
agents{1} = agents{1}.initialize(agentPos, collisionGeometry, sensorModel, comRange, maxIter, "Agent 1", tc.plotCommsGeometry);
|
||||
agents{1} = agents{1}.initialize(agentPos, collisionGeometry, sensorModel, comRange, maxIter, initialStepSize, "Agent 1", tc.plotCommsGeometry);
|
||||
|
||||
% Set up simulation
|
||||
tc.testClass = tc.testClass.initialize(tc.domain, agents, minAlt, tc.timestep, maxIter, tc.obstacles, tc.makePlots, tc.makeVideo);
|
||||
tc.testClass = tc.testClass.initialize(tc.domain, agents, barrierGain, barrierExponent, minAlt, timestep, maxIter, tc.obstacles, tc.makePlots, tc.makeVideo);
|
||||
|
||||
% Save simulation parameters to output file
|
||||
tc.testClass.writeParams();
|
||||
|
||||
% Run
|
||||
tc.testClass = tc.testClass.run();
|
||||
|
||||
Reference in New Issue
Block a user