Skip to main content

Multiple Time Windows for Technician Routing

Answered

Comments

3 comments

  • Riley Clement
    • Gurobi Staff

    Hi Baris,

    Is the problem you're considering an extension of the one in this notebook:
    https://colab.research.google.com/github/Gurobi/modeling-examples/blob/master/technician_routing_scheduling/technician_routing_scheduling.ipynb
    but where each customer has a set of disjoint time windows that the technician can arrive in, instead of a single time window?

    - Riley

    0
  • Baris Kafa
    • Gurobi-versary
    • First Comment
    • First Question

    Hi Riley, 

    i see that notebook. My question is about a customer having multiple time windows.

    This is how we currently use it.
    tStart = {j.name : j.tStart for j in customers}
    tEnd = {j.name : j.tEnd for j in customers}

    The form I want to use is;
    tStart1 = {j.name : j.tStart1 for j in customers}
    tEnd1 = {j.name : j.tEnd1 for j in customers}

    tStart2 = {j.name : j.tStart2 for j in customers}
    tEnd2 = {j.name : j.tEnd2 for j in customers}

    tStart3 = {j.name : j.tStart3 for j in customers}
    tEnd3 = {j.name : j.tEnd3 for j in customers}


    How can I combine these 3 different time windows?

    Thank you. 

    -Baris

     

    0
  • Riley Clement
    • Gurobi Staff

    Hi Baris,

    Currently the time windows are enforced with the following constraints,

    t_j >= a_j - xa_j
    t_j <= b_j + xb_j

    where t_j is the arrival time at location j, and time window at location j is [a_j, b_j].

    Suppose instead you want 3 time windows, [a_{j1}, b_{j1}], [a_{j2}, b_{j2}], [a_{j3}, b_{j3}].  You can introduce binary variables w_{j1}, w_{j2}, w_{j3} to indicate the choice of window.  You have to introduce constraints for each j to make sure a window is chosen:

    w_{j1} + w_{j2} + w_{j3} = 1

    and then the start time of the window is equal to

    a_{j1}w_{j1} + a_{j2}w_{j2} + a_{j3}w_{j3}

    and the end time of the window is equal to

    b_{j1}w_{j1} + b_{j2}w_{j2} + b_{j3}w_{j3}

    and you can use these expressions in place of a_j and b_j in the original time window constraints.

    - Riley

    0

Please sign in to leave a comment.