Skip to content

Don't artificially limit the rendering axes for CVRP environment #264

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ngastzepeda
Copy link
Contributor

Description

Commented our the two lines of code that set the limits for the x and y axis, respectively.

Motivation and Context

Assuming all locs would be scaled to [0,1] let to rendering problems for instances that were not in fact scaled to [0,1].

Closes #258 .

Types of changes

What types of changes does your code introduce? Remove all that do not apply:

  • Bug fix (non-breaking change which fixes an issue)

Checklist

Go over all the following points, and put an x in all the boxes that apply.
If you are unsure about any of these, don't hesitate to ask. We are here to help!

  • My change requires a change to the documentation.
  • I have updated the tests accordingly (required for a bug fix or a new feature).
  • I have updated the documentation accordingly.

@ngastzepeda
Copy link
Contributor Author

Set to draft for now, as we may choose to find a better solution than just not setting the axis limits.

@fedebotu
Copy link
Member

fedebotu commented Apr 10, 2025

Sounds good!
I am also thinking about a more systematic change:
How about we never impose any artificial limit in the render function, but instead return the ax?

For example:

def render(td, ..., return_ax=False):
   # Main function
   # ... 
   if return_ax:
      return ax

In this way, users can directly modify the plot style (including setting the x_lim and y_lim) afterwards:

ax = env.render(td, ..., return_ax=True):
ax.set_xlim(0, 1)
ax.set_ylim(0, 1)

WDYT?

cc @Estalisium, this should solve the plotting issue!

@fedebotu fedebotu requested a review from cbhua April 10, 2025 06:41
@ngastzepeda
Copy link
Contributor Author

Sounds good! I am also thinking about a more systematic change: How about we never impose any artificial limit in the render function, but instead return the ax?

For example:

def render(td, ..., return_ax=False):
   # Main function
   # ... 
   if return_ax:
      return ax

In this way, users can directly modify the plot style (including setting the x_lim and y_lim) afterwards:

ax = env.render(td, ..., return_ax=True):
ax.set_xlim(0, 1)
ax.set_ylim(0, 1)

WDYT?

cc @Estalisium, this should solve the plotting issue!

I have not tested this, but feel free to push to this branch @fedebotu :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] plotting out of scale
2 participants