Skip to content

Latest commit

 

History

History
90 lines (62 loc) · 2.31 KB

how-it-works.md

File metadata and controls

90 lines (62 loc) · 2.31 KB

How it works

This document explains how that solution was developed and how it can be explored.

Visual demonstration

kibana_preview.png Preview generated by Kibana

Algorithms

Controlling the maximum cargos for each truck

  • The default max cargos for truck is 1
make dev
  • We can try a max cargo option for truck = 2
make dev/maxcargo

Calculating distances

make dev
  • More accurate, you can use the Google Routes remote provider (you must provide GOOGLE_API_KEY env var):
make run/remote

Designating trucks for cargos

Five different algorithms were developed, with 2 remaining:

  • Iteration with sorted dictionary The classic cargos x trucks iteration (sorted dictionary)
make run
  • Iteration only for cargos + O log(n) kd-tree (optimized when the trucks are loaded): While the trucks are loaded, for each truck appended, we use a kd-tree to manage the locations.
make run/kdtree

How to dev

  • Watch for modifications, run lint and tests
make dev/watch
  • Run dev mode (with performance check)
make dev
make lint/fix

References

I'm not Python senior, but I really appreciate Python's language.

What I can do with more time

  • Add a hash function for the locations: to improve even more the checking for the closest trucks
  • Add parallelization processing
  • Add algorithm to decide which cargo is best in case of an already designated truck
  • Add Docker: there's some code, but it's not totally functional
  • Plot maps for the inputs and the final solution

More options