Gurobi & Python. Capacitated vehicle routing problem

Sdílet
Vložit
  • čas přidán 13. 12. 2019
  • Learn how to solve the Capacitated Vehicle Routing Problem CVRP with Gurobi 9 and Python 3.7 using a Jupyter Notebook.
    I use indicator constraints for sub tour elimination. I set a time and an optimality gap limit to deal with long solving times.
    Code available in GitHub:
    github.com/industrial-ucn/jup...
    ::::: NOTICE :::::
    In • Gurobi & Python. Capac... I wrote q[i] instead of q[j]. The code in GitHub has this bug fixed.

Komentáře • 48

  • @luciferhasfallen6019
    @luciferhasfallen6019 Před 4 lety +3

    Finally I wait for this Thank

  • @nguyentu3776
    @nguyentu3776 Před 4 lety +4

    Thank you for your contribution. What if for multiple depots? for example, 03, how could I set up the parameters and constrains? Thanks a lot

  • @architdongre1372
    @architdongre1372 Před 4 lety

    This was so helpful for my project , thank you

  • @bilaldaqqah5888
    @bilaldaqqah5888 Před 4 lety

    This was very helpful for my project. Thanks.

  • @alfandysurya1146
    @alfandysurya1146 Před 3 lety +1

    Thank you for your help! would you mind share to us what mathematical model of CVRP is used in this video?

  • @yufeihuang9771
    @yufeihuang9771 Před 4 lety

    Thank you. It helps my project a lot!

  • @tanvirkaisar7245
    @tanvirkaisar7245 Před 2 lety +2

    hi, thanks for the awesome tutorial. what would have to be changed if there are more than one vehicles? in particular, can we set a number of vehicles as a parameter like the number of clients?

  • @jessriy
    @jessriy Před 4 lety +6

    I have questions : 1)how to specify the different routes? 2)this model assumes one vehicle with only one type. if I have multiple types of vehicle, how to modify the model to minimize the number of vehicles put in use, and what is the best combination of vehicle types? 3)how to add time window constraints for each customer?

  • @genuiskids3362
    @genuiskids3362 Před 4 lety +5

    Great Job! This is an awesome video that I need very much. I am trying to solve a dial a ride problem with gurobi, if you can add more videos on how to solve DARP and how to generate data randomly, it will be great of help ( I know you have generated data at this video but I think of a more dedicated video for how to generate data).

  • @francescasbarbati2077
    @francescasbarbati2077 Před 3 lety

    Thank you. If I wanted to solve p-median problems and p-center problems on Gurobi, what would the code be?

  • @yiyunzhou4853
    @yiyunzhou4853 Před 3 lety

    Thanks for sharing! Is there any way to find the route for each truck? I think the groubi may already give us the answer.

  • @XShollaj
    @XShollaj Před 2 lety

    Beast ! Great Job!

  • @xhmshorbpr
    @xhmshorbpr Před 2 lety

    Hi, great video. May i ask what the best bounds meaning?

  • @Daehne_
    @Daehne_ Před měsícem

    best wishes from germany

  • @goatlover4747
    @goatlover4747 Před 4 lety +4

    Hello thanks for the upload!
    At 16:16 I believe you made a mistake and wrote q[i] instead of q[j] which made the graph with seed 0 look a bit odd.

    •  Před 4 lety +1

      You're right! I'll try to add a note about it, thank you for letting me know.

  • @kishan9506
    @kishan9506 Před 3 lety

    Amazing. Thanks !!

  • @KienNguyen-kx3xv
    @KienNguyen-kx3xv Před 3 lety

    Thank you so much!

  • @genuiskids3362
    @genuiskids3362 Před 3 lety

    You formulated the arcs as (i,j). If I have a similar problem and have some infeasible arcs that should be not considered by the program. How can I tell the program to remove such arcs. I am waiting for your reply please.

  • @hamousatla4451
    @hamousatla4451 Před 3 lety +1

    Hello
    Great job! and how about the multi-objective problems?

  • @maroofmaroof3799
    @maroofmaroof3799 Před 2 lety

    Dear Sir can you kindly solve a resource scheduling problem for time minimization using groubi? Also how to add fuzzy variables in gurobi?

  • @saurabhtalele1537
    @saurabhtalele1537 Před 3 lety

    Great sir

  • @Ty.nattasit
    @Ty.nattasit Před 2 lety

    Is there any example of multi-depot vrp (pick up and delivery )?

  • @otreborsolrac2
    @otreborsolrac2 Před 3 lety +1

    Tendrás un ejemplo con cvrptw?

  • @jaintenrustono7765
    @jaintenrustono7765 Před 3 lety

    Which algoritm do you use Sir?

  • @javierwilches7
    @javierwilches7 Před 3 lety

    profe una pregunta no tienes un ejemplo con datos reales? osea no utilizando datos ramdon.

  • @genuiskids3362
    @genuiskids3362 Před 4 lety +1

    Hello
    Hernán Cáceres, I have created a dial-a-ride problem formulation based on your great tutorial, but some issues are there would you mind discuss with me my model please?

    • @genuiskids3362
      @genuiskids3362 Před 4 lety

      I got stuck with how to code a specific parameter , any help will be appreciated

  • @srinivasanbalan5903
    @srinivasanbalan5903 Před 4 lety

    Is this video not uploaded earlier?

  • @wijayah2508
    @wijayah2508 Před 4 lety

    if qi is not random, how to make it?

  • @ThKevzg97
    @ThKevzg97 Před rokem

    Hey, anyone knows how to make different colors for every sub route available?

  • @yongshengcao1679
    @yongshengcao1679 Před 4 lety

    is there matlab of gurobi for VRP

  • @mf4552
    @mf4552 Před 4 lety

    this is a two index commodity flow version of cvrp right?

    • @DerEddieLoL
      @DerEddieLoL Před 3 lety

      2-Index with Miller-Tucker-Zemlin constraints

  • @gunawansilalahi3290
    @gunawansilalahi3290 Před 4 lety +1

    Hello. Can you help me?

  • @bijoyjth
    @bijoyjth Před 4 lety +1

    Thank you for sharing this. Can you please clarify the role of each constraint you have added? I have added my understanding of the constraints next to them:
    quicksum(x[i,j] for j in V if i!=j) == 1 for i in N # this is to ensure only one outgoing edge is selected for each node
    quicksum(x[i,j] for i in V if i!=j) == 1 for j in N # this is to ensure only one incoming edge is selected for each node
    q[i] (u[i] - q[i] == u[j]) for i,j in A if i!=0 and j!=0
    I re-wrote the last constraint since u[i] (coming into node i) - q[i] (demand at node i) = u[j] (flow out of i and into node j) seems to satisfy the balance constraints of flow for the arc (i, j).
    Thoughts? A single vehicle carrying the same product to all the customers is similar to a single commodity network flow problem, right?

    • @sanjaybalikar870
      @sanjaybalikar870 Před 2 lety

      did you get your answer please let me know if you have

    • @kenzo450D
      @kenzo450D Před 2 lety

      @@sanjaybalikar870 the first constraint is the outgoing arc constraint so that each vertex does not have more than one arc exiting from vertex. the second constraint is the incoming arc constraint, so that more than one arc is not incoming to a vertex. The third constraint ensures that the amount delivered to the customer is consistent with the next vertex. the fourth constraint makes sure that vehicle carrying constraint of Q is maintained.

  • @tezkrattroza5008
    @tezkrattroza5008 Před 2 lety

    i always receive this ""errorname 'rnd' is not defined" i don't understand why

  • @yasirnaeem7192
    @yasirnaeem7192 Před 2 měsíci

    where you have considered number of vehicles

  • @fahadusman3572
    @fahadusman3572 Před 3 lety

    hi sir I have error when I try to solve the CVRP for your code in the step "from gurobipy import Model, GRB, quicksum" its appear there is no gurobipy so the message Error is ---------------------------------------------------------------------------
    ModuleNotFoundError Traceback (most recent call last)
    in
    ----> 1 from gurobipy import Model, GRB, quicksum
    ModuleNotFoundError: No module named 'gurobipy' the error in minite 9:36

    • @educatedchicken1533
      @educatedchicken1533 Před 3 lety

      Have you correctly installed gurobi pip to your phyton ide? if the eror is for gurobipy, you may have an issue on installing the solver to your ide. If that is the problem you can visit gurobi website and copy pip installation link directly.

  • @yasirnaeem7192
    @yasirnaeem7192 Před 2 měsíci

    where is the number of vehicles

  • @lynckee5244
    @lynckee5244 Před 11 dny

    Vehicule routing problem

  • @fermat6377
    @fermat6377 Před rokem

    garibi grubi

  • @fahadusman3572
    @fahadusman3572 Před 3 lety

    hi sir I have error when I try to solve the CVRP for your code in the step "from gurobipy import Model, GRB, quicksum" its appear there is no gurobipy so the message Error is ---------------------------------------------------------------------------
    ModuleNotFoundError Traceback (most recent call last)
    in
    ----> 1 from gurobipy import Model, GRB, quicksum
    ModuleNotFoundError: No module named 'gurobipy' the error in minite 9:36