/ DAS / shape.py
shape.py
 1  #!/bin/python3
 2  
 3  class Shape:
 4      """This class represents a set of parameters for a specific simulation."""
 5  
 6      def __init__(self, blockSizeR, blockSizeRK, blockSizeC, blockSizeCK,
 7                   numberNodes, failureModel, failureRate, class1ratio, chiR, chiC, vpn1, vpn2, netDegree, bwUplinkProd, bwUplink1, bwUplink2, run):
 8          """Initializes the shape with the parameters passed in argument."""
 9          self.run = run
10          self.numberNodes = numberNodes
11          self.blockSizeR = blockSizeR
12          self.blockSizeRK = blockSizeRK
13          self.blockSizeC = blockSizeC
14          self.blockSizeCK = blockSizeCK
15          self.failureModel = failureModel
16          self.failureRate = failureRate
17          self.netDegree = netDegree
18          self.class1ratio = class1ratio
19          self.chiR = chiR
20          self.chiC = chiC
21          self.vpn1 = vpn1
22          self.vpn2 = vpn2
23          self.bwUplinkProd = bwUplinkProd
24          self.bwUplink1 = bwUplink1
25          self.bwUplink2 = bwUplink2
26          self.randomSeed = ""
27  
28      def __repr__(self):
29          """Returns a printable representation of the shape"""
30          shastr = ""
31          shastr += "bsrn-"+str(self.blockSizeR)
32          shastr += "-bsrk-"+str(self.blockSizeRK)
33          shastr += "-bscn-"+str(self.blockSizeC)
34          shastr += "-bsck-"+str(self.blockSizeCK)
35          shastr += "-nn-"+str(self.numberNodes)
36          shastr += "-fm-"+str(self.failureModel)
37          shastr += "-fr-"+str(self.failureRate)
38          shastr += "-c1r-"+str(self.class1ratio)
39          shastr += "-chir-"+str(self.chiR)
40          shastr += "-chic-"+str(self.chiC)
41          shastr += "-vpn1-"+str(self.vpn1)
42          shastr += "-vpn2-"+str(self.vpn2)
43          shastr += "-bwupprod-"+str(self.bwUplinkProd)
44          shastr += "-bwup1-"+str(self.bwUplink1)
45          shastr += "-bwup2-"+str(self.bwUplink2)
46          shastr += "-nd-"+str(self.netDegree)
47          shastr += "-r-"+str(self.run)
48          return shastr
49  
50      def setSeed(self, seed):
51          """Adds the random seed to the shape"""
52          self.randomSeed = seed
53