diff --git a/DAS/simulator.py b/DAS/simulator.py index a8d5509..6561ea0 100644 --- a/DAS/simulator.py +++ b/DAS/simulator.py @@ -229,9 +229,11 @@ class Simulator: }) if missingSamples == oldMissingSamples: - self.logger.debug("The block cannot be recovered, failure rate %d!" % self.shape.failureRate, extra=self.format) + if len(missingVector) > self.config.steps4StopCondition: + if missingSamples == missingVector[len(missingVector)-1-self.config.steps4StopCondition]: + self.logger.debug("The block cannot be recovered, failure rate %d!" % self.shape.failureRate, extra=self.format) + break missingVector.append(missingSamples) - break elif missingSamples == 0: self.logger.debug("The entire block is available at step %d, with failure rate %d !" % (steps, self.shape.failureRate), extra=self.format) missingVector.append(missingSamples) diff --git a/config_example.py b/config_example.py index 3ff5ae8..6725280 100644 --- a/config_example.py +++ b/config_example.py @@ -73,6 +73,9 @@ deterministic = True # If your run is deterministic you can decide the random seed. This is ignore otherwise. randomSeed = "DAS" +# Number of steps without progress to stop simulation +steps4StopCondition = 7 + def nextShape(): for run, fr, class1ratio, chi, vpn1, vpn2, blockSize, nn, netDegree, bwUplinkProd, bwUplink1, bwUplink2 in itertools.product( runs, failureRates, class1ratios, chis, validatorsPerNode1, validatorsPerNode2, blockSizes, numberNodes, netDegrees, bwUplinksProd, bwUplinks1, bwUplinks2):