Hi every body, I am very fresh user of GAMS and I have a request from any body to check my following code. Due to my model largeness I have provided a starting point (or a feasible solution) to the problem but unfortunately it did not work. Please check my model and correct it, Thanks in advance M. Tanha.

scalar starttime;
starttime = jnow;

SETS
i number of retailers /1*51/,
t  number of discrete time instants of the planning time horizon  /1*3/  ;

alias(j,i)   ;

PARAMETERS
QQ   vehicle’s capacity (=C) /3645/  ,

Pt perish time /20/   ,

x(i) x coordinate of the retailer i
/ 1        436
2        391
3        268
4        358
5        12
6        165
7        172
8        492
9        276
10        241
11        272
12        453
13        124
14        210
15        298
16        63
17        73
18        152
19        454
20        372
21        14
22        71
23        134
24        49
25        189
26        199
27        404
28        87
29        434
30        260
31        251
32        406
33        429
34        438
35        498
36        237
37        435
38        227
39        450
40        277
41        280
42        240
43        416
44        43
45        209
46        324
47        260
48        442
49        320
50        305
51        130
 / ,
y(i) y coordinate of the retailer i
/  1        498
2        96
3        146
4        133
5        256
6        108
7        15
8        239
9        382
10        446
11        16
12        141
13        8
14        132
15        210
16        237
17        51
18        155
19        428
20        460
21        310
22        355
23        326
24        265
25        175
26        415
27        276
28        247
29        261
30        44
31        158
32        258
33        76
34        397
35        44
36        250
37        304
38        356
39        29
40        1
41        87
42        279
43        311
44        256
45        163
46        196
47        123
48        444
49        11
50        435
51        272
/ ,
I_0(i) starting level of the inventory at the retailer i
/ 1        6026
2        84
3        36
4        44
5        26
6        44
7        158
8        78
9        92
10        36
11        72
12        24
13        10
14        30
15        94
16        54
17        174
18        32
19        132
20        68
21        44
22        180
23        70
24        83
25        198
26        24
27        138
28        182
29        98
30        45
31        55
32        90
33        46
34        102
35        24
36        23
37        83
38        90
39        140
40        15
41        68
42        40
43        99
44        116
45        37
46        24
47        10
48        20
49        76
50        34
51        54
 /,
c(i)  maximum level of the inventory at the retailer i
/  1     1000000
2        168
3        54
4        66
5        39
6        66
7        237
8        156
9        138
10        72
11        144
12        48
13        20
14        45
15        141
16        81
17        261
18        64
19        198
20        136
21        66
22        270
23        140
24        166
25        297
26        48
27        207
28        273
29        147
30        90
31        110
32        180
33        69
34        153
35        48
36        46
37        166
38        135
39        210
40        30
41        136
42        60
43        198
44        174
45        74
46        48
47        20
48        30
49        152
50        68
51        81
/ ,
r(i)   quantity absorbed by the retailer i at each discrete time instant of the planning time horizon (= d(i))
/  1        2430
2        84
3        18
4        22
5        13
6        22
7        79
8        78
9        46
10        36
11        72
12        24
13        10
14        15
15        47
16        27
17        87
18        32
19        66
20        68
21        22
22        90
23        70
24        83
25        99
26        24
27        69
28        91
29        49
30        45
31        55
32        90
33        23
34        51
35        24
36        23
37        83
38        45
39        70
40        15
41        68
42        20
43        99
44        58
45        37
46        24
47        10
48        10
49        76
50        34
51        27
 /  ,
h(i)  unit inventory cost at the retailer i
  /1        0.03
2        0.02
3        0.03
4        0.03
5        0.02
6        0.02
7        0.03
8        0.04
9        0.04
10        0.02
11        0.04
12        0.02
13        0.02
14        0.02
15        0.03
16        0.02
17        0.04
18        0.01
19        0.04
20        0.04
21        0.02
22        0.04
23        0.05
24        0.02
25        0.03
26        0.02
27        0.05
28        0.03
29        0.02
30        0.01
31        0.01
32        0.03
33        0.03
34        0.03
35        0.02
36        0.02
37        0.02
38        0.03
39        0.05
40        0.04
41        0.03
42        0.04
43        0.02
44        0.03
45        0.03
46        0.04
47        0.02
48        0.04
49        0.04
50        0.02
51        0.04
 /;

parameter b(i,j) ;
b(i,j) = floor(sqrt(power((x(i)-x(j)),2)+power((y(i)-y(j)),2)))  ;

