An algorithm that finds the optimal route for cargo package distribution using genetic algorithms.
Suppose a cargo delivery vehicle has n
packages to deliver and therefore n
stops to go. The most optimal route for this vehicle to deliver packages depends on the distances between stops and also on the current load weight in the vehicle as it travels between the stops. In other words, the shortest path may not always be the most optimal solution, the packages that have more weight in the vehicle and restrict the vehicle speed may need to be distributed with higher priority. This algorithm creates the best time-dependent route based on the distance between stops and the total weight of packages available between the stops.
This algorithm uses genetic algorithms. If you don't know about it, please check the README.md at my Genetic-Algorithms repository.
- Genes represents stops.
- Chromosome contains sequence of stops.
- Fitness Value is total time for distribution of all packages.
- Termination Cause is a limit number of generations which declared at the beginning.
- Number of packages fixed to 10 and maximum weight is 500 kilograms.
- Package weights and coordinates of stops created randomly at beginning.
- The locations of the package distribution center and the stations to be distributed will be determined by the coordinate system.
- Coordinates will be shown with a value between 0 and 1000.
- The location of the package distribution center is always the point
(0, 0)
. - Each 1 unit in the coordinate system corresponds to 100 meters. For example the distance between points
(0, 0)
and(0, 3)
is 300 meters. - Speed availability is as follows:
![Speed](https://private-user-images.githubusercontent.com/77257193/264035455-ae79bbdb-8635-46e7-8c8a-5a5e5d91d359.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTc3MTY4ODUsIm5iZiI6MTcxNzcxNjU4NSwicGF0aCI6Ii83NzI1NzE5My8yNjQwMzU0NTUtYWU3OWJiZGItODYzNS00NmU3LThjOGEtNWE1ZTVkOTFkMzU5LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MDYlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjA2VDIzMjk0NVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWRlYTBkNWZiMDcxNzE5NzE5YjdiMWQwYjg4YjgxNDJjZGU0NWYyMzVmNmZkMzhlMDhhYTNiMzczZDk5N2Y3MmImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0._h5xYXYqOzwAV11ojXT3K0TLosw-BPBnBj9j5Xd_Txs)
If you want to set up coordinates and weights manually, you can uncomment the code block at the beginning to use. If you use it, remember to comment the code block that declares randomize packages.