Effcient Ridesharing Dispatch Using Reinforcement Learning [Report]
Code for EECS 545: Machine Learning Project
Team Members:
Brian Fogelson*, Hansal Shah*, Oscar De Lima*, Tim Chu*
* Indicates equal contribution
- Python 3.7.x
- PyTorch 1.4.0
Variable number of cars and passengers between episodes
- Open agent_variable.py
- Set the variables max_cars and max_passengers to your desired maximum number of cars and passengers per episode.
- Set the init_cars and init_passengers variables to the number of cars and passengers you want to have in the first episode.
- Modify the GridMap object assigned to the grid_map variable by selecting the size of the grid (# of rows, # of columns) and the random seed.
- Modify the hidden size variable corresponding to the hidden size of the agent network.
- To use a specific model checkpoint, set the load_file variable to the name of the .pth file. Otherwise, set load_file to None.
- Set the arguments of the Agent object assigned to the agent variable to choose the learning rate (lr), the size of the hidden layer of the mixing network (mix_hidden), the batch size (batch_size), the epsilon decay (eps_decay), the number of episodes (num_episodes), the mode (mode = "random" or "greedy" or "dqn" or "qmix"), and whether we are training or not (Training = True or False).
- Run agent_variable.py
python agent_variable.py
To have a fixed number of cars and passengers between episodes
- Open agent.py
- Set the variables num_cars and num_passengers to your desired number of cars and passengers for each episode.
- Follow instructions 4, 5, 6 and 7 for the scenario with variable cars and passengers shown above.
python agent.py