VARIABLES
W(i,j,t)  amount of product delivered directly
Inv(i,t)  Inventory in each period
q(i,t)    Delivery amount
v(i,t)    subtour elimination
cost   ;
Binary   VARIABLE x_x the routing variable ;
POSITIVE VARIABLES  inv ,v ,q;
*POSITIVE VARIABLES   w ;
EQUATION
OBJECTIVE
const1_1  (t)
const1_2  (t)
const1_3  (t)
const2_1  (i,t)
const2_2  (i,t)
const2_3  (i,t)
const2_4  (i,t)
const2_5  (i,t)
*IRPT-OU:
*const3_1  (i,t)
*const3_2  (i,t)
const4_1  (i,t)
const4_2  (i,t)
const5  (i,t)
const6  (t)
const7  (j,t)
const8  (t)
const9  (i,j,t)
const10 (i,t)
const11 (i,t)
*const12 (i,t)
*const13 (i,t)
*const14 (i,j,t)

*const16 (i,j,t)
const17 (i,j,t)
;

*OBJECTIVE.. cost =e= sum(t,h('1')*Inv('1',t))  + sum((i,t)$(ord(i) GT 1),h(i)*Inv(i,t)) + sum((i,j,t),b(i,j)*x_x(i,j,t))  +  sum((i,j,t)$(ord(j) GT 1), 100*b(i,j)*w(i,j,t));
OBJECTIVE.. cost =e= sum(t,h('1')*Inv('1',t))  + sum((i,t)$(ord(i) GT 1),h(i)*Inv(i,t)) + sum((i,j,t),b(i,j)*x_x(i,j,t)) ;

*const1_1 (t)$(ord(t) EQ 1) ..  I_0('1')   + r('1') -sum(i$(ord(i) GT 1),q(i,t))-sum(i$(ord(i) GT 1),w('1',i,t))=e=Inv('1','1');
const1_1 (t)$(ord(t) EQ 1) ..  I_0('1')   + r('1') -sum(i$(ord(i) GT 1),q(i,t)) =e= Inv('1','1');
*const1_2 (t)$(ord(t) GT 1) ..  Inv('1',t-1)+ r('1') -sum(i$(ord(i) GT 1),q(i,t))-sum(i$(ord(i) GT 1),w('1',i,t))=e=Inv('1',t);
const1_2 (t)$(ord(t) GT 1) ..  Inv('1',t-1)+ r('1') -sum(i$(ord(i) GT 1),q(i,t)) =e= Inv('1',t);
const1_3 (t) .. Inv('1',t) =g= 0;
*const2_1 (i,t)$((ord(i) GT 1) and (ord(t) EQ 1)) ..  I_0(i)    +q(i,t)+sum(j,w(j,i,t))-sum(j$(ord(j) gt 1),w(i,j,t))-r(i)=e=Inv(i,t);
const2_1 (i,t)$((ord(i) GT 1) and (ord(t) EQ 1)) ..  I_0(i)    +q(i,t)-r(i)=e=Inv(i,t);
*const2_2 (i,t)$((ord(i) GT 1) and (ord(t) GT 1)) ..  Inv(i,t-1)+q(i,t)+sum(j,w(j,i,t))-sum(j$(ord(j) gt 1),w(i,j,t))-r(i)=e=Inv(i,t);
const2_2 (i,t)$((ord(i) GT 1) and (ord(t) GT 1)) ..  Inv(i,t-1)+q(i,t)-r(i)=e=Inv(i,t);

const2_3 (i,t)$(ord(i) GT 1) .. Inv(i,t) =g= 0;

const2_4 (i,t)$(ord(i) GT 1) .. Inv(i,t)  =l= c(i) ;

const2_5 (i,t)$(ord(i) GT 1) .. Inv(i,t)  =l= Pt*r(i) ;

*const3_2 (i,t)$(ord(i) GT 1) ..  C(i)*sum(j, x_x(i,j,t)) - Inv(i,t)  =l= q(i,t);
*const3_2 (i,t)$(ord(i) GT 1) ..  (C(i)*sum(j$(ord(j) GT 1), x_x(i,j,t)) - Inv(i,t))  =l= q(i,t);
*const3_1 (i,t)$((ord(t) EQ 1) and (ord(i) GT 1)) ..  C(i)*(sum(j$((ord(j) GT 1)and(ord(i)<>ord(j))) ,x_x(i,j,t))) - Inv0(i)     =l= q(i,t);
*const3_2 (i,t)$((ord(t) GT 1) and (ord(i) GT 1)) ..  C(i)*(sum(j$((ord(j) GT 1)and(ord(i)<>ord(j))) ,x_x(i,j,t))) - Inv(i,t-1)  =l= q(i,t);

