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

can't run baseline_rl.py #1

Closed
cihantugrulcicek opened this issue May 12, 2021 · 4 comments
Closed

can't run baseline_rl.py #1

cihantugrulcicek opened this issue May 12, 2021 · 4 comments

Comments

@cihantugrulcicek
Copy link

I wasn't able to run the baseline_rl.py. When I run the code with from_file=True, and providing x_dir and adj_dir,

  • First, I got a file not found error for the adj file. I guess this occurs as adj files start with adj- in the validation set. However, this is not specified in batch_env_rl.
  • Even though I rename the adj file with the same name of the x file, I got the following error on line 44 of 'batch_env_rl',
    'ValueError: could not broadcast input array from shape (20,3) into shape (50,3)', which seems that the number of nodes are not read from file, instead, read n_nodes argument in the constructor.
  • After passing 'n_nodes' argument with 'from_file=True', I still got the error Sizes of tensors must match except in dimension 1. Got 32 and 1 in dimension 0 (The offending index is 1) on line 54 in 'train_baseline.py'.
@paulorocosta
Copy link
Owner

paulorocosta commented May 14, 2021

Hi @cihantugrulcicek,
Thanks for bringing this to our attention.
I have updated the code to read from_file=True when using the batch_env_rl.
An example of how you can call it can be found below. Note that when reading files with a different number of nodes, the instance features are padded with zeros when the number of nodes is smaller than the maximum number of nodes in the files.

    import os
    base_dir = os.path.dirname(os.getcwd())
    x_dir = os.path.join(base_dir, 'data', 'valid', 'instances')
    adj_dir = os.path.join(base_dir, 'data', 'valid', 'adjs')
    batch_env = BatchEnvRL(n_envs=2, from_file=True, x_dir=x_dir, adj_dir=adj_dir)

Please let me know if this is working now.

Thanks again for your feedback!

@cihantugrulcicek
Copy link
Author

it works now.. thank you for quick respond

@cihantugrulcicek
Copy link
Author

cihantugrulcicek commented May 17, 2021 via email

@paulorocosta
Copy link
Owner

Hi @cihantugrulcicek,

Yes, our interpretation is that if you violate one of the time windows from above (you can still be early without any penalty) we deem the solution 'infeasible'.
This is also true for when you exceed maxT.
Note that if you only exceed the time windows a couple of times there is still a chance you can get a 'good' tour out of it even though it's 'infeasible'.
I hope this clarifies the matter.

Cheers,

Paulo

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

No branches or pull requests

2 participants