Originally posted by: AndyHam
I have made many different attempts but all failed. The last thing I tried was to make another interval variable (move) that has the size of travel distance.
Then, I feed the heightAtEnd with sizeOf(move[j][t]).
presenceOf(itvJ2T[j][t])==presenceOf(move[j][t]);
startOf(itvJ2T[j][t])==startOf(move[j][t]);
sizeOf(move[j][t])==dNtoN[j.id][typeOfNext(seqTrk[t], itvJ2T[j][t], j.id, j.id)];
heightAtEnd(itvJ2T[j][t],cumBattery[t]) == -sizeOf(move[j][t]) ;
If you can shed some light, it will be great!.
Hi Petr,
Thanks for looking into the issue. I think I understand the cause.
Now, I am trying to port the lesson to my battery-charging VRP problem.
I still could not make the code work. I am enclosing the entire model and data files.
The problematic codes are showing below.
I sincerely appreciate your help.
cumulFunction cumBattery[t in Trucks]= step(0, Q) // initial Battery level
- sum(j in aJobs) stepAtStart (itvJ2T[j][t], 0, Q) //Battery consumption
+ sum(j in aJobs: j.t=="f") stepAtEnd (itvJ2T[j,t], 0, Q); //Battery recharging
forall(j in aJobs,t in Trucks) //Battery consumption
// heightAtStart(itvJ2T[j][t],cumBattery[t],0) == - dNtoN[j.id][typeOfNext(seqTrk[t], itvJ2T[j][t], j.id, j.id)];
heightAtStart(itvJ2T[j][t],cumBattery[t],-dNtoN[j.id][typeOfNext(seqTrk[t], itvJ2T[j][t], j.id, j.id)]) == - dNtoN[j.id][typeOfNext(seqTrk[t], itvJ2T[j][t], j.id, j.id)];
heightAtStart(itvJ2T[j][t],cumBattery[t],0) == - presenceOf(itvJ2T[j][t])*dNtoN[j.id][typeOfNext(seqTrk[t], itvJ2T[j][t], j.id, j.id)];
forall(j in aJobs,t in Trucks: j.t=="f") //Battery charging
heightAtEnd(itvJ2T[j][t],cumBattery[t]) == g*sizeOf(itvJ2T[j][t]);
Thanks,
Andy
#DecisionOptimization#OPLusingCPOptimizer