If you're programming OR challenges in Java, besides using constraint solvers, which other libraries do you typically use? Maybe for common tasks such as data reading, etc. Why? How do they make your life easier?


1 Answer 1


A few key ones that I use are:

  • algs4 -- a variety of programs/utilities from an online course at Princeton (Go Tiger!), including some graph/network libraries
  • Various Apache Commons libraries -- for reading/writing CSV files, doing operations on collections that Java currently does not directly support, and so on
  • Renjin -- let's me execute R code inside a Java program (not something I do often, but it has come up once or twice)
  • SQLite JDBC -- for pulling data from/pushing data to SQL databases (handy when you're running a bunch of experiments with different combinations of problem/algorithm/parameters and you want to store results in a coherent manner)
  • Watchmaker Framework -- Java framework for genetic algorithms (not under active development, and there are several other Java packages for GAs, some newer, but I like Watchmaker)
  • XStream -- converts Java objects to XML and back

I've also had reason to use a Java matrix library, but I've yet to find one that I like and, importantly, trust, so I'm not naming any here. (I've tried a few that exhibited a "good enough for government work" attitude about computing matrix ranks and doing rank-revealing QR decompositions.)

  • $\begingroup$ Thanks for sharing! I am using apache commons often too, but I find writing/reading CSV files very work-intensive none the less. Same for XSLX with POI. This is something I envy the Python programmers on (although I'd love to have my cake and eat it too: python easiness and still Java statically typed data). $\endgroup$ Jan 7, 2021 at 9:38
  • $\begingroup$ You could use R to read/write CSV and XLSX files (via Renjin), but I suspect that the extra "plumbing" you'd be adding to do this would be about as inconvenient as what you're currently doing. $\endgroup$
    – prubin
    Jan 8, 2021 at 18:04

This site is temporarily in read-only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .