Skip to content

Commit

Permalink
Attempt to fix non-determinism.
Browse files Browse the repository at this point in the history
  • Loading branch information
Gamenot committed Jan 30, 2024
1 parent 4b98358 commit 92c7a2c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 0 additions & 1 deletion smarts/core/local_traffic_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ class LocalTrafficProvider(TrafficProvider):

def __init__(self):
self._logger = logging.getLogger(self.__class__.__name__)
self._logger.setLevel(logging.DEBUG)
self._sim = None
self._scenario = None
self.road_map: RoadMap = None
Expand Down
4 changes: 3 additions & 1 deletion smarts/core/sumo_road_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,9 @@ def nearest_roads(self, point: Point, radius: float):
x = point[0]
y = point[1]
r = radius
edges: List[sumolib.net.edge.Edge] = self._graph.getEdges()
edges: List[sumolib.net.edge.Edge] = sorted(
self._graph.getEdges(), key=lambda e: e.getID()
)
if self._rtree_roads is None:
self._rtree_roads = self._init_rtree(edges)
near_roads: List[RoadMap.Road] = []
Expand Down
2 changes: 1 addition & 1 deletion smarts/env/tests/test_determinism.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def test_short_determinism():
def test_long_determinism():
max_steps_per_episode = 55000
episode_count = 1
capture_step = 13750
capture_step = 3750
scenarios = "scenarios/sumo/intersections/2lane"
determinism(
agent_spec(max_steps_per_episode), scenarios, episode_count, capture_step
Expand Down

0 comments on commit 92c7a2c

Please sign in to comment.