I would like to create non-linear violation costs in my VRP. I already created my whole VRP with time windows in which I have these decision variable:
dvar float+ w[N][D]; // violation time for late arrivals for every node and every day
These dvars are working, but now I want to make a link with the violation costs decision variables, which are:
dvar boolean a1[N][D];// no violation
dvar boolean a2[N][D];// soft violation of 0-5 minutes
dvar boolean a3[N][D];// soft violation of 6-10 minutes
dvar boolean a4[N][D];// soft violation of 11 -15 minutes
dvar boolean a5[N][D];// soft violation of 15+ minutes
I want to force:
a1[N][D] to be 1, when w[N][D] <=0, 0 otherwise
a2[N][D] to be 1, when w[N][D] >0 & <=5, 0 otherwise
a3[N][D] to be 1, when w[N][D] >5 & <=10, 0 otherwise
a4[N][D] to be 1, when w[N][D] >10 & <=15, 0 otherwise
a5[N][D] to be 1, when w[N][D] >=16, 0 otherwise
Then I have:
forall(i in N, d in D)
(a1[i][d] + a2[i][d] + a3[i][d] + a4[i][d] + a5[i][d]) == 1;
There is still something wrong with these constraints though.
forall(i in N, d in D)
(a1[i][d] + a2[i][d] + a3[i][d] + a4[i][d] + a5[i][d]) == 1; //sum of all a's = 1
forall(i in N, d in D)
w[n][d]<= (5*a2[i][d]) + 1000*(1-a2[i][d]); // a2 == 1 when w[n][d]>0 & <=5
forall(i in N, d in D)
(6*a3[i][d] - 1000*(a3[i][d]-1))<= w[i][d]; // a3
forall(i in N, d in D)
w[i][d] <= (10*a3[i][d]) + 1000*(1-a3[i][d]); // a3
forall(i in N, d in D)
(11*a4[i][d] - 1000*(a4[i][d]-1))<= w[i][d]; //a4
forall(i in N, d in D)
w[i][d] <= (15*a4[i][d]) + 1000*(1-a4[i][d]); // a4
forall(i in N, d in D)
(16*a5[i][d] - 1000*(a5[i][d]-1))<= w[i][d]; //a5
it sets a5==1 for all constraints.
Furthermore, w is used in the model as:
forall (i in N, d in D:q[i][d]>=1)
y[i][d] - w[i][d] <= sl[i][d]; // late arrival time soft
where y[i][d] is the arrival time variable