Skip to content

Commit

Permalink
fix: rendering in cvrp and tsp (#251)
Browse files Browse the repository at this point in the history
  • Loading branch information
sash-a authored Nov 1, 2024
1 parent 85333d7 commit ea23c44
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 3 deletions.
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ include LICENSE
include requirements/*
recursive-include * *.npy
recursive-include jumanji *.png
recursive-include jumanji *.jpeg

# remove the test specific files
recursive-exclude * *_test.py
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 5 additions & 1 deletion jumanji/environments/routing/cvrp/viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import matplotlib.animation
import matplotlib.pyplot as plt
import numpy as np
import pkg_resources
from chex import Array
from numpy.typing import NDArray

Expand Down Expand Up @@ -146,7 +147,10 @@ def _prepare_figure(self, ax: plt.Axes) -> None:
ax.set_ylim(0, 1)
ax.get_xaxis().set_visible(False)
ax.get_yaxis().set_visible(False)
map_img = plt.imread("docs/img/city_map.jpeg")
img_path = pkg_resources.resource_filename(
"jumanji", "environments/routing/cvrp/img/city_map.jpeg"
)
map_img = plt.imread(img_path)
ax.imshow(map_img, extent=[0, 1, 0, 1])

def _group_tour(self, tour: Array) -> list:
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 6 additions & 1 deletion jumanji/environments/routing/multi_cvrp/viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import matplotlib.animation
import matplotlib.pyplot as plt
import numpy as np
import pkg_resources
from numpy.typing import NDArray

import jumanji.environments
Expand Down Expand Up @@ -158,7 +159,11 @@ def _prepare_figure(self, ax: plt.Axes) -> None:
ax.set_ylim(0, 1)
ax.get_xaxis().set_visible(False)
ax.get_yaxis().set_visible(False)
map_img = plt.imread("docs/img/city_map.jpeg")

img_path = pkg_resources.resource_filename(
"jumanji", "environments/routing/multi_cvrp/img/city_map.jpeg"
)
map_img = plt.imread(img_path)
ax.imshow(map_img, extent=[0, 1, 0, 1])

def _group_tour(self, tour: chex.Array) -> list:
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 5 additions & 1 deletion jumanji/environments/routing/tsp/viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import matplotlib.animation
import matplotlib.pyplot as plt
import numpy as np
import pkg_resources
from numpy.typing import NDArray

import jumanji.environments
Expand Down Expand Up @@ -134,7 +135,10 @@ def _prepare_figure(self, ax: plt.Axes) -> None:
ax.set_ylim(0, 1)
ax.get_xaxis().set_visible(False)
ax.get_yaxis().set_visible(False)
map_img = plt.imread("docs/img/city_map.jpeg")
img_path = pkg_resources.resource_filename(
"jumanji", "environments/routing/tsp/img/city_map.jpeg"
)
map_img = plt.imread(img_path)
ax.imshow(map_img, extent=[0, 1, 0, 1])

def _add_tour(self, ax: plt.Axes, state: State) -> None:
Expand Down

0 comments on commit ea23c44

Please sign in to comment.