Similar to a previous post (link), I have extended services to have more than one possible location and further calculate additional costs per service location. The code seems to run fine for examples where one location is clearly better than the other and during the insertion, the best locations are selected. However, when I run examples where there is almost a break-even between the costs of two locations I notice some discrepancy between the route arrival times and locations of the best solution.
Let’s assume we have a tour consisting of 3 services (A, B, C), where service B can have either location B1 or B2. In the best solution returned the costs (e.g. 1000€), as well as the arrival and departure times of A, B, C, are from solution A, B1, C (verified manually). However, when checking the route and the activities of the best solution with the SolutionAnalyser, it shows that location B2 is selected instead of B1. Once I run the function reCalculateStates or SolutionAnalyser on that best solution the arrival and departure times will be changed according to that location. When I manually calculate the costs, this, in turn, leads to slightly higher costs (e.g. 1001€), which are not updated at reCalculateStates. However, I noticed that my custom SolutionCostCalculator shows the correct costs, locations and arrival times during algorithm execution each time.
Now I wonder how the arrival times and cost can be from the best solution but the locations are from another solution in the cases when two solutions are very similar in cost and structure. When I increase or decrease the additional cost of location B2 it will either lead to solution A, B1, C or A, B2, C and have the locations, costs and arrival times set correctly to the solution.
My impression is that jsprit somehow does not update the route of the best solution when another solution only differs by one location. Unfortunately, I could not completely comprehend where this could occur in the code and how to change it. Does anyone have an idea what might cause this error or where to look at?