Add stop condition fix

This commit is contained in:
Leonardo Bautista-Gomez 2023-03-30 14:26:14 +02:00
parent 1b4a225114
commit ae36844e7f
2 changed files with 7 additions and 2 deletions

View File

@ -229,9 +229,11 @@ class Simulator:
}) })
if missingSamples == oldMissingSamples: 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) missingVector.append(missingSamples)
break
elif missingSamples == 0: 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) 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) missingVector.append(missingSamples)

View File

@ -73,6 +73,9 @@ deterministic = True
# If your run is deterministic you can decide the random seed. This is ignore otherwise. # If your run is deterministic you can decide the random seed. This is ignore otherwise.
randomSeed = "DAS" randomSeed = "DAS"
# Number of steps without progress to stop simulation
steps4StopCondition = 7
def nextShape(): def nextShape():
for run, fr, class1ratio, chi, vpn1, vpn2, blockSize, nn, netDegree, bwUplinkProd, bwUplink1, bwUplink2 in itertools.product( 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): runs, failureRates, class1ratios, chis, validatorsPerNode1, validatorsPerNode2, blockSizes, numberNodes, netDegrees, bwUplinksProd, bwUplinks1, bwUplinks2):