Code Monkey home page Code Monkey logo

pytorch-drl4vrp's People

Contributors

mveres01 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pytorch-drl4vrp's Issues

Different way of computing context

Hi, many thanks for the excellent code. I got one little question (please feel free to correct me):
In the paper, the authors compute context vector with attention vector * embedded inputs (static and dynamic hidden)

image

But in your code, you applied context vector computation with static hidden only and then cat it with static hidden:

image

I'm a little confused about this. May I ask if there is any particular reasons? Thank you!

time to train the model and how to use it for new cases

Hello,

I try to train the model but it took a very long time to finish. I wonder what is the final result after the training process. Will it give me a trained model? How can I use this model to calculate my case? For example 100 cities with given demands and their longitude and latitude.

Thank you very much!

Problem with the results plotting...

So I ran your code without making any modifications for vrp and 10 nodes (as well as 20)...and the graph looks as if there is only two nodes: depot and one more node...what is wrong?

Does not work under torch 1.0.1 version

Hi,

When I try to run trainer.py with the task = 'vrp', the error message as below comes up. is it a version issue? (device= 'cpu')

Traceback (most recent call last):
File "D:/LG_RL/pytorch-drl4vrp-master/trainer.py", line 390, in
train_vrp(args)
File "D:/LG_RL/pytorch-drl4vrp-master/trainer.py", line 348, in train_vrp
train(actor, critic, **kwargs)
File "D:/LG_RL/pytorch-drl4vrp-master/trainer.py", line 164, in train
tour_indices, tour_logp = actor(static, dynamic, x0)
File "C:\Users\hsko0\Anaconda3\lib\site-packages\torch\nn\modules\module.py", line 489, in call
result = self.forward(*input, **kwargs)
File "D:\LG_RL\pytorch-drl4vrp-master\model.py", line 224, in forward
dynamic = self.update_fn(dynamic, ptr.data)
File "D:\LG_RL\pytorch-drl4vrp-master\tasks\vrp.py", line 135, in update_dynamic
return torch.Tensor(tensor.data, device=dynamic.device)
TypeError: new(): data must be a sequence (got Tensor)

Process finished with exit code 1

Best,
Hyeseon

application results

Hi,
Sorry to raise an issue again.

I ran this code with checkpoint for vrp20 with load 30 and max demand 9 however the best result is 827(unit) for case A-N33-K5(optimal result is 661) most heuristic algorithm can get that result.

A-N33-K5 is a standard instance which has 33 nodes and vehicle capacity is 100.
you can download the case from this website. http://www.bernabe.dorronsoro.es/vrp/ I scaled down the coordinates to 0,1 range to avoid large numbers.

I tried a trained vrp37 weight with load 44 however the result is even worse.

In the application part I used 1 for the train-size and valid-size. I also tried A-N60-K9 but the result is 1943 and it is also far away from the optimal result( 1354)(I used the trained weight for VRP50)

I wonder how I can improve the result? Change the weight?Retrain the model? Is it due to the batch-size or learning rate? Or the model is not robust enough? ( I got a pretty good result when using the vrp20 weight on a vrp37 real case problem. I used to think the model is quite robust.)

Thank you so much for your time and help.

pytorch 1.0 error

Hello,

I have updated my pytorch to the latest 1.0 version but still use python 3.6
when I run the code I got the following tracebacks , I wonder if I can run the code with the latest pytorch 1.0? Thank you so much for your time and help!

Traceback (most recent call last):
File "C:\Users\Administrator\Desktop\pytorch-drl4vrp-master\trainer.py", line 390, in
train_vrp(args)
File "C:\Users\Administrator\Desktop\pytorch-drl4vrp-master\trainer.py", line 348, in train_vrp
train(actor, critic, **kwargs)
File "C:\Users\Administrator\Desktop\pytorch-drl4vrp-master\trainer.py", line 164, in train
tour_indices, tour_logp = actor(static, dynamic, x0)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\site-packages\torch\nn\modules\module.py", line 489, in call
result = self.forward(*input, **kwargs)
File "C:\Users\Administrator\Desktop\pytorch-drl4vrp-master\model.py", line 192, in forward
dynamic_hidden = self.dynamic_encoder(dynamic)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\site-packages\torch\nn\modules\module.py", line 489, in call
result = self.forward(*input, **kwargs)
File "C:\Users\Administrator\Desktop\pytorch-drl4vrp-master\model.py", line 17, in forward
output = self.conv(input)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\site-packages\torch\nn\modules\module.py", line 489, in call
result = self.forward(*input, **kwargs)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36\lib\site-packages\torch\nn\modules\conv.py", line 187, in forward
self.padding, self.dilation, self.groups)
RuntimeError: Expected object of scalar type Double but got scalar type Float for argument #2 'weight'

help me

all_demands[visit_idx, 0] = -1. + new_load[visit_idx].view(-1)

HELLO,thanks for your solid work.
Why does the demand for depot need to be reduced? Can you tell me the practical significance and function of this line of code.

split-delivery

Hi,
In the paper, the author mentioned if the whole delivery constraint is relaxed the result will get better.

However if I omit the constraint( demands.lt(load) the result is always worse. even if I try to retrain the model.

In the paper even for the greedy, split delivery is better than whole delivery.

Do you know what may cause the difference here?

Thank you very much for your help!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.