2023-01-23 17:04:54 +00:00
|
|
|
#!/bin/python3
|
|
|
|
|
|
|
|
class Shape:
|
2023-02-15 14:06:42 +00:00
|
|
|
"""This class represents a set of parameters for a specific simulation."""
|
2023-01-23 17:04:54 +00:00
|
|
|
|
2023-03-03 17:41:12 +00:00
|
|
|
def __init__(self, blockSize, numberValidators, failureRate, chi, netDegree, bwUplink, run):
|
2023-02-15 14:06:42 +00:00
|
|
|
"""Initializes the shape with the parameters passed in argument."""
|
2023-01-25 20:51:59 +00:00
|
|
|
self.run = run
|
2023-01-23 17:04:54 +00:00
|
|
|
self.numberValidators = numberValidators
|
|
|
|
self.blockSize = blockSize
|
2023-01-25 20:51:59 +00:00
|
|
|
self.failureRate = failureRate
|
2023-01-23 17:04:54 +00:00
|
|
|
self.netDegree = netDegree
|
|
|
|
self.chi = chi
|
2023-03-15 12:18:02 +00:00
|
|
|
self.randomSeed = ""
|
2023-03-03 17:41:12 +00:00
|
|
|
self.bwUplink = bwUplink
|
2023-01-23 17:04:54 +00:00
|
|
|
|
2023-03-15 11:37:23 +00:00
|
|
|
def __repr__(self):
|
|
|
|
"""Returns a printable representation of the shape"""
|
|
|
|
shastr = ""
|
|
|
|
shastr += "bs-"+str(self.blockSize)
|
|
|
|
shastr += "-nbv-"+str(self.numberValidators)
|
|
|
|
shastr += "-fr-"+str(self.failureRate)
|
|
|
|
shastr += "-chi-"+str(self.chi)
|
2023-03-06 10:42:45 +00:00
|
|
|
shastr += "-bwu-"+str(self.bwUplink)
|
2023-03-15 11:37:23 +00:00
|
|
|
shastr += "-nd-"+str(self.netDegree)
|
|
|
|
shastr += "-r-"+str(self.run)
|
2023-03-15 12:18:02 +00:00
|
|
|
return shastr
|
2023-01-23 17:04:54 +00:00
|
|
|
|
2023-03-15 12:18:02 +00:00
|
|
|
def setSeed(self, seed):
|
|
|
|
"""Adds the random seed to the shape"""
|
|
|
|
self.randomSeed = seed
|
2023-01-23 17:04:54 +00:00
|
|
|
|