tag:blogger.com,1999:blog-8781383461061929571.post6567878725090705093..comments2024-03-14T09:08:19.035-04:00Comments on OR in an OB World: Reproducibility and Java CollectionsPaul A. Rubinhttp://www.blogger.com/profile/05801891157261357482noreply@blogger.comBlogger8125tag:blogger.com,1999:blog-8781383461061929571.post-49748755699001523072023-03-04T09:48:56.768-05:002023-03-04T09:48:56.768-05:00Thanks for the kind words.Thanks for the kind words.Paul A. Rubinhttps://www.blogger.com/profile/05801891157261357482noreply@blogger.comtag:blogger.com,1999:blog-8781383461061929571.post-16610691921545712182023-03-04T04:54:15.280-05:002023-03-04T04:54:15.280-05:00Greetings of the day, As a learner, I can readily ...Greetings of the day, As a learner, I can readily understand the idea: of "Reproducibility and Java Collections." It highlighted the importance of reproducible research in computational science and discussed the challenges of unintentional randomness in multithreaded code and Java collections. The post provides useful insights for researchers to avoid these tripwires and ensure the deterministic behavior of their programs, and it was clear and neat. I appreciate you for giving me the information!Vibinhttps://www.blogger.com/profile/08715691762579225907noreply@blogger.comtag:blogger.com,1999:blog-8781383461061929571.post-41298032472790099182014-06-09T19:41:24.077-04:002014-06-09T19:41:24.077-04:00Ryan: Thanks, that's useful to know. I did a g...Ryan: Thanks, that's useful to know. I did a global search-and-replace on two projects, replacing HashSet and HashMap with LinkedHashSet and LinkedHashMap. Everything that worked before still worked, and I did not notice any performance penalty -- but, unlike you, I wasn't working with any large data instances.Paul A. Rubinhttps://www.blogger.com/profile/05801891157261357482noreply@blogger.comtag:blogger.com,1999:blog-8781383461061929571.post-46815549427163252882014-06-09T14:46:11.675-04:002014-06-09T14:46:11.675-04:00I've used TreeSet a bit for this sort of thing...I've used TreeSet a bit for this sort of thing, substituting it for HashSet when faced with similar problems. While I haven't actually run any explicit benchmarks, the performance of applications dealing with sets of thousands to hundreds of thousands of records didn't seem to get worse. At least, it didn't depreciate to the point where I investigated why.Anonymoushttps://www.blogger.com/profile/01002920068652190833noreply@blogger.comtag:blogger.com,1999:blog-8781383461061929571.post-50846600123873368352014-06-07T13:25:56.357-04:002014-06-07T13:25:56.357-04:00Marc-Andre: I find it a little bit reassuring that...Marc-Andre: I find it a little bit reassuring that the same thing can happen with collections in Python. I was half expecting an "I told you so" from the Pythonistas (ii.e., this is what I get for resisting the Python wave and sticking with Java). :-)Paul A. Rubinhttps://www.blogger.com/profile/05801891157261357482noreply@blogger.comtag:blogger.com,1999:blog-8781383461061929571.post-9832649770759422462014-06-07T13:19:19.621-04:002014-06-07T13:19:19.621-04:00Thanks for sharing your experience on that. We ran...Thanks for sharing your experience on that. We ran into similar issues with a Python tool we developed for generating and customizing optimization models. It used collections which was convenient but didnt keep the order in which we added items. When iterating through the constraint collection to build the models, it entered the constraints in a different order each time. Thus, running the same model with CPLEX multiple times would result in different optimal basis, leading in turn to significantly different run times. Anonymoushttps://www.blogger.com/profile/10727224627014564951noreply@blogger.comtag:blogger.com,1999:blog-8781383461061929571.post-77333792265059243122014-06-07T10:47:39.834-04:002014-06-07T10:47:39.834-04:00Geoffrey De Smet posted a comment on G+ (https://p...Geoffrey De Smet posted a comment on G+ (https://plus.google.com/u/0/+PaulRubin/posts/DQpP89wkLNp) indicating that LinkedHashSet and LinkedHashMap produce reproducible results without large performance penalty.<br /><br />TreeMap and TreeSet are ordered in the sense of sort-order. I imagine there's a performance penalty for the sorting, but perhaps it's not too bad.Paul A. Rubinhttps://www.blogger.com/profile/05801891157261357482noreply@blogger.comtag:blogger.com,1999:blog-8781383461061929571.post-80210902497728552222014-06-07T10:26:15.889-04:002014-06-07T10:26:15.889-04:00Isn't there some kind of ordered map in Java? ...Isn't there some kind of ordered map in Java? A quick search suggests LinkedHashSet, but I haven't fully read through the documentation. Anonymousnoreply@blogger.com