Originally posted by: Washout
Hi all,
I am writing a train scheduler, and have decision variables representing departure and arrival times for each train at each location. i.e dep[t][s] represents the departure time for train t from location s and arr[t][s] represents the arrival time of train t at location s.
Time is measured in minutes, and the schedule covers a day so dep and arr have lower and upper bounds of 0 and 1440 respectively. In my objective function I am trying to minimise the total delay of each train by measuring the difference between each departure and arrival time and summing them over all locations the train visits.
The issue comes with the time boundary at time=1440. If a train t arrives at a location s at time 1430 and departs at time 10 then the delay should be 20. Normally the delay is simply calculated by dep[t][s] - arr[t][s] but in the case where the train is in the station across the time boundary this fails. It seems I need to check if dep[t][s] < arr[t][s] to add the corrrect term to the objective function, but looking at the ifThen method it seems to only apply to constraints, not NumExpr. Does anyone have a clue how I can calculate the correct delay each time?
#CPLEXOptimizers#DecisionOptimization