def objfun(x, *arg): robots = arg[0] tasks = arg[1] alpha = x[0] beta = x[1] gamma = x[2] zeta = [3] MRTA = MultiRobotTaskAllocation(robots, tasks) func = MRTA.run(alpha, beta, gamma, zeta) return func
def objfun(alpha, beta, gamma, zeta): robots = np.load("random_initial_robots.npy") tasks = np.load("random_initial_tasks.npy") MRTA = MultiRobotTaskAllocation(robots, tasks) func = -MRTA.run(alpha, beta, gamma, zeta) return func
# sample_tasks = np.concatenate((sample_tasks, np.random.rand(num_tasks, 1)*100), axis=1) # battery level information # sample_tasks = np.concatenate((sample_tasks, np.random.randint(1, 3, (num_tasks, 1))*0.1), axis=1) # energy efficiency information # sample_tasks = np.concatenate((sample_tasks, np.random.randint(0, num_types, (num_tasks, num_types))), axis=1) # type information # sample_tasks = np.insert(sample_tasks, 4, 0, axis=1) # charging station task # print(sample_tasks) # np.save("random_initial_tasks", sample_tasks) sample_tasks = np.load("random_initial_tasks.npy") # print(sample_tasks) # np.savetxt("random_initial_tasks.txt", sample_tasks) # print(sample_tasks) # aergvare print("sample robots: \n", sample_robots) print("sample tasks: \n", sample_tasks) MRTA = MultiRobotTaskAllocation(sample_robots, sample_tasks) # MRTA.run() def objfun(x, *arg): robots = arg[0] tasks = arg[1] alpha = x[0] beta = x[1] gamma = x[2] zeta = [3] MRTA = MultiRobotTaskAllocation(robots, tasks) func = MRTA.run(alpha, beta, gamma, zeta) return func
# [0, 23, 10, 0, 0, 0, 0, 0, 0, 0], # [0, 23, 10, 0, 0, 0, 0, 0, 0, 0], # [0, 23, 10, 0, 0, 0, 0, 0, 0, 0], # [0, 23, 10, 0, 0, 0, 0, 0, 0, 0], # [0, 23, 10, 0, 0, 0, 0, 0, 0, 0] # ]) # # randomly generated objectives: # sample_tasks = np.transpose([np.linspace(0, num_tasks-1, num=num_tasks, axis=0)]) # task index # # print(sample_tasks) # sample_tasks = np.concatenate((sample_tasks, np.random.rand(num_tasks, 2)*10), axis=1) # position information # sample_tasks = np.concatenate((sample_tasks, np.random.rand(num_tasks, 1)*100), axis=1) # battery level information # sample_tasks = np.concatenate((sample_tasks, np.random.randint(1, 3, (num_tasks, 1))*0.1), axis=1) # energy efficiency information # sample_tasks = np.concatenate((sample_tasks, np.random.randint(0, num_types, (num_tasks, num_types))), axis=1) # type information # sample_tasks = np.insert(sample_tasks, 4, 0, axis=1) # charging station task # print(sample_tasks) # np.save("random_initial_tasks", sample_tasks) sample_tasks = np.load("random_initial_tasks.npy") # print(sample_tasks) # np.savetxt("random_initial_tasks.txt", sample_tasks) # print(sample_tasks) # aergvare print("sample robots: \n", sample_robots) print("sample tasks: \n", sample_tasks) MRTA = MultiRobotTaskAllocation(sample_robots, sample_tasks, save_data=True) MRTA.run(2.2867975297601477, 1.2172393070417535, -1.2983878440623928, -8.620057169901632)