---
title: "Followed by Randomness"
id: "169"
type: "post"
slug: "followed-by-randomness"
published_at: "2017-11-02T10:37:16+00:00"
modified_at: "2025-08-11T12:32:17+00:00"
url: "https://locus.sh/blogs/followed-by-randomness/"
markdown_url: "https://locus.sh/blogs/followed-by-randomness.md"
excerpt: "Key Takeaways Rolling dice has been a divine act since ancient times. For Pre-Christians who lived along the MediterraneanSea, the die was the law of the land. Since then human beings have not shied away from exploiting its power in..."
taxonomy_category:
  - "Last Mile Delivery Optimization"
  - "Route Optimization"
taxonomy_post_tag:
  - "Algorithms"
  - "Data Science"
  - "Logistics Planning"
  - "Optimization"
  - "Technology"
---

#### [Last Mile Delivery Optimization](https://locus.sh/blogs/category/last-mile-delivery-optimization/) , [Route Optimization](https://locus.sh/blogs/category/route-optimization/)

# Followed by Randomness

[Team Locus](/author/team-locus/)

Nov 2, 2017

6 mins read

## Key Takeaways

- Monte Carlo algorithms leverage intelligent randomization to quickly find excellent solutions for complex routing problems, avoiding the computational burden of exhaustive searches.
- For a 20-stop delivery route, traditional algorithms checking all possibilities would take 12 days to compute, making randomized optimization methods essential for practical applications.
- Local optimization techniques can get trapped in suboptimal solutions, necessitating strategic “jumps” to explore broader solution spaces and find better routing options.
- Locus’s proprietary routing engine uses biased randomization to efficiently pack cargo and assign deliveries, dynamically adjusting probability weights to optimize fleet performance while meeting time windows and constraints.

Rolling dice has been a divine act since ancient times. For Pre-Christians who lived along the MediterraneanSea, the die was the law of the land. Since then human beings have not shied away from exploiting its power in all spheres of life, be it for recreation, gambling, moving economy, predicting weather, and even developing computationally efficient algorithms for immensely hard problems.

## Why routing algorithms?

Algorithms have greatly helped humanity in automating immense number of processes that emanated during the industrial revolution. An algorithm is nothing but a sequence of instructions given to a machine on how to perform a task. At Locus we solve NP-hard optimization problems and the algorithms that we build are sublimely mathematical in flavor.

> [How The World’s Best Route Optimization Engine Works](https://locus.sh/blogs/how-the-worlds-best-route-optimization-engine-works/)

## What is NP-hardness?

An NP-hard optimization problem of size **N** has a solution space of size greater than any polynomial in **N**. Let us consider a derivative of the famous [travelling salesman problem](https://locus.sh/blogs/travelling-salesman-problem-is-not-a-problem-its-a-herculean-task/)
 – you have to visit your friends’ houses to give your Diwali wishes and gifts but the constraint is that you have only a day at your disposal. Before you even start, you want to figure out the best way you could visit your friends so that you spend the least amount of time travelling and are able to finish as early as possible.

If you have **N** friends, the number of ways you could visit them is factorial(**N**), also represented as **N**!. A straightforward procedure is to evaluate all the **N**! tours and then choose the best one. However, the hitch here is that **N**! scales faster than an exponential function as **N** grows large. Even for a small **N**=20, this would execute approximately 10¹? operations. Assuming that a computer performs 10¹² operations per second, which is quite optimistic, the execution time of this algorithm would be 10? seconds ? 12 days. Clearly this is not a viable option.

Rather than unintelligently testing all solutions, both good and bad, a far better approach is to logically construct a solution that is guaranteed to be the best possible one. However, even the best of such strict approaches needs an astronomically large number of operations to produce a solution.

### *At Locus we do play dice*

Instead of performing a mindless exhaustive search, or building the perfect solution slowly and painfully, it turns out that making millions of intelligent guesses can yield excellent solutions rapidly.

Another intuitive approach is to start with a random tour out of these possible 20! tours and keep improving iteratively by making small tweaks until no small tweak can improve the tour. Since the solution obtained here is best compared to all similar solutions, it is referred to as a local optimum. A limitation of this approach is that it considers only a small subset of all possible configurations. Hence, the solution obtained might be highly inferior with respect to the best one.

The best scenario when searching the solution space would be if the algorithm can figure out when and how to get out of these local optima. The algorithms that we design at Locus not only explore a larger part of the solution space but also intelligently exploit the power of die to jump out of the local optimum. We give our algorithm a chance to accept a worse solution than the existing one in expectation of finding an even better solution later. A substantial trait of this algorithm is that after hopping out of a local optimum it is able to find better solutions in future iterations.

Cost function during a sample run of Locus’ proprietary VRP engine

#### Games that we play

**3D Box Packing:** We pack freight in the most optimal way. When pushing a box in the cargo, our algorithm rolls a biased die to figure out the best orientation to place this box. The die is more favorable to the configuration that has better packing efficiency.

> [Loading a shipping container ?—?Part I](https://locus.sh/blogs/loading-a-shipping-container-part-i/)

**[Vehicle Routing Problem](https://locus.sh/blogs/vehicle-routing-problem-decoded-what-why-and-how/)
:** We generate the best routes for a fleet of vehicles on its way to make deliveries within restricted time-windows. When assigning a task to a fleet our algorithm gives chance to all vehicles but recommends those that are in the vicinity of the current delivery’s location. The die favors the assignment that will result in less time and distance being traveled on the road while respecting the [hard constraints](https://locus.sh/blogs/graceful-scaling-of-queue-workers/)
 like volume breach and time windows.

Moreover, the algorithms that we design are perceptive enough to infer the biases of these dice. As the algorithm continues to improve upon the solution, it gradually builds robustness to accepting a less optimal solution for VRP. Below is an illustration depicting the value of these biases during the course of a run of the algorithm.

Bias of a die during a sample run of Locus’ proprietary [VRP engine](https://locus.sh/blogs/how-the-worlds-best-route-optimization-engine-works/)

#### Monte Carlo to Las Vegas

The technique described above falls under the domain of Monte Carlo algorithms. There also exist algorithms that can always find the best solution, such celebrated randomized algorithms are known as Las Vegas algorithms. Fortunately there do not exist Las Vegas type algorithms for the problems that we solve. At Locus we are developing and training intelligent dice which will help us drive to Vegas!

Locus offers [best route optimization software](https://locus.sh/products/dispatcher/)
 to enterprises to improve last-mile deliveries with greater cost-efficiency. Get in touch with us for a [free demo](https://locus.sh/products/dispatcher/#request-access)
.

[https://locu.sh/2zDwagd](https://locu.sh/2zDwagd)

**Like what you’re reading? Hit ? and**[follow us](https://locus.sh/blogs/)
**to read more.**

This post was authored by: **Kamal Nayan Goyal**

MEET THE AUTHOR

Team Locus

Written by the Locus Solutions Team—logistics technology experts helping enterprise fleets scale with confidence and precision.

### Related Tags:

[Algorithms](https://locus.sh/blogs/tagged/algorithms/)
[Data Science](https://locus.sh/blogs/tagged/data-science/)
[Logistics Planning](https://locus.sh/blogs/tagged/logistics/)
[Optimization](https://locus.sh/blogs/tagged/optimization/)
[Technology](https://locus.sh/blogs/tagged/technology/)

[https://locus.sh/blogs/convenience-as-a-currency-locus-for-bfsi/](https://locus.sh/blogs/convenience-as-a-currency-locus-for-bfsi/)
#### [Blog](https://locus.sh/blogs/category/blog/)

## [Bringing Banking to the Customer’s Doorstep with ‘Locus for BFSI’](https://locus.sh/blogs/convenience-as-a-currency-locus-for-bfsi/)

[Team Locus](https://locus.sh/blogs/author/team-locus/)

Jul 18, 2017

Key Takeaways Expectations are a moving target, thereby creating the need for institutions to regularly track and understand how they are Performing Against Customer Expectations (PACE). The PACE index for the banking sector does this on an annual basis, in a global study spanning 8,000 customers and 500 small businesses. The 2016 survey revealed that Indian banks were near the bottom of […]

[Read more](https://locus.sh/blogs/convenience-as-a-currency-locus-for-bfsi/)

[https://locus.sh/blogs/how-the-worlds-best-route-optimization-engine-works/](https://locus.sh/blogs/how-the-worlds-best-route-optimization-engine-works/)
#### [Route Optimization](https://locus.sh/blogs/category/route-optimization/)

## [How the World’s Best Route Optimization Engine Works](https://locus.sh/blogs/how-the-worlds-best-route-optimization-engine-works/)

[Team Locus](https://locus.sh/blogs/author/team-locus/)

Jan 29, 2018

Key Takeaways Introduction A route optimization engine is software that calculates the most efficient delivery, pickup, or service route by evaluating business constraints such as order priority, vehicle capacity, driver availability, traffic, customer delivery windows, service-level agreements, distance, service time, and cost-to-serve. Unlike basic navigation or route planning tools, a route optimization engine does not […]

[Read more](https://locus.sh/blogs/how-the-worlds-best-route-optimization-engine-works/)

## Followed by Randomness

- Share
- [Print](javascript:window.print())
- [Download](#)
- [Schedule a Demo](https://locus.sh/schedule-demo/)

### Is your team spending more time on fixing logistics plan than running the operation?

- Agentic transportation management from order intake to freight settlement
- Route optimization built on 250+ real-world constraints
- AI-driven dispatch with automatic execution handling

20%Cost Reduction

66%Faster Planning Cycles

[Schedule a demo](/schedule-demo/)

Insights Worth Your Time

#### [General](https://locus.sh/blogs/category/general/)

## [Locus 2026 US Consumer Survey: Generative AI isn’t Just Changing How Consumers Shop, it’s Breaking the Demand Patterns US Retail Was Built On](https://locus.sh/blogs/generative-ai-shopping-effect-retail-fulfillment-operations-locus-q2-2026-consumer-survey/)

[Ishan Bhattacharya](https://locus.sh/blogs/author/ishan_locus/)

May 29, 2026

#### [General](https://locus.sh/blogs/category/general/)

## [Embedded vs Bolted-On AI: The Architecture Question European Logistics Buyers Are Asking](https://locus.sh/blogs/embedded-vs-bolted-on-ai-european-logistics-platform-architecture-business-benefits/)

[Aseem Sinha](https://locus.sh/blogs/author/aseem_locus/)

May 21, 2026

#### [General](https://locus.sh/blogs/category/general/)

## [Hybrid Fleet Management: How Owned, 3PL, Gig, ICE, and EV Capacity Actually Operate at Most Enterprises](https://locus.sh/blogs/three-workforce-fleet-reality-owned-3pl-gig-drivers/)

[Aseem Sinha](https://locus.sh/blogs/author/aseem_locus/)

May 7, 2026

#### [General](https://locus.sh/blogs/category/general/)

## [US Returns Hit $850 Billion in 2025: Why US Retailers Are Restructuring Reverse Logistics in 2026](https://locus.sh/blogs/850-billion-us-returns-ai-routing-reverse-logistics-2026/)

[Ishan Bhattacharya](https://locus.sh/blogs/author/ishan_locus/)

May 7, 2026
