def setUp(self): self.inputdata_file_name = "test/utility/test_data/test_devices_for_json_file.inputdata" self.csv_file_name = "test/utility/test_data/test_allocation_plan_to_csv.csv" self.all_time_cloudlets = create_all_time_cloudlets(10, 10, 10) self.devices = [Device(name="d1"), Device(name="d2"), Device(name="d3")] self.allocation_plan = { "d1": [Allocation(0, 0, 0), Allocation(0, 0, 1), Allocation(0, 0, 3)], "d2": [Allocation(0, 0, 1), Allocation(0, 0, 1), Allocation(0, 0, 3)], "d3": [Allocation(0, 0, 3), Allocation(0, 0, 2), Allocation(0, 0, 2)], "d4": [Allocation(0, 0, 0), Allocation(0, 0, 4), Allocation(0, 0, 4)] } data.input_data_to_file(self.all_time_cloudlets, self.devices, self.inputdata_file_name)
r_num = 6 else: r_num = int(ans) ans = input("density(default={}): ".format(1)) if ans == "": density = 1 else: density = int(ans) ans = input("unit per road(default={}): ".format(3)) if ans == "": upr = 3 else: upr = int(ans) ds = eval(device_creater)(p_min, p_max, int(t_length / 2), ur_min, ur_max, r_num=r_num, density=density, upr=upr) header["r_num"] = r_num header["density"] = density header["upr"] = upr else: ds = eval(device_creater)(p_min, p_max, t_length, ur_min, ur_max) # 説明文 ans = input("description:") # データの書き出し header["description"] = ans header["devices_create_algorithm"] = device_creater header["d_num"] = len(ds) path = input_data_to_file(header, atcs, ds, "plane-cross") print("outputed -> {}".format(path))
d = Device(name=d_name) d.use_resource = random.randint(min_use_resource, max_use_resource) d.startup_time = t if random.randint(0, 3) == 0: roads = list(filter(lambda r: r != road, setup_roads)) r = roads[random.randint(0, len(roads) - 1)] if random.randint(0, 1) == 0: d.plan = route(left_side, r[1]) else: d.plan = route(right_side, r[1]) else: if random.randint(0, 1) == 0: d.plan = route(left_side, right_side) else: d.plan = route(right_side, left_side) devices.append(d) d_num += 1 header = { "device_num": d_num, "t_length": 30, "x_length": 30, "y_length": 30, "c_max_resource": 5, "max_road_device_num": 6 } path = input_data_to_file(header, atcs, devices, "inputdata_03") print("outputed -> {}".format(path))
if n == 0: d.plan = route(Point(0, 0), Point(x_len, y_len)) if n == 1: d.plan = route(Point(x_len, y_len), Point(0, 0)) if n == 2: d.plan = route(Point(0, y_len), Point(x_len, 0)) if n == 3: d.plan = route(Point(y_len, 0), Point(0, x_len)) n = random.randint(0, 2) if n == 0: #app = Application(name="a1") d.use_resource = 1 elif n == 1: #app = Application(name="a2") d.use_resource = 1 else: #app = Application(name="a3") d.use_resource = 1 #d.append_app(app) devices.append(d) header = { "device_num": d_num, "t_length": t_len, "x_length": x_len, "y_length": y_len, } path = input_data_to_file(header, atcs, devices, "fukunaga") print("outputed -> {}".format(path))
if random.randint(0, 1) == 0: d.plan = route(side_a, r[goal]) else: d.plan = route(side_b, r[goal]) else: if random.randint(0, 1) == 0: d.plan = route(side_a, side_b) else: d.plan = route(side_b, side_a) devices.append(d) d_num += 1 print(da_num) print(ca_num) header = { "device_num": d_num, "t_length": 30, "x_length": 30, "y_length": 30, "min_road_device_num": min_road_device_num, "max_road_device_num": max_road_device_num, "min_use_resource": min_use_resource, "max_use_resource": max_use_resource, "c_resource": c_resource, "app_name": app_name, "app_resourse": app_resourse } random.shuffle(devices) path = input_data_to_file(header, atcs, devices, "ieeei-d90") print("outputed -> {}".format(path))
goal = random.randint(1, 2) if random.randint(0, 1) == 0: d.plan = route(side_a, r[goal]) else: d.plan = route(side_b, r[goal]) else: if random.randint(0, 1) == 0: d.plan = route(side_a, side_b) else: d.plan = route(side_b, side_a) devices.append(d) d_num += 1 print(da_num) print(ca_num) header = { "device_num": d_num, "t_length": 30, "x_length": 30, "y_length": 30, "min_road_device_num": min_road_device_num, "max_road_device_num": max_road_device_num, "min_use_resource": min_use_resource, "max_use_resource": max_use_resource, "c_resource": c_resource, "app_name": app_name, "app_resourse": app_resourse } random.shuffle(devices) path = input_data_to_file(header, atcs, devices, "inputdata_fk-p4-Nodevi-d110") print("outputed -> {}".format(path))