ortools-pickup-delivery-routing
Model OR-Tools paired pickup-and-delivery routing problems, including PDPTW, dial-a-ride, paratransit, patient transport, and courier jobs with same-vehicle…
от benchflow-ai★ 1 941 звезда на GitHub
Установить ortools-pickup-delivery-routing в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Pickup And Delivery Routing
Use this skill when each job has related pickup and dropoff or delivery events that must be served together. Apply it after the base routing model has a time dimension and before solving.
Implementation Flow
- Create one pickup node and one dropoff node per job.
- Add same-vehicle and precedence constraints for every pair.
- Apply the customer-facing time windows and service-time convention from the problem statement.
- Choose optional-service handling: independent pairs, or connected request sets.
- After solving, postprocess connected sets, rebuild route sequences if needed, and re-audit feasibility before counting served jobs or writing output.
Pair Structure
- Represent pickup and dropoff as separate service nodes connected by a shared job ID.
- Pickup demand is positive; dropoff demand is negative. Depot nodes have zero demand and zero service time.
- Add
routing.AddPickupAndDelivery(pickup_index, dropoff_index)for each pair. - Add explicit constraints for the actual business rules:
- same vehicle:
routing.VehicleVar(pickup_index) == routing.VehicleVar(dropoff_index) - pickup before dropoff:
time_dimension.CumulVar(pickup_index) <= time_dimension.CumulVar(dropoff_index)
- same vehicle:
Time Windows And Service Times
- Apply customer time windows to the service event promised to the customer. Appointment and dial-a-ride problems often constrain dropoff arrival; pickup windows can be derived by subtracting direct pickup-to-dropoff travel time from the dropoff window.
- If a problem statement gives explicit pickup and dropoff time-window formulas, implement those formulas directly. Service time belongs in the time transit from a node to the next node; do not change the stated window formula to compensate for service time unless the problem explicitly says to.
Pair Constraint Skeleton
Use this pattern after adding the time dimension. It enforces the paired-service relationship for each job. Add optional-service logic separately after deciding whether jobs are independent pairs or members of connected request sets.
solver = routing.solver()
for job in jobs:
pickup_index = manager.NodeToIndex(job.pickup_node)
dropoff_index = manager.NodeToIndex(job.dropoff_node)
routing.AddPickupAndDelivery(pickup_index, dropoff_index)
solver.Add(routing.VehicleVar(pickup_index) == routing.VehicleVar(dropoff_index))
solver.Add(time_dimension.CumulVar(pickup_index) <= time_dimension.CumulVar(dropoff_index))
if job.dropoff_window is not None:
low, high = job.dropoff_window
time_dimension.CumulVar(dropoff_index).SetRange(low, high)
if job.pickup_window is not None:
low, high = job.pickup_window
time_dimension.CumulVar(pickup_index).SetRange(low, high)
Optional And Connected Service
- First decide whether each optional job is independent or belongs to a connected request set. Independent jobs may be skipped on their own; connected request sets should be optimized as a group.
- For connected request sets, prefer the CP-style grouped disjunction pattern below when search quality matters. Treat it as a search-friendly relaxation: local search may keep partial groups, and postprocessing enforces the final all-or-none business rule.
- Some domains connect multiple pickup-delivery pairs for one passenger, order, shipment, or care plan. This is a special case: apply all-or-none handling only when the problem says a connected set must be fully served or fully rejected.
- For CP-style optional connected sets, put the set's pickup nodes in one disjunction with
max_cardinality=len(request_set)and a very large group penalty, such aslen(request_set) * request_penalty. This makes pickup service drive the served-job objective for the connected set. - Add each corresponding dropoff node as optional with zero penalty. The pickup-delivery constraints still tie feasible served pairs together, while zero-penalty dropoff optionality avoids forcing orphan dropoffs when a pickup or connected set is skipped.
- Use this grouped-disjunction-plus-postprocessing pattern instead of hard equality constraints across the connected set when local search quality matters. Hard all-or-none constraints can make insertion and local search much harder on large optional pickup-delivery instances.
- This grouped-disjunction pattern may allow partial connected sets during search. If the domain treats partial connected sets as unserved, do not count partial sets as served; remove their service nodes and rebuild the route order, or reject the candidate if rebuilding breaks feasibility.
The complete modeling shape for connected optional pickup-delivery service is:
solver = routing.solver()
for job in jobs:
pickup_index = manager.NodeToIndex(job.pickup_node)
dropoff_index = manager.NodeToIndex(job.dropoff_node)
routing.AddPickupAndDelivery(pickup_index, dropoff_index)
solver.Add(routing.VehicleVar(pickup_ind
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл ortools-pickup-delivery-routing?
Model OR-Tools paired pickup-and-delivery routing problems, including PDPTW, dial-a-ride, paratransit, patient transport, and courier jobs with same-vehicle pairing, precedence, capacity, optional connected service, rider time windows, and vehicle shifts.
Как установить скилл ortools-pickup-delivery-routing?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл ortools-pickup-delivery-routing запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
AnthropicToolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
access
AnthropicManage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
configure
AnthropicSet up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
access
AnthropicManage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…