Implement Genetic Algorithm on Vehicle Routing Problem with Time Windows, Recharging Stations and other Constraints
- main.py: run this will start the genetic algorithm directly, before this you may take a look at the parameter statement; also, if you want to restart the algorithm please delete all
controller.pklandnature*.pklinsave_dir - test.py: read the best route from
save_dirand present it - data: store the data, include
input_distance-time.csv,input_node.xlsxandinput_vehicle_type.xlsx, the output will also be put here by default - tools: include several tools used in this programme
- data_taker.py: take data from data folder
- global_map.py: contain all information in the map that can be obtained through several interface
- macosFile: store big data by pickle
- PGA: include modules in genetic algorithm
- controller.py: global controller
- nature.py: nature, where chromosome in
- chromo.py: chromosome, where route(gene) in
- route.py: route(gene)
- constant.py: all constant used in genetic algorithm
Here only introduce the parameters in main.py, not parameters in PGA/constant.py.
load: whether load controller (and natures) fromsave_dirsave: whether save controller (and natures) tosave_dirgeneration_num: generation num, setting it large is ok, cause main.py will store the calculation process each 10 generation (insave_dirifsave == True)chromo_num: chromo number in each nature, if too small may lead to early convergence, if too large may need more time to calculate_punish: punish parameter, if too big may weaken the influence of mutation, if too small may raise too much punishmentnature_num: nature number, each nature will operate in one subprocess, don't set it larger than the number of CPU kernels (or it may become really slow)punish_increase: punish parameter times this number every 10 generation, if too big may weaken the influence of mutationsave_dir: relative direction to save and load controller (and natures), default isdata/(if you change this, please also changesave_dirin test.py)read_dir: relative direction to read the input data, default isdata/