var y{i in N, k in V},>=0 integer; # battery level of vehicle k at node i
var w{i in N, k in V},>=0 integer; #starting time serving customer i or enter recharge node by vehicle k, 0 if node i is not visited
Plus the corresponding constraints:
Set C is customers, R is Rechargingstations, N are all the nodes including the depot node {0} and {9}. Set V is vehicles
parameters: r is recharging rate, d(i,j) is distance, Y{k} is full battery level, Big M = 230, t(i,j) is travel time and s{i} is service time.
s.t. c4{i in C,j in N: i<>j}:
sum {k in V} (y[j,k] + (r[k]*d[i,j] + Y[k])*x[i,j,k]) <=sum{k in V}(y[i,k] + Y[k]); # Roberti, when Customer is visited,
s.t. c5{i in R,j in N: i<>j}:
sum{k in V} y[j,k] <=sum{k in V}(Y[k] -(r[k]*d[i,j])*x[i,j,k]); #Battery fully charged minus travelled distance when R is visited
s.t. c6{k in V, i in C, j in N: i<>j}:
w[i,k] + (t[i,j]+s[i])*x[i,j,k] - M*(1 - x[i,j,k]) <= w[j,k]; # starting time of next customer has to consider other nodes, with Big M param
s.t. c7{k in V, i in R, j in N: i<>j}:
w[i,k] + t[i,j]*x[i,j,k] + g[k]*(Y[k]- y[i,k]) - M*(1-x[i,j,k]) <= w[j,k]; # recharging time, with Big M param
s.t. c11{k in V}:
y[0,k]=Y[k]; # battery levels
The following output for w{i,k} and y{i,k} I get:
w [*,*] (tr)
: 0 1 2 3 4 5 6 7 8 9 := 0,9 is depot, 1,2,3 are recharing stations and 4 till 8 are customers( small data set)
1 0 0 0 0 0 0 0 0 0 0
2 0 0 0 0 0 0 0 0 0 0
3 0 0 0 0 0 0 0 0 0 0
4 0 0 0 0 0 0 0 0 0 0
5 0 0 0 0 0 0 0 0 0 0
6 0 0 0 0 0 0 0 0 0 0
7 0 0 0 0 0 0 0 0 0 0
8 0 0 0 0 0 0 0 0 0 0
9 0 0 0 0 0 0 0 0 0 0
10 0 0 0 0 0 0 0 0 0 0
11 0 0 0 0 0 0 230 0 0 261
12 0 0 0 0 35 0 0 0 230 85
13 0 0 0 0 0 0 0 0 0 0
14 0 0 0 0 0 0 0 0 0 0
15 0 0 0 0 0 0 0 0 0 0
16 0 0 0 0 0 0 0 0 0 0
17 0 0 0 0 0 0 0 0 0 0
18 0 0 0 0 0 0 0 0 0 0
19 0 0 0 0 0 0 0 0 0 0
20 0 0 0 0 0 0 0 0 0 0
21 0 0 0 0 0 0 0 0 0 0
22 0 0 0 0 0 0 0 0 0 0
23 0 0 0 0 0 0 0 0 0 0
24 0 0 0 230 0 0 0 230 0 258
25 0 0 0 0 0 0 0 0 0 0
;
( 1 t/m 25 are vehicles, 1 t/m5 is the same vehicle type, 6 t/m 10 another type etcetera)
y [*,*] (tr)
: 0 1 2 3 4 5 6 7 8 9 :=
1 61 0 0 61 0 61 61 61 0 0
2 61 0 0 61 0 61 61 61 0 0
3 61 0 0 61 0 23 61 61 0 0
4 61 0 0 61 0 0 61 61 0 0
5 61 0 0 61 0 0 61 61 0 0
6 61 0 0 61 0 0 61 61 0 0
7 61 0 0 61 0 0 61 61 0 0
8 61 0 0 61 0 0 61 61 0 0
9 61 0 0 61 0 0 61 61 0 0
10 61 0 0 61 0 0 61 6 0 0
11 61 61 61 61 0 0 61 0 0 0
12 61 61 61 61 0 0 61 0 0 0
13 61 0 0 61 0 0 61 0 0 0
14 61 0 0 61 0 0 42 0 0 0
15 61 0 0 61 0 0 0 0 0 0
16 61 0 0 61 0 0 0 0 0 0
17 61 0 0 61 0 0 0 0 0 0
18 61 0 0 61 0 0 0 0 0 0
19 61 0 0 61 0 0 0 0 0 0
20 61 0 0 61 0 0 0 0 0 0
21 61 0 0 0 0 0 0 0 0 0
22 61 0 0 61 0 0 0 0 0 0
23 61 0 0 61 0 0 0 0 0 0
24 61 61 61 61 0 0 0 0 0 0
25 61 0 0 61 0 0 0 0 0 0;
I would really appreciate it if you anyone can help me with this problem!
Best regards,
Reinoud
--
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ampl+uns...@googlegroups.com.
To post to this group, send email to am...@googlegroups.com.
Visit this group at https://groups.google.com/group/ampl.
For more options, visit https://groups.google.com/d/optout.