Skip to content
Snippets Groups Projects
utils.py 1.33 KiB
import math
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.patches as patches
import random


"""
Helper Functions
"""
# def create_random_starts_and_goals(Env, num_agents, filename="agents_0000.txt"):
#     """
#     Given some map file, create a set of starts and goals for the specified 
#     number of agents. This function will create a file folowing the agent file format.
#     """
#     from random import randrange

#     f = open(filename, "w")
#     f.write(str(num_agents) + "\n")

#     starts = []
#     goals = []

#     for i in range(num_agents):
#         # generate a random start
#         r = randrange(rows)
#         c = randrange(cols)
#         while obstacle_map[r][c] or [r,c] in starts:
#             r = randrange(rows)
#             c = randrange(cols)

#         f.write(str(r) + " " + str(c) + "\n")
#         starts.append([r,c])

#         # generate a random goal
#         r = randrange(rows)
#         c = randrange(cols)
#         while obstacle_map[r][c] or [r,c] in goals:
#             r = randrange(rows)
#             c = randrange(cols)
#         f.write(str(r) + " " + str(c) + "\n")
#         goals.append([r,c])

#     f.close()
#     return filename

def read_agents_from_file(fname):
    pass

def generate_random_agents(num_agents):
    pass

def read_environment_from_file(fname):
    pass