Simple script to match riders with drivers.

Overview

theBestPooler

Simple script to match riders with drivers.

It's a greedy, unoptimised search, so no guarantees that it works. It just seems to work (very quickly) for the few cases Ive tried.

Requirements:

python3 [tested on v3.9.7] pandas [tested on v1.2.5]

Running

Put the following files into a single folder:

  • main.py
  • theBestPooler.py
  • riders.csv
  • drivers.csv

Run

python3 main.py riders.csv drivers.csv

The allocations will be printed to the console. See example_output.txt for an example of the expected output. Any riders that couldnt be allocated will also be listed.

For quick help:

python3 main.py -h

Optional arguments:

  • desired verbosity: -v . 0 for no printing, 1 for printing the summary and the allocations. 2 and higher for debug printing.
  • by default, I assume the csv files contain headers. If they do not contain headers, pass -n as an additional argument. Example:
python3 main.py riders.csv drivers.csv -v 2 -n

will assume the csv files have no headers, and the verbosity=level 2.

CSV File Format Details:

Each file contains (exactly) 3 columns: , ,

is just any string. preferably unique, but not necessary. Each row is treated as a different person.

For riders, is the number of required seats. Usually this will be 1. For drivers, is the number of available seats EXCLUDING the driver, i.e. if the number is 2, this driver can pickup 2 passengers

The specifies where the driver/riders start/want to be picked up. These are assumed to be categorical, so make sure that there are no spelling errors. Insensitive to capitilization: 'north' and 'North' are treated as the same location.

Algorithm Description

Here is the basic psuedo-code:

Sort the riders: those requesting largest number of seats go in front
For each rider:
    Sort the drivers: those with fewest pickups so far go in front
    For each driver in same location:
      if assign(rider, driver) is possible
        assign(rider, driver)
        goto next rider
    For each driver not in same location:
      if assign(rider, driver) is possible
        assign(rider, driver)
        goto next rider
    print(error: cant assign rider to any driver)
print allocations

The sorts allow us to encode priority. Here I valued being in the same location most. Next most important is minimising the number of pickups by a driver.

You might also like...
Simple Python script I use to manage and build my Reflux themes.
Simple Python script I use to manage and build my Reflux themes.

Simple Python script I use to manage and build my Reflux themes. Built for personal use, but anyone can easily fork and tweak to suit thier needs.

This is a simple python script for checking A/L Examination results of srilankan students

AL-Result-Checker This is a simple python script for checking A/L Examination results of srilankan students INSTALLATION [Termux] [Linux] : apt-get up

Simple rofi script to choose player for playerctl to execute its command

rofi-playerctl-switcher simple rofi script to choose player for playerctl to execute its command Usage copy playerSwitch.py and playerctl.sh to ~/.con

A simple python script that print the Mandelbrot set for every power of the formal formula.

Python Mandelbrot A simple python script that print the Mandelbrot set for every power of the formal formula.

Simple script with AminoLab to send ghost messages

Simple script with AminoLab to send ghost messages

A simple script written using symbolic python that takes as input a desired metric and automatically calculates and outputs the Christoffel Pseudo-Tensor, Riemann Curvature Tensor, Ricci Tensor, Scalar Curvature and the Kretschmann Scalar

A simple script written using symbolic python that takes as input a desired metric and automatically calculates and outputs the Christoffel Pseudo-Tensor, Riemann Curvature Tensor, Ricci Tensor, Scalar Curvature and the Kretschmann Scalar

This simple script generates a backup of a given Python and R environment

Python Environment Backup It’s always good to maintain your Python and R Anaconda environment packages properly listed and well-kept in case you have

A simple script for generating screenshots with Vapoursynth

Vapoursynth-Screenshots A simple script for generating screenshots with Vapoursynth. About I'm lazy, and hate changing variables for each batch of scr

Turn your IPad into a Screen-Slaver with 1 simple Pythonista script
Turn your IPad into a Screen-Slaver with 1 simple Pythonista script

ScreenSlaver Turn your IPad into a Screen-Slaver with 1 simple Pythonista script

Owner
Devansh
Devansh
YourCity is a platform to match people to their prefect city.

YourCity YourCity is a city matching App that matches users to their ideal city. It is a fullstack React App made with a Redux state manager and a bac

Nico G Pierson 6 Sep 25, 2021
Coffeematcher is a python library to randomly match participants for coffee meetings.

coffeematcher coffeematcher is a python library to randomly match participants for coffee meetings. Installation Clone the repository: git clone https

Thomas Wesselink 3 May 6, 2022
Larvamatch - Find your larva or punk match.

LarvaMatch Find your larva or punk match. UI TBD API (not started) The API will allow you to specify a punk by token id to find a larva match, and vic

null 1 Jan 2, 2022
Islam - This is a simple python script.In this script I have written all the suras of Al Quran. As a result, by using this script, you can know the number of any sura at the moment.

Introduction: If you want to know sura number of al quran by just typing the name of sura than you can use this script. Usage in termux: $ pkg install

Fazle Rabbi 1 Jan 2, 2022
Python script to commit to your github for a perfect commit streak. This is purely for education purposes, please don't use this script to do bad stuff.

Daily-Git-Commit Commit to repo every day for the perfect commit streak Requirments pip install -r requirements.txt Setup Download this repository. Cr

JareBear 34 Dec 14, 2022
A script where you execute a script that generates a base project for your gdextension

GDExtension Project Creator this is a script (currently only for linux) where you execute a script that generates a base project for your gdextension,

Unknown 11 Nov 17, 2022
Simple python script for AD enumeration

AutoAD - Simple python script for AD enumeration This tool was created on my spare time to help fellow penetration testers in automating the basic enu

Mohammad Arman 28 Jun 21, 2022
A simple script that can watch a list of directories for change and does some action

plot_watcher A simple script that can watch a list of directories and does some action when a specific kind of change happens In its current implement

Charaf Errachidi 12 Sep 10, 2021
A simple script that shows important photography times. written in python.

A simple script that shows important photography times. written in python.

John Evans 13 Oct 16, 2022
A simple python script to convert Rubber Ducky payloads into AutoHotKey scripts

AHKDuckyReplacer A simple python script to convert Rubber Ducky payloads into AutoHotKey scripts. I have also added a sample payload for testing. I wi

Krizsan0596 5 Sep 28, 2022