Multiobjective optimisation implementation of capacitated vehicle routing problem with NSGA-II algorithm using deap package.
DEAP model was used for the CVRP MOO using python because DEAP provide very effective and fast optimisation using genetic algorithm. Previous to applying DEAP model, I have used PULP algorithm for the same CVRP but it is only effective only for clients less than 15.
Delivery companies every day need to deliver packages to many different clients. The deliveries are accomplished using an available fleet of vehicles from a central warehouse. The goal of this exercise is to design a route for each vehicle so that all customers are served, and the number of vehicles (objective 1) along with the total traveled distance (objective 2) by all the vehicles are minimized. In addition, the capacity of each vehicle should not be exceeded (constraint 1)
- Python (Packages used DEAP, PANDAS, NUMPY, MATPLOTLIB)
- Pip
- Virtual Environment
- Due date, service time, ready time are ignored from the dataset as stated in the problem statement
- There is no cost of extra vehicle. Hence taken = 0.
- There is no time delay and no time windows for our vehicle at the objective locations
- Distance between client to client is calculated by Euclidean, as per the task.
- Vehicle always starts from the depot customer_0 and delivers goods and then comes back to depot again after delivery
The initial data file which taken out to be in text format is converted in json format for usage in the code.
python text_to_json.pyRun the algorithm activating the virtual environment and run this command
python run_algo_results.pyAs stated in the problem statement, inbuilt python module unittest has been used to run all the tests of functions used for implementation of the algorithm. Run the following command to check the tests
python -m unittest discover testWe have plotted the results for the most effective routes and subroutes retireved with the implementation of the above algorithm NSGA 2 using DEAP package. Also results for each genrations have been plotted to see the progress made while increasing the generations in the code. The follwong results are shown for
- Using different methods for mutations, crossover and selection can result in better performance.
- Using two MOO together in layers can also be effective in large dataset and optimisation e.g. DEAP and PYMOO.
MIT License

