graphhopper / jsprit

jsprit is a java based, open source toolkit for solving rich vehicle routing problems
https://www.graphhopper.com/open-source/
Apache License 2.0
1.64k stars 604 forks source link

when the distance from depot is not considered, the problem has some problems. #153

Closed xiaopanchen closed 9 years ago

xiaopanchen commented 9 years ago

when sloving the solomn problem and he distance from depot is not considered, we can get some routes. Each route has onle one job. The solutions can not be improved.

xiaopanchen commented 9 years ago

The solution consists of routes which has onle one job. These routes can not be merged in the process of improving.

oblonski commented 9 years ago

this is not a problem, but explainable behaviour. if you do not have any fixed employment costs for your vehicles, the overall costs of this solution should 0. since it costs nothing to ride from your depot to the first customer. thus the best solution is to start each route at the depot and serve only one and thus the first customer.

xiaopanchen commented 9 years ago

But, if the number of routes is as the primary objective and the distance is the second objective, how can I modify the procedure? I try to set the fixedCostPerVehicle be a big value, but found this had no effect on the result. Thank you very much.

oblonski commented 9 years ago

Ok. Then try this. Start with an initial number of vehicles and search until all jobs are assigned. Then reduce the no. of vehicles by e.g. 1 and search again (set fleetsize to finite). Do this as long as a solution can be found where all jobs are assigned. Take the last valid solution, leave fleetsize to finite and try to further reduce variable costs by running another optimization. BTW: when setting fixed cost, try to play with Jsprit.Builder.newInstance().setProperty(Parameter.FIXED_COST_PARAM,"1.")... this might have an effect, since it indicates which weight is assigned to the fixed costs (default = 0) within the insertion phase.

huangxx commented 9 years ago

will this happen when the number of vehicles is smaller than the number of stops? (btw, make sure the vehicles return to the depot only at the end)