jsprit icon indicating copy to clipboard operation
jsprit copied to clipboard

Worse results after Hashset modification

Open ismaelrh opened this issue 5 years ago • 1 comments

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.

ismaelrh avatar Oct 29 '20 08:10 ismaelrh

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

bednic avatar Jan 10 '22 12:01 bednic