Vorto Challenge

My Approach

My approach to solving this problem was to use the sweep algorithm. The sweep algorithm is a technique used to solve problems that involve finding the intersection of two or more geometric shapes. The algorithm works by sweeping a line across the shapes and keeping track of the intersections that occur.

The implementation of the algorithm involves the following steps:

  • Calculate the center loads as an average point of all the loads. This provides a reference point for the angles.

  • Sort the loads by their angle from the center load. This can help in preventing situations where many loads are initially assigned in a specific direction, potentially leading to imbalanced routes and higher total costs. It helps in creating a more spatial distribution of the loads and well-distributed assignment of loads to drivers

Run locally

  • Ensure that Go is installed on your machine.

  • Run the following command to build the project

      go build .
  • Run the following command to run the project

      ./vorto-challenge ./Training\ Problems

References