bokae / taxi Goto Github PK
View Code? Open in Web Editor NEWSimulating taxi-request matchings on a grid.
Simulating taxi-request matchings on a grid.
Rather than (or in addition to) producing plots every 10k steps, make one plot per variable that summarizes change over the entire simulation (like it is done with avg waiting time now)
Pl, hogy mit gondolunk, az initial state okozza az egyenlotlensegeket, vagy egyszeruen az, hogy a rendszer nem egyenloen osztja szet a requesteket. Igazabol mivel a taxisoknak semmi beleszolasa, hogy hova mennek (es a szimulacionkban ugyanugy is viselkednek), ezert az indulasi pontjuk es az, hogy utana milyen algoritmus dont, teljesen meghatarozza, hogy mennyit keresnek.
Azert is kene szetvalasztani, hogy melyik hatas okozza a kulonbsegeket, mert mas ra a megoldas. Ha az initial state okozza, akkor azt kene randomizalni, de ha az assignment procedure, akkor ugye azon kene valtoztatni. Szoval ki kene talalni a gazdagok miert gazdagok az igazi rendszerben..
Erdekes lenne kitalalni azt is, hogy az initial statenek mennyi a mixing-timeja, vagy hogy mondjak ezt. Siman lehet, hogy hamar eltunik a hatasa, de az is lehet, hogy kb addig nem, amig nem megy offline es persze akkor is megint ugyanott fog masnap felbukkanni es valoszinuleg hasonlo parositasokat kap.
Nyilvan csomo dolog van egy igazi varosban, ami nagyjabol ismetlodik, pl az utas flow-k napkozben, meg a taxisok kezdo helye, de lehet, hogy egy kis randomizalas is eleg, ahhoz hogy nagyobb hatasu kiegyenlitodes legyen, nem?
Kezd az egesz markov lancokra emlekeztetni..
There are four classes in the py-file.
City()
- stores the geometry of the simulation,Taxi()
- a taxi object,Request()
- a request object,Simulation()
- the simulation components.The most important class variables for the matching algorithm are the following:
Simulation.taxis
: dict with int keys taxi_id
, contains all used Taxi()
instances.Simulation.requests
: dict with int keys request_id
, contains all used Request()
instances.You have to update these dictionaries when you make a match as in the example Simulation.assign_request
.
The most important methods for the matching algorithm are the following:
Simulation.find_nearest_available_taxis()
: see description in docstring. Returns a list of taxi_id
s according to the chosen method (all taxis within a given radius, nearest taxis only). If we want to search for taxis in a given ring, then we should subtract the results of the smaller radius from that of the bigger radius.Simulation.assign_request(self, request_id)
: this is the function that returns the assigned taxi_id
(that does the actual matching). I wrote a first example that chooses one taxi randomly from the closest ones, and rejects serving the request if it is further than a predefined threshold.It's a great project. I have some confusion when using the code, the code doesn't work properly.
Is there any relevant paper I can read?
Instead of assigning drivers to riders just on the distance, give preference to drivers with less total earnings to minize the standard deviation of money earned.
E.g. taxi/request ratio etc.
Chicago taxi trips
https://www.kaggle.com/chicago/chicago-taxi-trips-bq
It is still quite slow for bigger (e.g. more realistic) sizes. Ideas for speeding up.
Done:
pip install git+https://github.com/NicoDeGiacomo/randomdict
, this contains the fix. On the benchmark config, it only speeded up the simulation by 1s/batch...python -m cProfile run.py 0608_benchmark
, and it turned out that generating requests eats up almost half of the time! There should be a better way for it. The poorest
algorithm is not much slower than the random
one. sbatch -c 6 --mem=1000 run.sh
# -c is number of threads, has to divide 24 (e.g. 2,4,6 or 12, depending on memory consumption)
# --mem is memory allocation in MB, compulsory, otherwise, all memory is allocated to one job, and there will be no multiple threads
Possibilities:
Maybe Python itself is an obstacle - is there any way to compile the code? (How much would it take to rewrite it in C++? Is it worth the time?) A pyc file is compiled from the city_model.py module, the question is whether there is a compiler that can optimize more.
Could we run it on GPU?
Estimate runtime based on parameters and find an optimum schedule, submit jobs in that order. ** That is just having a look at the slurm files.
numba
Putting taxis into a pandas DataFrame, then moving them by .apply()
.
literature reading, group related work into categories
running simulations with bigger city (15 km x 15 km), multiple times for smoother curves
investigating the role of initial conditions (driver home locations) -> new figure
calculating new unfairness indices (20-20, Gini, Atkinson egyben)
recreating old figures with the new simulations
proofreading the draft
analyzing NYC data for realistic inputs?
requesting Uber data for London
configs
and results
folders to organize input and output files.Add passenger waiting time distribution as a measured variable.
There is a monetary loss in sitting idly (waiting time) and in going somewhere without a customer (empty time).
Make these costs configurable and incorporate into total money made.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.