*const4_2 (i,t)$(ord(i) GT 1) ..  C(i) - Inv(i,t)  =g= q(i,t);
const4_1 (i,t)$((ord(t) EQ 1) and (ord(i) GT 1)) ..  C(i) - I_0(i)     =g= q(i,t);
const4_2 (i,t)$((ord(t) GT 1) and (ord(i) GT 1)) ..  C(i) - Inv(i,t-1) =g= q(i,t);

const5   (i,t)$(ord(i) GT 1) ..  C(i) * sum(j$(ord(i) <> ord(j)),x_x(i,j,t)) =g= q(i,t);
const6   (t)   .. sum(i$(ord(i) GT 1), q(i,t))  =l= QQ ;
const7   (j,t) .. sum(i$(ord(i) <> ord(j)),x_x(i,j,t))=e= sum(i$(ord(i) <> ord(j)),x_x(j,i,t)) ;
const8   (t)   .. sum(i$(ord(i) GT 1),x_x(i,'1',t)) =l= 1  ;
const9  (i,j,t)$((ord(i) GT 1)and(ord(j) GT 1)) .. v(i,t)-v(j,t)+ QQ*x_x(i,j,t) =l= QQ-q(j,t);
const10 (i,t)$(ord(i) GT 1) ..  q(i,t) =l= v(i,t);
const11 (i,t)$(ord(i) GT 1) ..  v(i,t) =l= QQ;
*const12 (i,t)$(ord(i) GT 1) ..  v(i,t) =g= 0;
*const13 (i,t)$(ord(i) GT 1) ..  q(i,t) =g= 0;
*const14 (i,j,t)$(ord(i) EQ ord(j)) ..  w(i,j,t) =e= 0;

*const16 (i,j,t) ..  w(i,j,t) =e= 0;
const17 (i,j,t)$(ord(i) EQ ord(j)) .. x_x(i,j,t)=e=0;
MODEL transshipment5 / ALL / ;

option optcr = 0.00000001;
Option MIP = Cplex;
*Option MIP = osicplex;
Option Limrow=1000000;
Option Limcol=1000000;
Option SOLPRINT=on;
*time limit in seconds
option reslim = 36000 ;

*option MipStart = 1;

