removed early exit from main loop
This commit is contained in:
@@ -14,7 +14,6 @@ classdef miSim
|
|||||||
sensorPerformanceMinimum = 1e-6; % minimum sensor performance to allow assignment of a point in the domain to a partition
|
sensorPerformanceMinimum = 1e-6; % minimum sensor performance to allow assignment of a point in the domain to a partition
|
||||||
partitioning = NaN;
|
partitioning = NaN;
|
||||||
performance = NaN; % current cumulative sensor performance
|
performance = NaN; % current cumulative sensor performance
|
||||||
oldMeanTotalPerf = 0;
|
|
||||||
|
|
||||||
fPerf; % performance plot figure
|
fPerf; % performance plot figure
|
||||||
end
|
end
|
||||||
@@ -55,4 +54,4 @@ classdef miSim
|
|||||||
methods (Access = private)
|
methods (Access = private)
|
||||||
[v] = setupVideoWriter(obj);
|
[v] = setupVideoWriter(obj);
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
15
@miSim/run.m
15
@miSim/run.m
@@ -19,19 +19,6 @@ function [obj] = run(obj)
|
|||||||
% Check if it's time for new partitions
|
% Check if it's time for new partitions
|
||||||
updatePartitions = false;
|
updatePartitions = false;
|
||||||
if ismember(obj.t, obj.partitioningTimes)
|
if ismember(obj.t, obj.partitioningTimes)
|
||||||
% Check if it's time to end the sim (performance has settled)
|
|
||||||
if obj.t >= obj.partitioningTimes(5)
|
|
||||||
idx = find(obj.t == obj.partitioningTimes);
|
|
||||||
newMeanTotalPerf = mean(obj.perf(end, ((idx - 5 + 1):idx)));
|
|
||||||
if (obj.oldMeanTotalPerf * 0.95 <= newMeanTotalPerf) && (newMeanTotalPerf <= max(1e-6, obj.oldMeanTotalPerf * 1.05))
|
|
||||||
steady = steady + 1;
|
|
||||||
if steady >= 3
|
|
||||||
fprintf("Performance is stable, terminating early at %4.2f (%d/%d)\n", obj.t, ii, obj.maxIter + 1);
|
|
||||||
break; % performance is not improving further, exit main sim loop
|
|
||||||
end
|
|
||||||
end
|
|
||||||
obj.oldMeanTotalPerf = newMeanTotalPerf;
|
|
||||||
end
|
|
||||||
updatePartitions = true;
|
updatePartitions = true;
|
||||||
obj = obj.partition();
|
obj = obj.partition();
|
||||||
end
|
end
|
||||||
@@ -54,4 +41,4 @@ function [obj] = run(obj)
|
|||||||
|
|
||||||
% Close video file
|
% Close video file
|
||||||
v.close();
|
v.close();
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user