Learn from c4v4/LKH3 #2
tuananhdao
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
It looks like they managed to gain a 20 to 30 speedup compared to the original LKH3 in this repo:
https://github.com/c4v4/LKH3
Maybe some ideas to look into:
Modified penalty functions
MOTIVATION
O(N)toO(1)for almost all iterations (except a few special ones).N=number of cities/customers=~O(1000), this will result in a few hundred speedup, as also shown in c4v4 benchmark results.GOAL
Penalty functions
Penalty_CVRP.candPenalty_MSTP.cin the PR for helpful info.Solution presentation
For example,
SALESMEN=2and the number of nodesDIMENSION=6. A solution/tour can be:LKHpy
[0 1 2 3 0 0 5 4 0]LKH
[1 2 3 4 7 6 5 8]There are 2 routes/petals in this solution/tour because
SALESMEN=2. The first salesman traverses first, second, and third nodes. The second salesman visits the rest.In LKH (the original C library), indices start from
1. Moreover,7and8are depots (without duplicates such as in LKHpy), which are the same as1.New variables
cava_PetalsData: an array of sizeSALESMEN+1, containing route data of a petal (a route). The first elementcava_PetalsData[0]is a dummy petal, to which all the depot nodes point.cava_PetalsData[1], ..., cava_PetalsData[SALESMEN]corresponds to the routes of the first, second, ... salesmen.In the above example, the LKH nodes
1, 2, 3, 4, 5, 6, 7, 8point tocava_PetalsData 0, 1, 1, 1, 2, 2, 0, 0struct RouteData:flagis for counting the involved petals/routes in a penalty calculation,OldPenalty...Beta Was this translation helpful? Give feedback.
All reactions