x_x.l('1','0','1') = 0;
x_x.l('2','4','1') = 1;
x_x.l('3','0','1') = 0;
x_x.l('4','0','1') = 0;
x_x.l('5','0','1') = 0;
x_x.l('6','0','1') = 0;
x_x.l('7','0','1') = 0;
x_x.l('8','0','1') = 0;
x_x.l('9','0','1') = 0;
x_x.l('10','6','1') = 1;
x_x.l('11','0','1') = 0;
x_x.l('12','7','1') = 1;
x_x.l('13','0','1') = 0;
x_x.l('14','3','1') = 1;
x_x.l('15','0','1') = 0;
x_x.l('16','8','1') = 1;
x_x.l('17','9','1') = 1;
x_x.l('18','0','1') = 0;
x_x.l('19','1','1') = 1;
x_x.l('20','0','1') = 0;
x_x.l('21','0','1') = 0;
x_x.l('22','0','1') = 0;
x_x.l('23','0','1') = 0;
x_x.l('24','0','1') = 0;
x_x.l('25','0','1') = 0;
x_x.l('26','0','1') = 0;
x_x.l('27','0','1') = 0;
x_x.l('28','0','1') = 0;
x_x.l('29','0','1') = 0;
x_x.l('30','0','1') = 0;
x_x.l('31','0','1') = 0;
x_x.l('32','0','1') = 0;
x_x.l('33','0','1') = 0;
x_x.l('34','0','1') = 0;
x_x.l('35','0','1') = 0;
x_x.l('36','0','1') = 0;
x_x.l('37','0','1') = 0;
x_x.l('38','0','1') = 0;
x_x.l('39','0','1') = 0;
x_x.l('40','0','1') = 0;
x_x.l('41','0','1') = 0;
x_x.l('42','2','1') = 1;
x_x.l('43','0','1') = 0;
x_x.l('44','0','1') = 0;
x_x.l('45','0','1') = 0;
x_x.l('46','5','1') = 1;
x_x.l('47','0','1') = 0;
x_x.l('48','0','1') = 0;
x_x.l('49','0','1') = 0;
x_x.l('50','0','1') = 0;
x_x.l('1','25','2') = 1;
x_x.l('2','0','2') = 0;
x_x.l('3','0','2') = 0;
x_x.l('4','0','2') = 0;
x_x.l('5','0','2') = 0;
x_x.l('6','38','2') = 1;
x_x.l('7','30','2') = 1;
x_x.l('8','4','2') = 1;
x_x.l('9','7','2') = 1;
x_x.l('10','22','2') = 1;
x_x.l('11','29','2') = 1;
x_x.l('12','39','2') = 1;
x_x.l('13','18','2') = 1;
x_x.l('14','0','2') = 0;
x_x.l('15','11','2') = 1;
x_x.l('16','0','2') = 0;
x_x.l('17','37','2') = 1;
x_x.l('18','0','2') = 0;
x_x.l('19','2','2') = 1;
x_x.l('20','14','2') = 1;
x_x.l('21','15','2') = 1;
x_x.l('22','8','2') = 1;
x_x.l('23','13','2') = 1;
x_x.l('24','0','2') = 0;
x_x.l('25','6','2') = 1;
x_x.l('26','33','2') = 1;
x_x.l('27','10','2') = 1;
x_x.l('28','0','2') = 0;
x_x.l('29','21','2') = 1;
x_x.l('30','36','2') = 1;
x_x.l('31','34','2') = 1;
x_x.l('32','26','2') = 1;
x_x.l('33','0','2') = 0;
x_x.l('34','28','2') = 1;
x_x.l('35','16','2') = 1;
x_x.l('36','31','2') = 1;
x_x.l('37','5','2') = 1;
x_x.l('38','27','2') = 1;
x_x.l('39','23','2') = 1;
x_x.l('40','20','2') = 1;
x_x.l('41','0','2') = 0;
x_x.l('42','32','2') = 1;
x_x.l('43','12','2') = 1;
x_x.l('44','17','2') = 1;
x_x.l('45','35','2') = 1;
x_x.l('46','19','2') = 1;
x_x.l('47','1','2') = 1;
x_x.l('48','24','2') = 1;
x_x.l('49','3','2') = 1;
x_x.l('50','9','2') = 1;
x_x.l('1','9','3') = 1;
x_x.l('2','0','3') = 0;
x_x.l('3','8','3') = 1;
x_x.l('4','25','3') = 1;
x_x.l('5','21','3') = 1;
x_x.l('6','0','3') = 0;
x_x.l('7','0','3') = 0;
x_x.l('8','0','3') = 0;
x_x.l('9','30','3') = 1;
x_x.l('10','14','3') = 1;
x_x.l('11','0','3') = 0;
x_x.l('12','22','3') = 1;
x_x.l('13','17','3') = 1;
x_x.l('14','0','3') = 0;
x_x.l('15','0','3') = 0;
x_x.l('16','23','3') = 1;
x_x.l('17','20','3') = 1;
x_x.l('18','2','3') = 1;
x_x.l('19','0','3') = 0;
x_x.l('20','0','3') = 0;
x_x.l('21','0','3') = 0;
x_x.l('22','27','3') = 1;
x_x.l('23','0','3') = 0;
x_x.l('24','19','3') = 1;
x_x.l('25','0','3') = 0;
x_x.l('26','6','3') = 1;
x_x.l('27','0','3') = 0;
x_x.l('28','7','3') = 1;
x_x.l('29','0','3') = 0;
x_x.l('30','0','3') = 0;
x_x.l('31','0','3') = 0;
x_x.l('32','10','3') = 1;
x_x.l('33','3','3') = 1;
x_x.l('34','0','3') = 0;
x_x.l('35','0','3') = 0;
x_x.l('36','5','3') = 1;
x_x.l('37','0','3') = 0;
x_x.l('38','11','3') = 1;
x_x.l('39','13','3') = 1;
x_x.l('40','15','3') = 1;
x_x.l('41','29','3') = 1;
x_x.l('42','4','3') = 1;
x_x.l('43','24','3') = 1;
x_x.l('44','18','3') = 1;
x_x.l('45','0','3') = 0;
x_x.l('46','16','3') = 1;
x_x.l('47','1','3') = 1;
x_x.l('48','12','3') = 1;
x_x.l('49','31','3') = 1;
x_x.l('50','28','3') = 1;

SOLVE transshipment5 using MIP minimizing cost;
DISPLAY inv.l, cost.l, cost.lo, cost.up;
OPTION Savepoint=1;

*time record
scalar elapsed;
elapsed = (jnow - starttime)*24*3600;
display elapsed;

asked 25 Jul '16, 04:39

mosahab's gravatar image

mosahab
13
accept rate: 0%

edited 27 Jul '16, 01:37

Be the first one to answer this question!
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×191
×51
×6
×6

Asked: 25 Jul '16, 04:39

Seen: 427 times

Last updated: 27 Jul '16, 01:37

OR-Exchange! Your site for questions, answers, and announcements about operations research.