Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: rendering in cvrp and tsp #251

Merged
merged 4 commits into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading