<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/los-movimientos-the-routing-problem-that-nearly-broke-my-spirit-dfklfbtvt" -->

---
title: “Los Movimientos”: The Routing Problem That Nearly Broke...
description: A personal story about manually planning truck and personnel routes for oil and gas drilling operations in Venezuela, which turns out to be the Capacitated...
canonical: https://daily.dev/posts/los-movimientos-the-routing-problem-that-nearly-broke-my-spirit-dfklfbtvt
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: “Los Movimientos”: The Routing Problem That Nearly Broke My Spirit | daily.dev
og:description: A personal story about manually planning truck and personnel routes for oil and gas drilling operations in Venezuela, which turns out to be the Capacitated...
og:url: https://daily.dev/posts/los-movimientos-the-routing-problem-that-nearly-broke-my-spirit-dfklfbtvt
og:image: https://api.daily.dev/og/posts/dfklfbtVT.png
og:image:alt: “Los Movimientos”: The Routing Problem That Nearly Broke My Spirit
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# “Los Movimientos”: The Routing Problem That Nearly Broke My Spirit

**[Towards Data Science](https://daily.dev/sources/tds)** · 39 min read · 0 upvotes · 0 comments

## Summary

A personal story about manually planning truck and personnel routes for oil and gas drilling operations in Venezuela, which turns out to be the Capacitated Pickup and Delivery Problem with Time Windows (PDPTW). The post explains the mathematical formulation of the PDPTW, walks through each constraint in plain language, and provides a complete Python implementation using Pyomo and the open-source HiGHS solver. A toy instance with 3 vehicles, 10 requests, and 20 service nodes is solved optimally in seconds, with full code for data loading, model construction, solution extraction, and route visualization. The post also discusses real-world limitations like fatigue rules, dynamic requests, and the importance of user-friendly interfaces for dispatchers.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://towardsdatascience.com/los-movimientos-the-routing-problem-that-nearly-broke-my-spirit-2>

## Questions this post answers

### How do you formulate a pickup and delivery vehicle routing problem with time windows as a mixed-integer linear program?

The Capacitated Pickup and Delivery Problem with Time Windows uses binary arc variables to build routes, continuous variables to track service start times and vehicle load, and a binary unserved-request variable placed in a request bank when demand exceeds fleet capacity. Fourteen constraints enforce assignment, same-vehicle pickup-delivery pairing, route continuity, time propagation, precedence, capacity limits, and empty start/end loads, based on the Ropke and Pisinger (2006) PDPTW formulation.

_Anyone modeling routing constraints in code can compare formulations and implementations surfaced on daily.dev._

### What tools can solve a mixed-integer pickup and delivery routing model in Python without a commercial solver license?

Pyomo can be used to build the mixed-integer linear model and the open-source HiGHS solver can solve it, avoiding the cost of commercial solvers like Gurobi or CPLEX. For small to medium instances, such as a toy problem with ten requests and three vehicles, HiGHS finds an exact optimal solution within seconds using a two-minute time limit and zero relative gap setting.

_Developers weighing open-source versus commercial optimization solvers can track comparisons like this on daily.dev._

### What happens when a vehicle routing model doesn't have enough vehicles to serve every pickup and delivery request?

Rather than declaring the whole problem infeasible, the model places unserved requests into a request bank by setting a binary variable and applies a large penalty (10,000 in this example) in the objective function for each one left there. This lets the solver produce the best feasible plan for available vehicles while flagging exactly which requests could not be served, signaling a fleet-capacity shortfall.

_Teams sizing fleets against demand can follow modeling techniques like this via daily.dev._

## Similar posts on daily.dev

- [Los Movimientos, Part II: Solving Large Pickup-and-Delivery Problems with Adaptive Large Neighborhood Search](https://daily.dev/posts/los-movimientos-part-ii-solving-large-pickup-and-delivery-problems-with-adaptive-large-neighborhoo-miinonmi4) · Towards Data Science · 0 upvotes · 0 comments
- [The Race Against the Clock: Optimizing Supply Chain Capacity for Faster Deliveries — Part 1 \(Capacity Management Series\)](https://daily.dev/posts/the-race-against-the-clock-optimizing-supply-chain-capacity-for-faster-deliveries-part-1-capacit-yv1houimx) · Flipkart Tech · 0 upvotes · 0 comments
- [The power of collaboration: How we can reduce traffic congestion](https://daily.dev/posts/the-power-of-collaboration-how-we-can-reduce-traffic-congestion-uhtrzgmko) · Hacker News · 0 upvotes · 0 comments
- [I got paid minimum wage to solve an impossible problem.](https://daily.dev/posts/i-got-paid-minimum-wage-to-solve-an-impossible-problem--xwckclgfz) · Programming Digest · 85 upvotes · 10 comments

---

Tags: [#python](https://daily.dev/tags/python)

[View this post on daily.dev](https://daily.dev/posts/los-movimientos-the-routing-problem-that-nearly-broke-my-spirit-dfklfbtvt)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"“Los Movimientos”: The Routing Problem That Nearly Broke My Spirit","url":"https://daily.dev/posts/los-movimientos-the-routing-problem-that-nearly-broke-my-spirit-dfklfbtvt","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/los-movimientos-the-routing-problem-that-nearly-broke-my-spirit-dfklfbtvt"},"datePublished":"2026-07-27T16:47:27.266Z","dateModified":"2026-09-13T20:43:03.016Z","description":"A personal story about manually planning truck and personnel routes for oil and gas drilling operations in Venezuela, which turns out to be the Capacitated...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/5ebae6fabf692915531f00e728cd560b?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/5ebae6fabf692915531f00e728cd560b?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Towards Data Science","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Towards Data Science","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/tds","url":"https://daily.dev/sources/tds"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/los-movimientos-the-routing-problem-that-nearly-broke-my-spirit-dfklfbtvt","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"python","timeRequired":"PT39M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Towards Data Science","item":"https://daily.dev/sources/tds"},{"@type":"ListItem","position":3,"name":"“Los Movimientos”: The Routing Problem That Nearly Broke My Spirit"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/los-movimientos-the-routing-problem-that-nearly-broke-my-spirit-dfklfbtvt#faq","mainEntity":[{"@type":"Question","name":"How do you formulate a pickup and delivery vehicle routing problem with time windows as a mixed-integer linear program?","acceptedAnswer":{"@type":"Answer","text":"The Capacitated Pickup and Delivery Problem with Time Windows uses binary arc variables to build routes, continuous variables to track service start times and vehicle load, and a binary unserved-request variable placed in a request bank when demand exceeds fleet capacity. Fourteen constraints enforce assignment, same-vehicle pickup-delivery pairing, route continuity, time propagation, precedence, capacity limits, and empty start/end loads, based on the Ropke and Pisinger (2006) PDPTW formulation. Anyone modeling routing constraints in code can compare formulations and implementations surfaced on daily.dev."}},{"@type":"Question","name":"What tools can solve a mixed-integer pickup and delivery routing model in Python without a commercial solver license?","acceptedAnswer":{"@type":"Answer","text":"Pyomo can be used to build the mixed-integer linear model and the open-source HiGHS solver can solve it, avoiding the cost of commercial solvers like Gurobi or CPLEX. For small to medium instances, such as a toy problem with ten requests and three vehicles, HiGHS finds an exact optimal solution within seconds using a two-minute time limit and zero relative gap setting. Developers weighing open-source versus commercial optimization solvers can track comparisons like this on daily.dev."}},{"@type":"Question","name":"What happens when a vehicle routing model doesn't have enough vehicles to serve every pickup and delivery request?","acceptedAnswer":{"@type":"Answer","text":"Rather than declaring the whole problem infeasible, the model places unserved requests into a request bank by setting a binary variable and applies a large penalty (10,000 in this example) in the objective function for each one left there. This lets the solver produce the best feasible plan for available vehicles while flagging exactly which requests could not be served, signaling a fleet-capacity shortfall. Teams sizing fleets against demand can follow modeling techniques like this via daily.dev."}}]}
```

