Skip to content
Snippets Groups Projects
Commit 43d9ef66 authored by Erik Nygren's avatar Erik Nygren :bullettrain_front:
Browse files

decrease optical size of levels

@adrian please fix visuals.. ,)
parent 4928e906
No related branches found
No related tags found
No related merge requests found
...@@ -842,6 +842,7 @@ def sparse_rail_generator(num_cities=100, num_intersections=10, num_trainstation ...@@ -842,6 +842,7 @@ def sparse_rail_generator(num_cities=100, num_intersections=10, num_trainstation
node_positions = [] node_positions = []
city_positions = [] city_positions = []
intersection_positions = [] intersection_positions = []
for node_idx in range(num_cities + num_intersections): for node_idx in range(num_cities + num_intersections):
to_close = True to_close = True
tries = 0 tries = 0
......
...@@ -52,10 +52,10 @@ class PILGL(GraphicsLayer): ...@@ -52,10 +52,10 @@ class PILGL(GraphicsLayer):
self.background_grid = np.zeros(shape=(self.width, self.height)) self.background_grid = np.zeros(shape=(self.width, self.height))
if jupyter is False: if jupyter is False:
# NOTE: Currently removed the dependency on # NOTE: Currently removed the dependency on
# screeninfo. We have to find an alternate # screeninfo. We have to find an alternate
# way to compute the screen width and height # way to compute the screen width and height
# In the meantime, we are harcoding the 800x600 # In the meantime, we are harcoding the 800x600
# assumption # assumption
self.screen_width = 800 self.screen_width = 800
self.screen_height = 600 self.screen_height = 600
...@@ -114,7 +114,7 @@ class PILGL(GraphicsLayer): ...@@ -114,7 +114,7 @@ class PILGL(GraphicsLayer):
for rc in dTargets: for rc in dTargets:
r = rc[1] r = rc[1]
c = rc[0] c = rc[0]
d = int(np.floor(np.sqrt((x - r) ** 2 + (y - c) ** 2))) d = int(np.floor(np.sqrt((x - r) ** 2 + (y - c) ** 2)) / 0.5)
distance = min(d, distance) distance = min(d, distance)
self.background_grid[x][y] = distance self.background_grid[x][y] = distance
...@@ -444,7 +444,7 @@ class PILSVG(PILGL): ...@@ -444,7 +444,7 @@ class PILSVG(PILGL):
for transition, file in file_directory.items(): for transition, file in file_directory.items():
# Translate the ascii transition description in the format "NE WS" to the # Translate the ascii transition description in the format "NE WS" to the
# binary list of transitions as per RailEnv - NESW (in) x NESW (out) # binary list of transitions as per RailEnv - NESW (in) x NESW (out)
transition_16_bit = ["0"] * 16 transition_16_bit = ["0"] * 16
for sTran in transition.split(" "): for sTran in transition.split(" "):
......
...@@ -25,15 +25,15 @@ def test_realistic_rail_generator(): ...@@ -25,15 +25,15 @@ def test_realistic_rail_generator():
def test_sparse_rail_generator(): def test_sparse_rail_generator():
env = RailEnv(width=50, env = RailEnv(width=50,
height=50, height=50,
rail_generator=sparse_rail_generator(num_cities=2, # Number of cities in map rail_generator=sparse_rail_generator(num_cities=3, # Number of cities in map
num_intersections=3, # Number of interesections in map num_intersections=2, # Number of interesections in map
num_trainstations=5, # Number of possible start/targets on map num_trainstations=15, # Number of possible start/targets on map
min_node_dist=10, # Minimal distance of nodes min_node_dist=6, # Minimal distance of nodes
node_radius=2, # Proximity of stations to city center node_radius=3, # Proximity of stations to city center
num_neighb=3, # Number of connections to other cities num_neighb=2, # Number of connections to other cities
seed=5, # Random seed seed=5, # Random seed
), ),
number_of_agents=0, number_of_agents=10,
obs_builder_object=GlobalObsForRailEnv()) obs_builder_object=GlobalObsForRailEnv())
# reset to initialize agents_static # reset to initialize agents_static
env_renderer = RenderTool(env, gl="PILSVG", ) env_renderer = RenderTool(env, gl="PILSVG", )
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment