Top Banner
Vehicle Routing Problem: how to solve it in Java? By Stanislav Kyfenko
52

Vehicle Routing Problem: how to solve it in Java?

Feb 17, 2017

Download

Engineering

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Vehicle Routing Problem: how to solve it in Java?

VehicleRoutingProblem:howtosolveitinJava?

ByStanislavKyfenko

Page 2: Vehicle Routing Problem: how to solve it in Java?

StanislavKyfenko• TechnicalLeadatSoftServe• SoftwareengineermainlyfocusedondistributedsystemsdevelopmentandVRPsolutions

https://ua.linkedin.com/in/skyfenko

Page 3: Vehicle Routing Problem: how to solve it in Java?

Agenda

• WhatisVRP?• VRPcharacteristicsandgoals• VRPtypes:fromsimplicitytocomplexity• OptaPlanner andjsprit• Q&A

Page 4: Vehicle Routing Problem: how to solve it in Java?

WhatdoesVRPstandfor?

• VRPisoneofthemostpopularconstraintsatisfactionproblemsintheareasoftransportation,deliveryandlogistics• ThemainpurposeistodesignatleastonerouteforKvehicleswithLcapacityeachtodelivergoodsfromMdepotstoNcustomersinordertomeetthegivenconstraintsandtimewindows.• Effectiveutilizationofresources(vehicles)candecreasetransportationcostssignificantly

Page 5: Vehicle Routing Problem: how to solve it in Java?

VRPcharacteristics

Page 6: Vehicle Routing Problem: how to solve it in Java?

Depot

TimeWindows

Location

Page 7: Vehicle Routing Problem: how to solve it in Java?

Customer

TimeWindows

Location Accessibility

Demands

Page 8: Vehicle Routing Problem: how to solve it in Java?

Vehicle

TimeWindows Returntodepot

Capacity Driverrestperiod

Page 9: Vehicle Routing Problem: how to solve it in Java?

Route

Totalelapsedtime Timedelays

TotaldistanceTotalcost

Page 10: Vehicle Routing Problem: how to solve it in Java?

VRPgoals

Totalelapsedtime Totaldistance Totalcost

Totalconsumedfuel Fleetofvehicles

Page 11: Vehicle Routing Problem: how to solve it in Java?

VRPgoals

Totalprofit Customershappiness

Page 12: Vehicle Routing Problem: how to solve it in Java?

VehicleRoutingProblemtypes

Page 13: Vehicle Routing Problem: how to solve it in Java?

1.TravellingSalesmanProblem

Page 14: Vehicle Routing Problem: how to solve it in Java?

Thesimplestone- TSP

Page 15: Vehicle Routing Problem: how to solve it in Java?
Page 16: Vehicle Routing Problem: how to solve it in Java?

2.CapacitatedVRP

Page 17: Vehicle Routing Problem: how to solve it in Java?

CapacitatedVRP

Page 18: Vehicle Routing Problem: how to solve it in Java?
Page 19: Vehicle Routing Problem: how to solve it in Java?

3.VRPwithmultipledepots

Page 20: Vehicle Routing Problem: how to solve it in Java?

VRPwithmultipledepots

Page 21: Vehicle Routing Problem: how to solve it in Java?
Page 22: Vehicle Routing Problem: how to solve it in Java?

4.SplitDeliveryVRP

Page 23: Vehicle Routing Problem: how to solve it in Java?

SplitDeliveryVRP

Page 24: Vehicle Routing Problem: how to solve it in Java?
Page 25: Vehicle Routing Problem: how to solve it in Java?

5.PeriodicVRP

Page 26: Vehicle Routing Problem: how to solve it in Java?

PeriodicVRP

Page 27: Vehicle Routing Problem: how to solve it in Java?
Page 28: Vehicle Routing Problem: how to solve it in Java?

6.StochasticVRP

Page 29: Vehicle Routing Problem: how to solve it in Java?

StochasticVRP

Page 30: Vehicle Routing Problem: how to solve it in Java?
Page 31: Vehicle Routing Problem: how to solve it in Java?

7.VRPwithTimeWindows

Page 32: Vehicle Routing Problem: how to solve it in Java?

VRPwithTimeWindows

Page 33: Vehicle Routing Problem: how to solve it in Java?
Page 34: Vehicle Routing Problem: how to solve it in Java?

OptaPlanner

Page 35: Vehicle Routing Problem: how to solve it in Java?

OptaPlanner

Page 36: Vehicle Routing Problem: how to solve it in Java?

OptaPlanner

Page 37: Vehicle Routing Problem: how to solve it in Java?

Sample

Page 38: Vehicle Routing Problem: how to solve it in Java?

Sample

Page 39: Vehicle Routing Problem: how to solve it in Java?

Similartohard/softconstraints

Page 40: Vehicle Routing Problem: how to solve it in Java?
Page 41: Vehicle Routing Problem: how to solve it in Java?
Page 42: Vehicle Routing Problem: how to solve it in Java?

Samle

Page 43: Vehicle Routing Problem: how to solve it in Java?

GoogleDirectionsAPI

Page 44: Vehicle Routing Problem: how to solve it in Java?

GoogleDirectionsAPI

• Disadvantages:• 2,500freedirectionsrequestsperday• Upto23waypointsallowedineachrequestcontaininganAPIkey• Upto8waypointswhennoAPIkeyissupplied• 10requestspersecond• Optimizationbasedontrafficjamsandroadsinfoonly

Page 45: Vehicle Routing Problem: how to solve it in Java?

OptaPlanner demo

Page 46: Vehicle Routing Problem: how to solve it in Java?

jsprit

Page 47: Vehicle Routing Problem: how to solve it in Java?

jsprit

• jsprit• cansolveproblemswithpickupsanddeliveries,backhauls,heterogeneousfleets,finiteandinfinitefleets,multipledepots,timewindows,openroutes,differentstartandendlocations,multiplecapacitydimensions,initialloads,skills…• allowsyoutodefineadditionalstateful andstatelessconstraintstoaccountfortherichnessofyourproblem.• isbenchmarkedagainstclassicalVRPinstances(e.g.Solomoninstances).• isreleasedunderLGPL(v3).

Page 48: Vehicle Routing Problem: how to solve it in Java?

jsprit demo

Page 49: Vehicle Routing Problem: how to solve it in Java?

HowtocopewithVRPeffectively

• Don’tuseMDVRPwhencustomersaremostlyclusteredaroundonedepot• Themoreconstraintsyouhave,thelessprobabilityyousolveVRP• Don’tdefinecontroversialconstraintswiththesamestrength• Dohaveacodetosatisfyhardconstraintsfirst,thensoftones.• Usepositiveconstraintstomaximizevariableandnegativeones– tominimize

Page 50: Vehicle Routing Problem: how to solve it in Java?

References

• https://github.com/graphhopper/jsprit• http://jsprit.github.io/• https://github.com/droolsjbpm/optaplanner• http://www.diku.dk/hjemmesider/ansatte/sropke/Papers/PHDThesis.pdf• https://docs.jboss.org/optaplanner/release/latest/optaplanner-docs/html_single

Page 51: Vehicle Routing Problem: how to solve it in Java?

Thankyouforattention!

Page 52: Vehicle Routing Problem: how to solve it in Java?

Mycontacts

• https://ua.linkedin.com/in/skyfenko

• stanislav.kyfenko

[email protected]