My Honours Project is aimed at investigating the performance of different methods of solving the Capacitated Vehicle Routing Problem with Time Windows (CVRPTW). The problem entails finding the most efficient combination of routes that multiple vehicles can take to deliver to every customer present in a set of customers. The edition of the VRP I'm investigating (the CVRPTW) is different because it constrains the capacity of each vehicle (and, therefore, the amount of packages each vehicle can carry) and the time windows in which each customer should receive their delivery. Such constraints and complexities make the CVRPTW NP-Hard.
The project investigates Genetic Algorithms (GAs), heuristics, and GA-heuristic hybrids that solve the problem by aiming to find the combinations of routes that require the lowest cost to carry out. In other words, the cost is my objective function. Factors that to contribute to the cost of a solution are the amount of vehicles required and the total distance of each route. Any capacity and time window violations will render a solution infeasible and therefore, the solution will be rejected.
As part of the project, a custom GA was developed: the Feasibility Intensive Genetic Algorithm (FIGA). Here are solutions to two of the problem instances used during experimentation of the algorithm.
100-customer C101 | 100-customer C201 |
---|---|
The contents of the algorithm FIGA contained within this repository are protected by Copyright © 2022 taylorc1009. Currently, the author deems redistribution of the algorithm's ideas and code as prohibited, with the anticipation of this being rescinded in the future.
Additional work, such as other algorithms and their source code, problem instances, libraries, and images/figures produced by another, are not protected by the copyright owner of this repository; their ownership is hereby disclaimed by this author and remains with their original authors.
- Install Python version 3.9,
- Open the Windows command line and
cd
to the project root, - Create a virtual environment in the root folder of application;
- Using
python3.9 -m venv venv
,
- Using
- Activate the virtual environment;
- Using
venv\Scripts\activate
,
- Using
- Install the necessary packages;
- Using
pip install -r requirements.txt
,
- Using
- Execute the application;
- Using
main.py
as the entry point, main.py [ -h | --help ]
can provide further instructions,- The file
compile.bat
can compile the app into a single executable;- Note that the compiled executable can be found here:
../dist/main.exe
, - The executable should be moved from
/dist
to the project root so that it can find the problems' directory/solomon_100
.
- Note that the compiled executable can be found here:
- Using
- Use the function
MMOEASA_write_solution_for_validation
fromdata.py
in the Python application to output a solution to a CSV;- There's also the invocation of this function in the main
mmoeasa
algorithm function in../MMOEASA/mmoeasa.py
that needs to be uncommented, - Note that as long as a non-dominated solution exists, the solution will be constantly written to a CSV during every generation of the algorithm, so exit the application after a non-dominated solution is found,
- This is so that we don't have to wait on the algorithm terminating before a solution can be written,
- There's also the invocation of this function in the main
- Compile the C application in
../MMOEASA/validator/
;- Using either the Makefile or CMake,
- Execute the application
objective_function.exe
;- If you wish to use a different CSV file, give the application the file name as a command line argument,
objective_function [filename].csv
,
- If the Python implementation is working correctly, then the objective function before and after the external validation should be equal, proving that the given solution is valid.
- After the non-dominated set has been returned from an algorithm, the function
write_solution_for_graph
fromdata.py
can be invoked,- The invocation occurs in
main.py
, which needs to be uncommented to work,
- The invocation occurs in
- Once the file has been written, Excel can be used to create a graph from the data outputted; the format of the file is as follows:
- Column 1 lists the x coordinates of the first vehicle's destinations, and column 2 lists the first vehicle's destinations' y coordinates,
- Column 3 lists the second vehicle's destinations' x coordinates and column 4 list the second vehicle's destinations' y coordinates,
- And so on...
- As Scatter Graph uses two-dimensional coordinates to plot points on a graph, and Excel allows a list of x coordinates as well as y coordinates to be selected for one series of data, which we can substitute the destinations' x and y coordinates for to show a vehicle's route as a series of data.