节点取舍
原能力
对照必到地点、可用时段和绕行代价,说明保留或放弃某个停留点的理由。(细化版 p.10–11)
首选项目
OR-Tools(Apache-2.0)。 OR-Tools
匹配范围
带时间窗路由和路程矩阵比较停留节点。
源码
OR-Tools · def main(
ortools/routing/samples/vrp_time_windows.py · 112–125 行。 在 GitHub 查看源码 · 许可证与声明
源码片段
def main() -> None:
"""Solve the VRP with time windows."""
# Instantiate the data problem.
# [START data]
data = create_data_model()
# [END data]
# Create the routing index manager.
# [START index_manager]
manager = routing.IndexManager(
len(data["time_matrix"]), data["num_vehicles"], data["depot"]
)
# [END index_manager]
- # Copyright 2010-2025 Google LLC
Valhalla · actor_t::route(
src/tyr/actor.cc · 97–110 行。 在 GitHub 查看源码 · 许可证与声明
源码片段
actor_t::route(const std::string& request_str, const std::function<void()>* interrupt, Api* api) {
auto scoped_cleaner = make_finally([this]() {
if (auto_cleanup)
cleanup();
});
// set the interrupts
pimpl->set_interrupts(interrupt);
// if the caller doesn't want a copy we'll use this dummy
Api dummy;
if (!api) {
api = &dummy;
}
// parse the request
ParseApi(request_str, Options::route, *api);
实现与验收要点
定义必到与可舍、真实营业时间和服务条件。