mirror of
https://github.com/codex-storage/das-research.git
synced 2025-02-21 15:28:09 +00:00
minimum custody feature added
This commit is contained in:
parent
4dc4f3a32a
commit
11d31d7350
@ -98,13 +98,13 @@ class Node:
|
||||
self.logger.warning("Row custody (*vpn) larger than number of rows!", extra=self.format)
|
||||
self.rowIDs = range(self.shape.nbRows)
|
||||
else:
|
||||
self.rowIDs = set(random.sample(range(self.shape.nbRows), self.vpn*self.shape.custodyRows))
|
||||
self.rowIDs = set(random.sample(range(self.shape.nbRows), max(self.vpn*self.shape.custodyRows, self.shape.minCustodyRows)))
|
||||
|
||||
if (self.vpn * self.shape.custodyCols) > self.shape.nbCols:
|
||||
self.logger.warning("Column custody (*vpn) larger than number of columns!", extra=self.format)
|
||||
self.columnIDs = range(self.shape.nbCols)
|
||||
else:
|
||||
self.columnIDs = set(random.sample(range(self.shape.nbCols), self.vpn*self.shape.custodyCols))
|
||||
self.columnIDs = set(random.sample(range(self.shape.nbCols), max(self.vpn*self.shape.custodyCols, self.shape.minCustodyCols)))
|
||||
|
||||
self.rowNeighbors = collections.defaultdict(dict)
|
||||
self.columnNeighbors = collections.defaultdict(dict)
|
||||
|
@ -3,7 +3,7 @@
|
||||
class Shape:
|
||||
"""This class represents a set of parameters for a specific simulation."""
|
||||
def __init__(self, nbCols, nbColsK, nbRows, nbRowsK,
|
||||
numberNodes, failureModel, failureRate, maliciousNodes, custodyRows, custodyCols, netDegree, bwUplinkProd, run, nodeTypes):
|
||||
numberNodes, failureModel, failureRate, maliciousNodes, custodyRows, custodyCols, minCustodyRows, minCustodyCols, netDegree, bwUplinkProd, run, nodeTypes):
|
||||
"""Initializes the shape with the parameters passed in argument."""
|
||||
self.run = run
|
||||
self.numberNodes = numberNodes
|
||||
@ -17,6 +17,8 @@ class Shape:
|
||||
self.netDegree = netDegree
|
||||
self.custodyRows = custodyRows
|
||||
self.custodyCols = custodyCols
|
||||
self.minCustodyRows = minCustodyRows
|
||||
self.minCustodyCols = minCustodyCols
|
||||
self.bwUplinkProd = bwUplinkProd
|
||||
self.nodeTypes = nodeTypes
|
||||
self.nodeClasses = [0] + [_k for _k in nodeTypes["classes"].keys()]
|
||||
@ -34,6 +36,8 @@ class Shape:
|
||||
shastr += "-fr-"+str(self.failureRate)
|
||||
shastr += "-cusr-"+str(self.custodyRows)
|
||||
shastr += "-cusc-"+str(self.custodyCols)
|
||||
shastr += "-mcusr-"+str(self.minCustodyRows)
|
||||
shastr += "-mcusc-"+str(self.minCustodyCols)
|
||||
shastr += "-bwupprod-"+str(self.bwUplinkProd)
|
||||
shastr += "-nd-"+str(self.netDegree)
|
||||
shastr += "-r-"+str(self.run)
|
||||
|
@ -76,6 +76,8 @@ proposerPublishToC = "shape.netDegree"
|
||||
validatorBasedCustody = False
|
||||
custodyRows = range(2, 3, 2)
|
||||
custodyCols = range(2, 3, 2)
|
||||
minCustodyRows = range(2, 3, 2)
|
||||
minCustodyCols = range(2, 3, 2)
|
||||
|
||||
# Set uplink bandwidth in megabits/second
|
||||
bwUplinksProd = [200]
|
||||
@ -146,11 +148,11 @@ colsK = range(32, 65, 128)
|
||||
rowsK = range(32, 65, 128)
|
||||
|
||||
def nextShape():
|
||||
for nbCols, nbColsK, nbRows, nbRowsK, run, fm, fr, mn, chR, chC, nn, netDegree, bwUplinkProd, nodeTypes in itertools.product(
|
||||
cols, colsK, rows, rowsK, runs, failureModels, failureRates, maliciousNodes, custodyRows, custodyCols, numberNodes, netDegrees, bwUplinksProd, nodeTypesGroup):
|
||||
for nbCols, nbColsK, nbRows, nbRowsK, run, fm, fr, mn, chR, chC, minChR, minChC, nn, netDegree, bwUplinkProd, nodeTypes in itertools.product(
|
||||
cols, colsK, rows, rowsK, runs, failureModels, failureRates, maliciousNodes, custodyRows, custodyCols, minCustodyRows, minCustodyCols, numberNodes, netDegrees, bwUplinksProd, nodeTypesGroup):
|
||||
# Network Degree has to be an even number
|
||||
if netDegree % 2 == 0:
|
||||
shape = Shape(nbCols, nbColsK, nbRows, nbRowsK, nn, fm, fr, mn, chR, chC, netDegree, bwUplinkProd, run, nodeTypes)
|
||||
shape = Shape(nbCols, nbColsK, nbRows, nbRowsK, nn, fm, fr, mn, chR, chC, minChR, minChC, netDegree, bwUplinkProd, run, nodeTypes)
|
||||
yield shape
|
||||
|
||||
def evalConf(self, param, shape = None):
|
||||
|
Loading…
x
Reference in New Issue
Block a user