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 605 forks source link

Worse results after Hashset modification #511

Open ismaelrh opened 4 years ago

ismaelrh commented 4 years ago

Commit https://github.com/graphhopper/jsprit/commit/1ebf2360096f911329f3ebc39fbd395b0fa9e162 slightly changes RuinAndRecreateModule.java, by modifying the creation and populationof the HashSet from

Set<Job> ruinedJobSet = new HashSet<>(ruinedJobs);
ruinedJobSet.addAll(ruinedJobs);

to

 Set<Job> ruinedJobSet = new HashSet<>(ruinedJobs);

Even though this should not produce any difference, as they are equivalents, I am obtaining slightly poorer results with the second approach on the optimizations I perform, in different projects with different constraints, with a number of services about 100, and 20-100 vehicles. I run it multiple times and the final cost is always equals or higher with the changes introduced in this commit.

Using JDK 1.8.0_192. Will prepare an example if I have time.

bednic commented 2 years ago

Can you tell in percentage how much it differ, if it is worth solving.