Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/Rintarooo/VRP_MHA
Browse files Browse the repository at this point in the history
  • Loading branch information
Rintarooo committed Aug 20, 2020
2 parents fcfb118 + 748bf38 commit f3f1110
Show file tree
Hide file tree
Showing 13 changed files with 345 additions and 2 deletions.
319 changes: 319 additions & 0 deletions PyTorch/Csv/VRP20_train_0821_00_58.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,319 @@
time,epoch,batch,loss,cost
3min55sec,0,0,-1.483,14.204
0min1sec,0,10,29.913,12.038
0min1sec,0,20,21.958,11.255
0min1sec,0,30,17.109,10.689
0min1sec,0,40,13.896,10.266
0min1sec,0,50,11.683,9.930
0min1sec,0,60,9.994,9.660
0min1sec,0,70,8.711,9.443
0min1sec,0,80,7.670,9.271
0min1sec,0,90,6.865,9.129
0min1sec,0,100,6.240,9.007
0min1sec,0,110,5.706,8.902
0min1sec,0,120,5.237,8.812
0min1sec,0,130,4.851,8.732
0min1sec,0,140,4.522,8.661
0min1sec,0,150,4.223,8.598
0min1sec,0,160,3.956,8.542
0min1sec,0,170,3.720,8.493
0min1sec,0,180,3.510,8.447
0min1sec,0,190,3.329,8.407
0min1sec,0,200,3.171,8.369
0min1sec,0,210,3.024,8.334
0min1sec,0,220,2.888,8.301
0min1sec,0,230,2.764,8.270
0min1sec,0,240,2.654,8.241
0min1sec,0,250,2.544,8.214
0min1sec,0,260,2.454,8.189
0min1sec,0,270,2.365,8.165
0min1sec,0,280,2.278,8.142
0min1sec,0,290,2.200,8.120
0min1sec,0,300,2.136,8.098
0min1sec,0,310,2.060,8.079
0min1sec,0,320,2.001,8.061
0min1sec,0,330,1.938,8.044
0min1sec,0,340,1.882,8.028
0min1sec,0,350,1.829,8.013
0min1sec,0,360,1.776,7.998
0min1sec,0,370,1.730,7.983
0min1sec,0,380,1.690,7.968
0min1sec,0,390,1.645,7.953
0min1sec,0,400,1.595,7.940
0min1sec,0,410,1.556,7.927
0min1sec,0,420,1.512,7.916
0min1sec,0,430,1.476,7.905
0min1sec,0,440,1.445,7.894
0min1sec,0,450,1.410,7.884
0min1sec,0,460,1.380,7.874
0min1sec,0,470,1.353,7.864
0min1sec,0,480,1.323,7.854
0min1sec,0,490,1.292,7.844
0min1sec,0,500,1.267,7.835
0min1sec,0,510,1.245,7.825
0min1sec,0,520,1.216,7.816
0min1sec,0,530,1.194,7.807
0min1sec,0,540,1.169,7.799
0min1sec,0,550,1.146,7.791
0min1sec,0,560,1.127,7.783
0min1sec,0,570,1.106,7.775
0min1sec,0,580,1.092,7.768
0min1sec,0,590,1.074,7.760
0min1sec,0,600,1.051,7.754
0min1sec,0,610,1.037,7.747
0min1sec,0,620,1.020,7.741
0min1sec,0,630,1.005,7.734
0min1sec,0,640,0.987,7.728
0min1sec,0,650,0.972,7.723
0min1sec,0,660,0.962,7.717
0min1sec,0,670,0.946,7.711
0min1sec,0,680,0.932,7.705
0min1sec,0,690,0.918,7.700
0min1sec,0,700,0.903,7.695
0min1sec,0,710,0.893,7.690
0min1sec,0,720,0.882,7.685
0min1sec,0,730,0.873,7.680
0min1sec,0,740,0.859,7.675
0min1sec,0,750,0.850,7.670
0min1sec,0,760,0.838,7.665
0min1sec,0,770,0.827,7.660
0min1sec,0,780,0.815,7.656
0min1sec,0,790,0.805,7.652
0min1sec,0,800,0.797,7.648
0min1sec,0,810,0.783,7.644
0min1sec,0,820,0.776,7.640
0min1sec,0,830,0.767,7.636
0min1sec,0,840,0.757,7.632
0min1sec,0,850,0.748,7.628
0min1sec,0,860,0.739,7.624
0min1sec,0,870,0.730,7.621
0min1sec,0,880,0.722,7.617
0min1sec,0,890,0.713,7.613
0min1sec,0,900,0.705,7.609
0min1sec,0,910,0.698,7.606
0min1sec,0,920,0.691,7.602
0min1sec,0,930,0.684,7.599
0min1sec,0,940,0.679,7.596
0min1sec,0,950,0.672,7.592
0min1sec,0,960,0.668,7.589
0min1sec,0,970,0.663,7.585
0min1sec,0,980,0.658,7.582
0min1sec,0,990,0.652,7.578
0min1sec,0,1000,0.647,7.575
0min1sec,0,1010,0.640,7.572
0min1sec,0,1020,0.636,7.568
0min1sec,0,1030,0.630,7.565
0min1sec,0,1040,0.624,7.562
0min1sec,0,1050,0.619,7.559
0min1sec,0,1060,0.612,7.556
0min1sec,0,1070,0.609,7.553
0min1sec,0,1080,0.604,7.550
0min1sec,0,1090,0.599,7.547
0min1sec,0,1100,0.595,7.545
0min1sec,0,1110,0.592,7.542
0min1sec,0,1120,0.586,7.539
0min1sec,0,1130,0.583,7.536
0min1sec,0,1140,0.579,7.534
0min1sec,0,1150,0.573,7.531
0min1sec,0,1160,0.568,7.529
0min1sec,0,1170,0.564,7.527
0min1sec,0,1180,0.558,7.524
0min1sec,0,1190,0.555,7.522
0min1sec,0,1200,0.551,7.520
0min1sec,0,1210,0.548,7.517
0min1sec,0,1220,0.546,7.515
0min1sec,0,1230,0.542,7.512
0min1sec,0,1240,0.538,7.510
0min1sec,0,1250,0.537,7.508
0min1sec,0,1260,0.535,7.505
0min1sec,0,1270,0.530,7.503
0min1sec,0,1280,0.527,7.501
0min1sec,0,1290,0.524,7.499
0min1sec,0,1300,0.520,7.497
0min1sec,0,1310,0.517,7.495
0min1sec,0,1320,0.516,7.493
0min1sec,0,1330,0.514,7.490
0min1sec,0,1340,0.511,7.488
0min1sec,0,1350,0.507,7.486
0min1sec,0,1360,0.505,7.484
0min1sec,0,1370,0.501,7.482
0min1sec,0,1380,0.499,7.480
0min1sec,0,1390,0.496,7.478
0min1sec,0,1400,0.493,7.476
0min1sec,0,1410,0.492,7.474
0min1sec,0,1420,0.490,7.472
0min1sec,0,1430,0.488,7.470
0min1sec,0,1440,0.485,7.468
0min1sec,0,1450,0.482,7.466
0min1sec,0,1460,0.479,7.464
0min1sec,0,1470,0.478,7.462
0min1sec,0,1480,0.475,7.461
0min1sec,0,1490,0.475,7.459
0min1sec,0,1500,0.473,7.457
0min1sec,0,1510,0.471,7.455
0min1sec,0,1520,0.469,7.453
0min1sec,0,1530,0.466,7.452
0min1sec,0,1540,0.465,7.450
0min1sec,0,1550,0.463,7.448
0min1sec,0,1560,0.461,7.447
0min1sec,0,1570,0.460,7.445
0min1sec,0,1580,0.458,7.444
0min1sec,0,1590,0.457,7.442
0min1sec,0,1600,0.455,7.441
0min1sec,0,1610,0.455,7.439
0min1sec,0,1620,0.453,7.438
0min1sec,0,1630,0.452,7.436
0min1sec,0,1640,0.451,7.435
0min1sec,0,1650,0.449,7.433
0min1sec,0,1660,0.448,7.431
0min1sec,0,1670,0.445,7.430
0min1sec,0,1680,0.443,7.429
0min1sec,0,1690,0.442,7.427
0min1sec,0,1700,0.440,7.426
0min1sec,0,1710,0.436,7.424
0min1sec,0,1720,0.435,7.423
0min1sec,0,1730,0.433,7.421
0min1sec,0,1740,0.431,7.420
0min1sec,0,1750,0.429,7.419
0min1sec,0,1760,0.429,7.418
0min1sec,0,1770,0.427,7.416
0min1sec,0,1780,0.425,7.415
0min1sec,0,1790,0.424,7.414
0min1sec,0,1800,0.422,7.412
0min1sec,0,1810,0.421,7.411
0min1sec,0,1820,0.420,7.409
0min1sec,0,1830,0.418,7.408
0min1sec,0,1840,0.417,7.407
0min1sec,0,1850,0.414,7.406
0min1sec,0,1860,0.413,7.405
0min1sec,0,1870,0.412,7.404
0min1sec,0,1880,0.411,7.402
0min1sec,0,1890,0.410,7.401
0min1sec,0,1900,0.408,7.400
0min1sec,0,1910,0.407,7.399
0min1sec,0,1920,0.406,7.397
0min1sec,0,1930,0.404,7.396
0min1sec,0,1940,0.403,7.395
0min1sec,0,1950,0.399,7.394
0min1sec,0,1960,0.397,7.393
0min1sec,0,1970,0.397,7.392
0min1sec,0,1980,0.396,7.391
0min1sec,0,1990,0.395,7.390
0min1sec,0,2000,0.394,7.389
0min1sec,0,2010,0.392,7.388
0min1sec,0,2020,0.392,7.386
0min1sec,0,2030,0.391,7.386
0min1sec,0,2040,0.389,7.385
0min1sec,0,2050,0.389,7.384
0min1sec,0,2060,0.386,7.383
0min1sec,0,2070,0.385,7.382
0min1sec,0,2080,0.384,7.381
0min1sec,0,2090,0.383,7.380
0min1sec,0,2100,0.383,7.379
0min1sec,0,2110,0.382,7.378
0min1sec,0,2120,0.381,7.376
0min1sec,0,2130,0.380,7.376
0min1sec,0,2140,0.379,7.375
0min1sec,0,2150,0.378,7.373
0min1sec,0,2160,0.377,7.372
0min1sec,0,2170,0.376,7.372
0min1sec,0,2180,0.375,7.371
0min1sec,0,2190,0.375,7.369
0min1sec,0,2200,0.375,7.368
0min1sec,0,2210,0.374,7.367
0min1sec,0,2220,0.374,7.366
0min1sec,0,2230,0.372,7.365
0min1sec,0,2240,0.371,7.364
0min1sec,0,2250,0.371,7.363
0min1sec,0,2260,0.370,7.362
0min1sec,0,2270,0.369,7.361
0min1sec,0,2280,0.368,7.360
0min1sec,0,2290,0.368,7.360
0min1sec,0,2300,0.367,7.359
0min1sec,0,2310,0.366,7.358
0min1sec,0,2320,0.366,7.357
0min1sec,0,2330,0.366,7.356
0min1sec,0,2340,0.365,7.354
0min1sec,0,2350,0.365,7.353
0min1sec,0,2360,0.364,7.352
0min1sec,0,2370,0.364,7.351
0min1sec,0,2380,0.363,7.350
0min1sec,0,2390,0.363,7.349
0min1sec,0,2400,0.362,7.348
0min1sec,0,2410,0.361,7.347
0min1sec,0,2420,0.361,7.346
0min1sec,0,2430,0.360,7.346
0min1sec,0,2440,0.360,7.345
0min1sec,0,2450,0.360,7.344
0min1sec,0,2460,0.359,7.343
0min1sec,0,2470,0.359,7.342
0min1sec,0,2480,0.358,7.341
0min1sec,0,2490,0.358,7.340
5min16sec,1,0,0.352,7.108
0min1sec,1,10,-0.662,7.134
0min1sec,1,20,-0.784,7.156
0min1sec,1,30,-0.771,7.159
0min1sec,1,40,-0.758,7.157
0min1sec,1,50,-0.732,7.153
0min1sec,1,60,-0.734,7.155
0min1sec,1,70,-0.749,7.158
0min1sec,1,80,-0.774,7.158
0min1sec,1,90,-0.798,7.160
0min1sec,1,100,-0.794,7.158
0min1sec,1,110,-0.809,7.158
0min1sec,1,120,-0.798,7.158
0min1sec,1,130,-0.805,7.159
0min1sec,1,140,-0.819,7.161
0min1sec,1,150,-0.790,7.159
0min1sec,1,160,-0.774,7.158
0min1sec,1,170,-0.798,7.160
0min1sec,1,180,-0.800,7.161
0min1sec,1,190,-0.798,7.161
0min1sec,1,200,-0.789,7.161
0min1sec,1,210,-0.798,7.161
0min1sec,1,220,-0.809,7.162
0min1sec,1,230,-0.825,7.164
0min1sec,1,240,-0.824,7.164
0min1sec,1,250,-0.813,7.164
0min1sec,1,260,-0.822,7.166
0min1sec,1,270,-0.822,7.166
0min1sec,1,280,-0.832,7.168
0min1sec,1,290,-0.835,7.169
0min1sec,1,300,-0.841,7.170
0min1sec,1,310,-0.857,7.171
0min1sec,1,320,-0.865,7.172
0min1sec,1,330,-0.869,7.172
0min1sec,1,340,-0.869,7.172
0min1sec,1,350,-0.863,7.171
0min1sec,1,360,-0.862,7.170
0min1sec,1,370,-0.854,7.169
0min1sec,1,380,-0.839,7.168
0min1sec,1,390,-0.820,7.166
0min1sec,1,400,-0.817,7.165
0min1sec,1,410,-0.824,7.166
0min1sec,1,420,-0.821,7.165
0min1sec,1,430,-0.820,7.165
0min1sec,1,440,-0.816,7.164
0min1sec,1,450,-0.803,7.163
0min1sec,1,460,-0.796,7.163
0min1sec,1,470,-0.796,7.163
0min1sec,1,480,-0.795,7.163
0min1sec,1,490,-0.793,7.162
0min1sec,1,500,-0.799,7.163
0min1sec,1,510,-0.795,7.163
0min1sec,1,520,-0.787,7.163
0min1sec,1,530,-0.786,7.162
0min1sec,1,540,-0.780,7.161
0min1sec,1,550,-0.769,7.160
0min1sec,1,560,-0.762,7.159
0min1sec,1,570,-0.759,7.159
0min1sec,1,580,-0.754,7.158
0min1sec,1,590,-0.751,7.158
0min1sec,1,600,-0.752,7.158
0min1sec,1,610,-0.751,7.157
0min1sec,1,620,-0.749,7.157
0min1sec,1,630,-0.752,7.157
0min1sec,1,640,-0.749,7.158
0min1sec,1,650,-0.747,7.157
0min1sec,1,660,-0.745,7.157
0min1sec,1,670,-0.739,7.156
24 changes: 24 additions & 0 deletions PyTorch/Csv/param_VRP20_train_0821_00_58.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
mode,train
seed,123
n_customer,20
batch,512
batch_steps,2500
batch_verbose,10
n_rollout_samples,10000
epochs,20
embed_dim,128
n_heads,8
tanh_clipping,10.0
n_encode_layers,3
lr,0.0001
warmup_beta,0.8
wp_epochs,1
islogger,True
log_dir,./Csv/
weight_dir,./Weights/
pkl_dir,./Pkl/
cuda_dv,0
task,VRP20_train
dump_date,0821_00_58
pkl_path,./Pkl/VRP20_train.pkl
n_samples,1280000
Binary file added PyTorch/Pkl/VRP20_train.pkl
Binary file not shown.
Binary file modified PyTorch/Weights/VRP20_train_epoch0.pt
Binary file not shown.
Binary file added PyTorch/__pycache__/baseline.cpython-36.pyc
Binary file not shown.
Binary file added PyTorch/__pycache__/config.cpython-36.pyc
Binary file not shown.
Binary file added PyTorch/__pycache__/data.cpython-36.pyc
Binary file not shown.
Binary file added PyTorch/__pycache__/decoder.cpython-36.pyc
Binary file not shown.
Binary file added PyTorch/__pycache__/decoder_utils.cpython-36.pyc
Binary file not shown.
Binary file added PyTorch/__pycache__/encoder.cpython-36.pyc
Binary file not shown.
Binary file added PyTorch/__pycache__/layers.cpython-36.pyc
Binary file not shown.
Binary file added PyTorch/__pycache__/model.cpython-36.pyc
Binary file not shown.
4 changes: 2 additions & 2 deletions PyTorch/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,17 +115,17 @@ def plot_route(data, pi, title, cost, idx_in_batch = 0):

if __name__ == '__main__':
args = test_parser()
t1 = time()
pretrained = load_model(args.path, embed_dim = 128, n_customer = args.n_customer, n_encode_layers = 3)
data = generate_data(n_samples = 2, n_customer = args.n_customer, seed = args.seed)
device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')
pretrained = pretrained.to(device)
data = list(map(lambda x: x.to(device), data))
pretrained.eval()
with torch.no_grad():
t1 = time()
cost, _, pi = pretrained(data, return_pi = True)
plot_route(data, pi, 'Pretrained', cost[0], 0)
# model = AttentionModel(embed_dim = 128, n_encode_layers = 3, n_heads = 8, tanh_clipping = 10., FF_hidden = 512)
# cost, _, pi = model(data, return_pi = True)
# plot_route(data, pi, 'Untrained', cost[idx_min], idx_min)
print(f'inference time: {time()-t1}s')
print(f'inference time: {time()-t1}s')

0 comments on commit f3f1110

Please sign in to comment.