Route Optimization API là gì
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Nhà phát triển ở Khu vực kinh tế Châu Âu (EEA)
Tối ưu hoá tuyến đường là một API của Nền tảng Google Maps, giúp tạo kế hoạch tuyến đường tối ưu cho một hoặc nhiều xe và các điểm dừng của xe.
Lý do nên sử dụng Route Optimization API
Nâng cao hiệu quả hoạt động của đội xe vận chuyển nhờ kế hoạch tuyến đường. Điều chỉnh tuyến đường cho phù hợp với chi phí, giới hạn thời gian, nhu cầu của khách hàng và mọi mục tiêu kinh doanh khác. Ví dụ:
- Một công ty hậu cần có thể tiết kiệm thời gian và tài nguyên bằng cách lên lịch vận chuyển vào ngày hôm sau, đồng thời tối ưu hoá việc giao hàng để tiết kiệm thời gian, tiết kiệm chi phí, giao hàng đúng hạn, cũng như đảm bảo sự hài lòng của người lái xe và khách hàng cuối.
- Một công ty giao đồ ăn theo yêu cầu có thể đẩy nhanh và nâng cao hiệu quả quy trình điều phối bằng cách chọn người lái xe đang hoạt động phù hợp nhất để nhận đơn đặt hàng mới và thêm đơn đặt hàng đó vào các tuyến đường hiện có.
- Nhà cung cấp dịch vụ tại chỗ có thể cải thiện hiệu suất và mức độ hài lòng của khách hàng bằng cách chỉ định nhà cung cấp cho các cuộc hẹn và tìm ra trình tự dừng tối ưu cho nhiều cuộc hẹn, đồng thời tối ưu hoá lại các tuyến đường khi gặp phải vấn đề.
Những việc bạn có thể làm với Route Optimization API
Sử dụng Route Optimization API để tối ưu hoá các tuyến đường và việc chỉ định nhiệm vụ cho đội xe dựa trên mục tiêu và hạn chế của riêng bạn.
- Mục tiêu: Mục tiêu kinh doanh của bạn.
- Hạn chế: Những hạn chế đối với tài sản thực của bạn.
Mục tiêu
|
Giới hạn
|
Hiệu quả di chuyển
|
Tối ưu hoá các tuyến đường cơ bản bằng cách sử dụng các tham số như khoảng cách và thời gian đến đích.
|
Giờ làm việc của người lái xe
|
Chỉ định tuyến đường cho người lái xe dựa trên giờ làm việc và giờ nghỉ của họ.
|
Đến đúng giờ
|
Ưu tiên một dịch vụ đến lấy hàng, giao hàng hoặc dịch vụ đến trước một thời gian cụ thể.
|
Sức chứa của xe
|
Chỉ định một chiếc xe cho một công việc dựa trên lượng hàng mà xe có thể chở.
|
Chi phí sử dụng xe
|
Giảm thiểu số lượng xe cần thiết để thực hiện một nhiệm vụ.
|
Khoảng thời gian
|
Giao hàng hoặc thực hiện công việc trong một khung giờ cụ thể.
|
Cân bằng tải
|
Phân phối công việc một cách công bằng cho đội xe và nhân viên.
|
Phần phụ thuộc và khả năng tương thích
|
Tối ưu hoá tuyến đường cho đội xe dựa trên loại xe, trình tự công việc hoặc điều kiện vận chuyển.
|
Cách hoạt động của Route Optimization API
Bạn có thể truy cập vào Route Optimization API bằng REST, gRPC và thư viện ứng dụng.
Nội dung yêu cầu
Phần nội dung yêu cầu chấp nhận thông tin về các lô hàng và xe có sẵn để giao các lô hàng đó. Trong đó có những thông tin như:
- Địa điểm đến lấy hàng và giao hàng
- Cửa sổ thời gian
- Kích thước và trọng lượng của lô hàng
- Sức chứa của xe
Nội dung phản hồi
Nội dung phản hồi cung cấp một kế hoạch chi tiết về tuyến đường, bao gồm:
- Trình tự các điểm dừng
- Lô hàng được chỉ định
- Chỉ số tổng thể
Đọc thêm thông tin chi tiết về cách tạo yêu cầu trong phần Tạo thông báo yêu cầu và diễn giải phản hồi trong phần Diễn giải phản hồi.
Tài nguyên
Bảng sau đây tóm tắt các tài nguyên có sẵn thông qua Route Optimization API cùng với dữ liệu mà API này trả về.
Tài nguyên dữ liệu
|
Nội dung mô tả và dữ liệu được trả về
|
Định dạng trả về
|
optimizeTours
|
Phương thức này trả về một tuyến đường được tối ưu hoá, kèm theo thông tin chi tiết về các lượt ghé thăm và chỉ số.
|
JSON hoặc gRPC proto
|
batchOptimizeTours
|
Phương thức này trả về tên tài nguyên của một Thao tác kéo dài, cho biết thời điểm quá trình xử lý hoàn tất.
|
JSON hoặc gRPC proto
|
Cách sử dụng Route Optimization API
Các thư viện ứng dụng hiện có
Để xem danh sách các thư viện ứng dụng có sẵn cho Route Optimization API, hãy xem phần Thư viện ứng dụng.
Bước tiếp theo
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2025-08-10 UTC.
[null,null,["Cập nhật lần gần đây nhất: 2025-08-10 UTC."],[[["\u003cp\u003eRoute Optimization API leverages Google Maps data and custom parameters to generate efficient routes for fleets, considering factors like time, cost, and vehicle capacity.\u003c/p\u003e\n"],["\u003cp\u003eBusinesses like logistics companies, on-demand delivery services, and field service providers can use the API to automate dispatch, optimize delivery routes, and improve overall operational efficiency.\u003c/p\u003e\n"],["\u003cp\u003eThe API offers synchronous and asynchronous options for route calculation and provides detailed route plans with assigned tasks, vehicle routes, and performance metrics.\u003c/p\u003e\n"],["\u003cp\u003eUsers can define objectives such as travel efficiency, on-time arrival, and load balancing, along with constraints like driver work hours and vehicle capacity for tailored optimization.\u003c/p\u003e\n"],["\u003cp\u003eTo begin, set up a Google Cloud project, construct a basic request, and explore advanced scenarios to create customized route optimization solutions.\u003c/p\u003e\n"]]],["The Route Optimization API optimizes routes for single or multiple vehicles, enhancing operational efficiency. Users define business objectives (e.g., travel efficiency, on-time arrival) and constraints (e.g., driver hours, vehicle capacity) to guide the optimization. The API accepts shipment and vehicle details, such as locations, time windows, and capacity. It returns a detailed route plan with stop sequences and assigned shipments via JSON or gRPC. Users can construct requests and interpret responses using provided guidelines and resources.\n"],null,["# What is the Route Optimization API\n\n**European Economic Area (EEA) developers** If your billing address is in the European Economic Area, effective on 8 July 2025, the [Google Maps Platform EEA Terms of Service](https://cloud.google.com/terms/maps-platform/eea) will apply to your use of the Services. Functionality varies by region. [Learn more](/maps/comms/eea/faq).\n\nRoute Optimization is a Google Maps Platform API that generates optimized route\nplans for single or multiple vehicles and their stops.\n\nWhy use the Route Optimization API\n----------------------------------\n\nImprove the operational efficiency of your transportation fleet with the help of\nroute plans. Adjust your routes for cost, time constraints, customer needs, and\nany other business objective. For example:\n\n- A **logistics company** can save time and resources by scheduling next-day shipments while optimizing the deliveries for time efficiency, cost saving, on-time delivery, and driver and end customer satisfaction.\n- An **on-demand food delivery** company can make their dispatch process quicker and more effective by choosing the best active driver to pick up new orders and inserting them in their existing routes.\n- A **field service provider** can improve their efficiency and customer satisfaction by assigning providers to appointments and finding the optimal stop sequence for more than one appointment, all while re-optimizing routes when challenges come up.\n\nWhat you can do with the Route Optimization API\n-----------------------------------------------\n\nUse Route Optimization API to optimize your fleet's routes and tasks\nassignments based on your own *objectives* and\n*constraints*.\n\n- **Objectives:** Your business goals.\n- **Constraints:** The limitations of your physical assets.\n\n| Objectives || Constraints ||\n|-----------------------|--------------------------------------------------------------------------------------|------------------------------------|---------------------------------------------------------------------------------------------------|\n| **Travel efficiency** | Optimize basic travel routes using parameters like distance and time-to-destination. | **Drivers work hours** | Assign routes to drivers based on their work hours and breaks. |\n| **On-time arrival** | Prioritize a pickup, delivery, or service to arrive before a specific time. | **Vehicle capacity** | Assign a vehicle to a task based on the amount of load it can carry. |\n| **Vehicle use cost** | Minimize the number of vehicles required to perform a task. | **Time windows** | Have a shipment or task arrive in a specific time slot. |\n| **Load balancing** | Fairly distribute tasks across a fleet of vehicles and personnel. | **Dependencies and compatibility** | Optimize your fleet routes based on your types of vehicle, task sequence, or shipment conditions. |\n\nHow the Route Optimization API works\n------------------------------------\n\nThe Route Optimization API can be accessed using [REST](/maps/documentation/route-optimization/reference/rest/v1/operations), [gRPC](/maps/documentation/route-optimization/reference/rpc), and\n[client libraries](/maps/documentation/route-optimization/client-libraries).\n\n### Request body\n\nThe request body accepts information about your shipments and the vehicles\navailable to deliver them. This includes details such as:\n\n- Pickup and delivery locations\n- Time windows\n- Shipment size and weight\n- Vehicle capacity\n\n### Response body\n\nThe response body provides a detailed route plan which includes:\n\n- Sequence of stops\n- Assigned shipments\n- Overall metrics\n\nRead more details about constructing a request in [Construct a Request\nMessage](/maps/documentation/route-optimization/construct-request)\nand interpreting a response in [Interpret the\nResponse](/maps/documentation/route-optimization/interpret-response).\n\n### Resources\n\nThe following table summarizes the resources available through the\nRoute Optimization API along with the data it returns.\n\n| **Data resources** | **Description and data returned** | **Return format** |\n|----------------------|-----------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `optimizeTours` | This method returns an optimized route, with details of the visits and metrics. | [JSON](/maps/documentation/route-optimization/reference/rest/v1/projects/optimizeTours) or [gRPC proto](/maps/documentation/route-optimization/reference/rpc/google.maps.routeoptimization.v1#google.maps.routeoptimization.v1.RouteOptimization.OptimizeTours) |\n| `batchOptimizeTours` | This method returns the resource name of a Long Running Operation, which indicates when processing is complete. | [JSON](/maps/documentation/route-optimization/reference/rest/v1/projects/batchOptimizeTours) or [gRPC proto](/maps/documentation/route-optimization/reference/rpc/google.maps.routeoptimization.v1#google.maps.routeoptimization.v1.RouteOptimization.BatchOptimizeTours) |\n\nHow to use the Route Optimization API\n-------------------------------------\n\n|---|----------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| 1 | **Get set up** | Start with [Set up your Google Cloud project](/maps/documentation/route-optimization/cloud-setup) and complete the setup instructions that follow. |\n| 2 | **Run a basic request and receive a response** | After setup, start with sending a basic request and get the response, following [Construct a Request](/maps/documentation/route-optimization/construct-request) and [Interpret the Response](/maps/documentation/route-optimization/interpret-response). |\n| 3 | **Try a more advanced scenario and start creating your own request** | Explore example scenarios starting with [Pickup and Delivery Stop Order Optimization](/maps/documentation/route-optimization/pickup-delivery-order-optimization) and start building requests that match your use cases. |\n\n### Available client libraries\n\nFor a list of the available client libraries for Route Optimization API, see\n[Client Libraries](/maps/documentation/route-optimization/client-libraries).\n\nWhat's next\n-----------\n\n- **Start using the Route Optimization API** : Go to [Run a Basic Request](/maps/documentation/route-optimization/construct-request).\n- **Understand billing** : [Usage and Billing](/maps/documentation/route-optimization/usage-and-billing)\n- **See sample code and libraries** : [Client Libraries](/maps/documentation/route-optimization/client-libraries) and [Open Source](https://github.com/googleapis/google-cloud-java/tree/main/java-maps-routeoptimization).\n- **Follow best practices** : [Best Practices Using Route Optimization API Web\n Services](/maps/documentation/route-optimization/web-service-best-practices)"]]