इस उदाहरण में दिखाया गया है कि Route Optimization API के अनुरोध में, वाहन की क्षमता से जुड़ी पाबंदियों को मैनेज करने के लिए, loadDemands और loadLimits का इस्तेमाल कैसे किया जाता है.
कॉन्सेप्ट के बारे में पूरी जानकारी के लिए, लोड की मांग और सीमा से जुड़े मुख्य कॉन्सेप्ट दस्तावेज़ देखें.
अनुरोध का उदाहरण
यहां दिए गए उदाहरण में, एक ऐसे वाहन का इस्तेमाल किया गया है जिसकी लोड करने की सीमा तय है. इस वाहन को अलग-अलग वज़न के तीन शिपमेंट डिलीवर करने हैं.
इस उदाहरण अनुरोध में, लोड से जुड़े ये पैरामीटर शामिल हैं:
shipments[0]में 50weightKgकी लोड डिमांडamountहै.shipments[1]में 10weightKgकेamountलोड की मांग है.shipments[2]में 80weightKgके लोड की ज़रूरत है.amountvehicles[0]में 100weightKgकी लोड सीमाmaxLoadहै.
लोड करने की मांगों और सीमाओं के साथ अनुरोध का उदाहरण देखें
{ "populatePolylines": false, "populateTransitionPolylines": false, "model": { "globalStartTime": "2023-01-13T16:00:00Z", "globalEndTime": "2023-01-14T16:00:00Z", "shipments": [ { "deliveries": [ { "arrivalLocation": { "latitude": 37.789456, "longitude": -122.390192 }, "duration": "250s" } ], "pickups": [ { "arrivalLocation": { "latitude": 37.794465, "longitude": -122.394839 }, "duration": "150s" } ], "penaltyCost": 100.0, "loadDemands": { "weightKg": { "amount": "50" } } }, { "deliveries": [ { "arrivalLocation": { "latitude": 37.789116, "longitude": -122.395080 }, "duration": "250s" } ], "pickups": [ { "arrivalLocation": { "latitude": 37.794465, "longitude": -122.394839 }, "duration": "150s" } ], "penaltyCost": 15.0, "loadDemands": { "weightKg": { "amount": "10" } } }, { "deliveries": [ { "arrivalLocation": { "latitude": 37.795242, "longitude": -122.399347 }, "duration": "250s" } ], "pickups": [ { "arrivalLocation": { "latitude": 37.794465, "longitude": -122.394839 }, "duration": "150s" } ], "penaltyCost": 50.0, "loadDemands": { "weightKg": { "amount": "80" } } } ], "vehicles": [ { "endLocation": { "latitude": 37.794465, "longitude": -122.394839 }, "startLocation": { "latitude": 37.794465, "longitude": -122.394839 }, "costPerHour": 40.0, "costPerKilometer": 10.0, "loadLimits": { "weightKg": { "maxLoad": "100" } } } ] } }
जवाब का उदाहरण
जवाब में, वाहन के लिए ऑप्टिमाइज़ किया गया रास्ता दिखाया गया है. सभी शिपमेंट का कुल लोड, वाहन की क्षमता से ज़्यादा है. इसलिए, ऑप्टिमाइज़र पिकअप और डिलीवरी का क्रम बनाता है, ताकि loadLimits का उल्लंघन न हो.
लोड की मांगों और सीमाओं के साथ अनुरोध का जवाब देखना
{ "routes": [ { "vehicleStartTime": "2023-01-13T16:00:00Z", "vehicleEndTime": "2023-01-13T16:43:27Z", "visits": [ { "isPickup": true, "startTime": "2023-01-13T16:00:00Z", "detour": "0s", "loadDemands": { "weightKg": { "amount": "50" } } }, { "shipmentIndex": 1, "isPickup": true, "startTime": "2023-01-13T16:02:30Z", "detour": "150s", "loadDemands": { "weightKg": { "amount": "10" } } }, { "startTime": "2023-01-13T16:08:55Z", "detour": "150s", "loadDemands": { "weightKg": { "amount": "-50" } } }, { "shipmentIndex": 1, "startTime": "2023-01-13T16:16:37Z", "detour": "343s", "loadDemands": { "weightKg": { "amount": "-10" } } }, { "shipmentIndex": 2, "isPickup": true, "startTime": "2023-01-13T16:27:07Z", "detour": "1627s", "loadDemands": { "weightKg": { "amount": "80" } } }, { "shipmentIndex": 2, "startTime": "2023-01-13T16:36:26Z", "detour": "0s", "loadDemands": { "weightKg": { "amount": "-80" } } } ], "transitions": [ { "travelDuration": "0s", "waitDuration": "0s", "totalDuration": "0s", "startTime": "2023-01-13T16:00:00Z", "vehicleLoads": { "weightKg": {} } }, { "travelDuration": "0s", "waitDuration": "0s", "totalDuration": "0s", "startTime": "2023-01-13T16:02:30Z", "vehicleLoads": { "weightKg": { "amount": "50" } } }, { "travelDuration": "235s", "travelDistanceMeters": 795, "waitDuration": "0s", "totalDuration": "235s", "startTime": "2023-01-13T16:05:00Z", "vehicleLoads": { "weightKg": { "amount": "60" } } }, { "travelDuration": "212s", "travelDistanceMeters": 791, "waitDuration": "0s", "totalDuration": "212s", "startTime": "2023-01-13T16:13:05Z", "vehicleLoads": { "weightKg": { "amount": "10" } } }, { "travelDuration": "380s", "travelDistanceMeters": 1190, "waitDuration": "0s", "totalDuration": "380s", "startTime": "2023-01-13T16:20:47Z", "vehicleLoads": { "weightKg": {} } }, { "travelDuration": "409s", "travelDistanceMeters": 1371, "waitDuration": "0s", "totalDuration": "409s", "startTime": "2023-01-13T16:29:37Z", "vehicleLoads": { "weightKg": { "amount": "80" } } }, { "travelDuration": "171s", "travelDistanceMeters": 665, "waitDuration": "0s", "totalDuration": "171s", "startTime": "2023-01-13T16:40:36Z", "vehicleLoads": { "weightKg": {} } } ], "metrics": { "performedShipmentCount": 3, "travelDuration": "1407s", "waitDuration": "0s", "delayDuration": "0s", "breakDuration": "0s", "visitDuration": "1200s", "totalDuration": "2607s", "travelDistanceMeters": 4812, "maxLoads": { "weightKg": { "amount": "80" } } }, "routeCosts": { "model.vehicles.cost_per_kilometer": 48.12, "model.vehicles.cost_per_hour": 28.966666666666665 }, "routeTotalCost": 77.086666666666659 } ], "metrics": { "aggregatedRouteMetrics": { "performedShipmentCount": 3, "travelDuration": "1407s", "waitDuration": "0s", "delayDuration": "0s", "breakDuration": "0s", "visitDuration": "1200s", "totalDuration": "2607s", "travelDistanceMeters": 4812, "maxLoads": { "weightKg": { "amount": "80" } } }, "usedVehicleCount": 1, "earliestVehicleStartTime": "2023-01-13T16:00:00Z", "latestVehicleEndTime": "2023-01-13T16:43:27Z", "totalCost": 77.086666666666659, "costs": { "model.vehicles.cost_per_hour": 28.966666666666665, "model.vehicles.cost_per_kilometer": 48.12 } } }
तीन शिपमेंट का कुल loadDemands (50 + 10 + 80 = 140) वाहन के loadLimits (100) से ज़्यादा है. इसलिए, वाहन एक बार में सभी शिपमेंट नहीं ले जा सकता. ऑप्टिमाइज़र सिर्फ़ उन रास्तों पर विचार करता है जहां shipment[0] और shipment[2] एक ही समय पर वाहन में नहीं होते हैं. ऐसा इसलिए, क्योंकि इन शिपमेंट का कुल वज़न, वाहन की लोड लिमिट से ज़्यादा होता है.
गाड़ी के लोड की सीमा से ज़्यादा न हो, इसके लिए इस रास्ते में ये visits हैं:
shipment[0]को पिक अप कर लिया गया हैshipment[1]को पिक अप कर लिया गया हैshipment[0]डिलीवर कर दिया गया हैshipment[1]डिलीवर कर दिया गया हैshipment[2]को पिक अप कर लिया गया हैshipment[2]डिलीवर कर दिया गया है
पूरे रास्ते में वाहन का लोड बदलता रहता है. इसे transitions ऐरे में देखा जा सकता है. उदाहरण के लिए, transitions[2] में दिखाया गया है कि पहले दो शिपमेंट (50 + 10) पिक अप करने के बाद, वाहन में 60 weightKg का लोड है.
metrics में मौजूद maxLoads प्रॉपर्टी से पता चलता है कि रास्ते में किसी भी समय, ज़्यादा से ज़्यादा 80 weightKg सामान ले जाया गया. इससे पुष्टि होती है कि समाधान, वाहन की 100 weightKg की सीमा के अंदर रहा.
सॉफ़्ट लोड की सीमाएं
यहां दिए गए उदाहरण में, एक से ज़्यादा वाहनों वाले रास्ते को ऑप्टिमाइज़ करने के लिए, सॉफ्ट लोड लिमिट का इस्तेमाल करने का तरीका बताया गया है. इस समाधान में, शिपमेंट को दो वाहनों के बीच बांट दिया जाता है, ताकि वाहन की तय की गई सीमा से ज़्यादा सामान ले जाने पर लगने वाले जुर्माने से बचा जा सके.
अनुरोध का उदाहरण
इस अनुरोध में, अब सिर्फ़ डिलीवरी के लिए तीन शिपमेंट और एक ही loadLimits और softMaxLoad वाले दो वाहन शामिल हैं.
इस उदाहरण के लिए मुख्य पैरामीटर ये हैं:
- इन तीन शिपमेंट का कुल
loadDemands140weightKgहै (50- 60 + 30).
- दो वाहन उपलब्ध हैं. इनमें से एक का
softMaxLoad"100"weightKgऔर दूसरे काcostPerUnitAboveSoftMax5.0 है.
सॉफ़्ट लोड की सीमा के साथ अनुरोध का उदाहरण देखें
{ "populatePolylines": false, "populateTransitionPolylines": false, "model": { "globalStartTime": "2023-01-13T16:00:00Z", "globalEndTime": "2023-01-14T16:00:00Z", "shipments": [ { "deliveries": [ { "arrivalLocation": { "latitude": 37.789456, "longitude": -122.390192 }, "duration": "250s" } ], "loadDemands": { "weightKg": { "amount": "50" } } }, { "deliveries": [ { "arrivalLocation": { "latitude": 37.789116, "longitude": -122.395080 }, "duration": "250s" } ], "loadDemands": { "weightKg": { "amount": "60" } } }, { "deliveries": [ { "arrivalLocation": { "latitude": 37.795242, "longitude": -122.399347 }, "duration": "250s" } ], "loadDemands": { "weightKg": { "amount": "30" } } } ], "vehicles": [ { "endLocation": { "latitude": 37.794465, "longitude": -122.394839 }, "startLocation": { "latitude": 37.794465, "longitude": -122.394839 }, "costPerHour": 40.0, "costPerKilometer": 10.0, "loadLimits": { "weightKg": { "maxLoad": "150", "softMaxLoad": "100", "costPerUnitAboveSoftMax": 5.0 } } }, { "endLocation": { "latitude": 37.794465, "longitude": -122.394839 }, "startLocation": { "latitude": 37.794465, "longitude": -122.394839 }, "costPerHour": 40.0, "costPerKilometer": 10.0, "loadLimits": { "weightKg": { "maxLoad": "150", "softMaxLoad": "100", "costPerUnitAboveSoftMax": 5.0 } } } ] } }
जवाब का उदाहरण
जवाब में अब दो रास्ते शामिल हैं. हर वाहन के लिए एक रास्ता. ऑप्टिमाइज़र यह तय करता है कि एक वाहन का इस्तेमाल करने और सॉफ्ट लिमिट के उल्लंघन पर लगने वाला जुर्माना भरने के बजाय, दोनों वाहनों का इस्तेमाल करना ज़्यादा किफ़ायती है.
सॉफ़्ट लोड की सीमा के साथ अनुरोध का जवाब देखना
{ "routes": [ { "vehicleStartTime": "2023-01-13T16:00:00Z", "vehicleEndTime": "2023-01-13T16:13:31Z", "visits": [ { "startTime": "2023-01-13T16:03:53Z", "detour": "0s", "loadDemands": { "weightKg": { "amount": "-50" } } } ], "transitions": [ { "travelDuration": "233s", "travelDistanceMeters": 794, "waitDuration": "0s", "totalDuration": "233s", "startTime": "2023-01-13T16:00:00Z", "vehicleLoads": { "weightKg": { "amount": "50" } } }, { "travelDuration": "328s", "travelDistanceMeters": 1188, "waitDuration": "0s", "totalDuration": "328s", "startTime": "2023-01-13T16:08:03Z", "vehicleLoads": { "weightKg": {} } } ], "metrics": { "performedShipmentCount": 1, "travelDuration": "561s", "visitDuration": "250s", "totalDuration": "811s", "travelDistanceMeters": 1982, "maxLoads": { "weightKg": { "amount": "50" } } }, "routeCosts": { "model.vehicles.cost_per_kilometer": 19.82, "model.vehicles.cost_per_hour": 9.01 }, "routeTotalCost": 28.83 }, { "vehicleIndex": 1, "vehicleStartTime": "2023-01-13T16:00:00Z", "vehicleEndTime": "2023-01-13T16:21:43Z", "visits": [ { "shipmentIndex": 1, "startTime": "2023-01-13T16:05:54Z", "detour": "0s", "loadDemands": { "weightKg": { "amount": "-60" } } }, { "shipmentIndex": 2, "startTime": "2023-01-13T16:13:52Z", "detour": "473s", "loadDemands": { "weightKg": { "amount": "-30" } } } ], "transitions": [ { "travelDuration": "354s", "travelDistanceMeters": 1196, "waitDuration": "0s", "totalDuration": "354s", "startTime": "2023-01-13T16:00:00Z", "vehicleLoads": { "weightKg": { "amount": "90" } } }, { "travelDuration": "228s", "travelDistanceMeters": 808, "waitDuration": "0s", "totalDuration": "228s", "startTime": "2023-01-13T16:10:04Z", "vehicleLoads": { "weightKg": { "amount": "30" } } }, { "travelDuration": "221s", "travelDistanceMeters": 655, "waitDuration": "0s", "totalDuration": "221s", "startTime": "2023-01-13T16:18:02Z", "vehicleLoads": { "weightKg": {} } } ], "metrics": { "performedShipmentCount": 2, "travelDuration": "803s", "visitDuration": "500s", "totalDuration": "1303s", "travelDistanceMeters": 2659, "maxLoads": { "weightKg": { "amount": "90" } } }, "routeCosts": { "model.vehicles.cost_per_kilometer": 26.59, "model.vehicles.cost_per_hour": 14.48 }, "routeTotalCost": 41.07 } ], "metrics": { "aggregatedRouteMetrics": { "performedShipmentCount": 3, "travelDuration": "1364s", "visitDuration": "750s", "totalDuration": "2114s", "travelDistanceMeters": 4641, "maxLoads": { "weightKg": { "amount": "90" } } }, "usedVehicleCount": 2, "earliestVehicleStartTime": "2023-01-13T16:00:00Z", "latestVehicleEndTime": "2023-01-13T16:21:43Z", "totalCost": 69.90, "costs": { "model.vehicles.cost_per_kilometer": 46.41, "model.vehicles.cost_per_hour": 23.49 } } }
यहां दिए गए फ़ील्ड में बताया गया है कि ऑप्टिमाइज़र ने शिपमेंट को दो वाहनों में कैसे बांटा, ताकि लोड को 100 weightKg की सॉफ़्ट लिमिट से कम रखा जा सके.
- पहला रूट (
vehicleIndex: 0) 50weightKgशिपमेंट को मैनेज करता है. इसकीmaxLoads"50" है, जो सॉफ्ट लिमिट से कम है. - दूसरा रूट (
vehicleIndex: 1), 60 और 30weightKgशिपमेंट को मैनेज करता है. इसकाmaxLoads"90" है, जो सॉफ्ट लिमिट से भी कम है. - दोनों वाहनों में से किसी ने भी तय सीमा का उल्लंघन नहीं किया है. इसलिए, दोनों रास्तों के लिए
routeCostsमेंcostPerUnitAboveSoftMaxका कोई जुर्माना नहीं दिखाया गया है.