Validator node: add nodeClass property
Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
This commit is contained in:
parent
ff93161b8d
commit
894009b414
|
@ -61,12 +61,14 @@ class Validator:
|
||||||
self.logger.error("Chi has to be smaller than %d" % self.shape.blockSize, extra=self.format)
|
self.logger.error("Chi has to be smaller than %d" % self.shape.blockSize, extra=self.format)
|
||||||
else:
|
else:
|
||||||
if amIproposer:
|
if amIproposer:
|
||||||
|
self.nodeClass = 0
|
||||||
self.rowIDs = range(shape.blockSize)
|
self.rowIDs = range(shape.blockSize)
|
||||||
self.columnIDs = range(shape.blockSize)
|
self.columnIDs = range(shape.blockSize)
|
||||||
else:
|
else:
|
||||||
#if shape.deterministic:
|
#if shape.deterministic:
|
||||||
# random.seed(self.ID)
|
# random.seed(self.ID)
|
||||||
self.vpn = self.shape.vpn1 if (self.ID <= shape.numberNodes * shape.class1ratio) else self.shape.vpn2
|
self.nodeClass = 1 if (self.ID <= shape.numberNodes * shape.class1ratio) else 2
|
||||||
|
self.vpn = self.shape.vpn1 if (self.nodeClass == 1) else self.shape.vpn2
|
||||||
self.rowIDs = rows if rows else unionOfSamples(range(self.shape.blockSize), self.shape.chi, self.vpn)
|
self.rowIDs = rows if rows else unionOfSamples(range(self.shape.blockSize), self.shape.chi, self.vpn)
|
||||||
self.columnIDs = columns if columns else unionOfSamples(range(self.shape.blockSize), self.shape.chi, self.vpn)
|
self.columnIDs = columns if columns else unionOfSamples(range(self.shape.blockSize), self.shape.chi, self.vpn)
|
||||||
self.rowNeighbors = collections.defaultdict(dict)
|
self.rowNeighbors = collections.defaultdict(dict)
|
||||||
|
@ -83,7 +85,7 @@ class Validator:
|
||||||
# TODO: this should be a parameter
|
# TODO: this should be a parameter
|
||||||
if self.amIproposer:
|
if self.amIproposer:
|
||||||
self.bwUplink = shape.bwUplinkProd
|
self.bwUplink = shape.bwUplinkProd
|
||||||
elif self.ID <= shape.numberNodes * shape.class1ratio:
|
elif self.nodeClass == 1:
|
||||||
self.bwUplink = shape.bwUplink1
|
self.bwUplink = shape.bwUplink1
|
||||||
else:
|
else:
|
||||||
self.bwUplink = shape.bwUplink2
|
self.bwUplink = shape.bwUplink2
|
||||||
|
|
Loading…
Reference in New Issue