def __init__(self): self.round = 0 self.infected = {} self.susceptible = set() self.leaf_nodes = set() self.super_nodes = set() self.pool = Pool(1) self.net = network.Network() # self.args = args self.n = max_nodes self.e = 100 self.args = lambda x: None self.args.restructure = None self.args.D = None self.args.plot = False self.below_bw_nodes = 0 # self.b = self.args.gateway # self.P = self.args.processes self.feasible_links = [] if minbw: self.B = tuple(map(float, minbw.split(' '))) if restructure: self.R = tuple(map(int, restructure.split(' '))) self.V = view_extra self.dataset = None wifi.default_channel_width = channel_width if not seed: self.random_seed = random.randint(1, 10000) else: self.random_seed = seed self.debug_file = None random.seed(self.random_seed) self.net.set_maxdev(max_dev) self.datafolder = base_folder + "data/" self.graphfolder = base_folder + "graph/" self.mapfolder = base_folder + "map/" self.BI = FakeBuildingInterface(buildings) # self.polygon_area = self.BI.get_province_area(self.dataset) self.event_counter = 0 self.noloss_cache = defaultdict(set) ubnt.load_devices() self.show_level = 0 self.db_nodes = {} self.waiting_nodes = set() self.gw = None self.ignored = set() self.sb = Susceptible_Buffer() self.polygon_area = Polygon([(20, 20), (20, -20), (-20, 20), (-20, -20)]) self.max_dev = max_dev self.CI = cost_interface
def __init__(self, args, unk_args=None): self.sb = Susceptible_Buffer() super().__init__(args=args, unk_args=unk_args) self._post_init()
def __init__(self, args, unk_args=None): self.sb = Susceptible_Buffer() CN_Generator.__init__(self, args=args, unk_args=unk_args) self.feasible_links = [] self._post_init()
radius = None if (args.radius is None or args.radius < 0) else args.radius if args.dataset is not None and args.gateway is not None and radius is not None: if radius != 0: try: with open("gws.yml", "r") as gwf: gwd = yaml.load(gwf, Loader=yaml.FullLoader) try: position = gwd['gws'][args.dataset][args.gateway] except IndexError: raise NoGWError("Index %d is out of range" % args.gateway) except KeyError: raise NoGWError("Dataset %s is not in gw file" % args.dataset) gw_pos = Point(float(position[1]), float(position[0])) sb = Susceptible_Buffer() sb.set_shape([gw_pos]) geom = from_shape(sb.get_buffer(radius), srid=4326) except Exception as e: die("Failed to get gateway: %r" % e) elif args.dataset is not None: try: area = bi.get_province_area(args.dataset) if area is None: raise Exception("None area obj") geom = from_shape(area, 4326) except Exception as e: die("Failed to get province area: %r" % e) try: populator = POPULATORS[args.populator] except KeyError: