Skip to content

petrakpatrik/MonteCarlo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Food Delivery Routing Simulation - Discrete Optimization

This project was developed as a semester work for the Discrete Optimization course at the Faculty of Management Science and Informatics (FRI), University of Žilina (2026). The core objective is to simulate a food delivery courier's routes to determine the fastest possible path and to calculate the latest possible departure time that guarantees a timely return. The simulation utilizes custom-built pseudorandom number generators to accurately model real-world variables, such as varying traffic speeds and intersection delays.

  • Custom Pseudorandom Generators: Implemented four distinct generators: DiscreteUniformGen, ContinuousUniformGen, DiscreteEmpiricalGen, and ContinuousEmpiricalGen.
  • Robust Architecture: All generators implement a unified IGenerator interface with a double Sample() method, ensuring flexibility across the simulation. Generators were rigorously tested on 100 million generated values.
  • Complex Routing Map: The simulation environment models 18 distinct road sections. Each section type has a specific probability distribution for average speed (ranging from discrete uniform to continuous empirical distributions).
  • Dynamic Traffic Jams: Implements a time-dependent delay model at a critical intersection ("K"), where traffic jams build up starting at 6:30 AM.
  • Monte Carlo Experiments: The project evaluates 6 different route combinations using millions of replications via a scalable SimulationCore abstract class.

Results

Extensive experiments were conducted to find the optimal logistics strategy:

  1. Optimal Route Selection: After running 100,000,000 replications across 6 possible routes, the simulation determined that ZDRSZ is the fastest route.
  2. Latest Departure Time: A specific DeparatureExperiment was designed to find the exact latest departure time. To guarantee an 80% probability of returning to Žilina before the 7:35 AM deadline, the courier must depart exactly at 7:08:34 AM. Leaving even one second later fails the 80% threshold. Verified using 10,000,000 replications.

Technical Implementation

  • Simulation Engine: Based on an abstract SimulationCore class controlling replications.
  • Experiment Types: Includes specialized implementations like FoodDeliveryExperiment (evaluating total route times) and ProbabilityExperiment (evaluating binary success/fail states for deadlines).
  • Data Structures: Heavy reliance on Object-Oriented principles, utilizing enumerations (SectionType, RouteType), inheritance, and polymorphism.

About

Monte Carlo simulation of a food delivery routing problem using custom PRNG distributions to find the optimal path and latest departure time.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages