I would like to solve mixed integer programs in Java. I need an approach that relies purely on software that is free (not only for academic use, but also for people outside academia).
What would be the best approach for that?
Operations Research Stack Exchange is a question and answer site for operations research and analytics professionals, educators, and students. It only takes a minute to sign up.
Sign up to join this communityI would like to solve mixed integer programs in Java. I need an approach that relies purely on software that is free (not only for academic use, but also for people outside academia).
What would be the best approach for that?
Of the open source LP and MILP solvers, I would recommend investigating the COIN-OR based solvers CLP and CBC.
These are C++ based libraries, though work has been done to make them more accessible from Java. See
https://spartanideas.msu.edu/2016/06/01/using-clp-with-java/
for example.
OptaPlanner is an open source constraint solver in Java. It's:
That being said, it has a OO/FP approach, which is a serious mind-switch if you're coming from a traditional MIP model approach. But it pays off if you need to scale to bigger datasets and want to integrate with other Java technologies.
Other open source alternatives in Java/JVM include Choco, Oscar (= scala), the COIN-OR solvers, eclipse, jacop, ... IIRC
The JOpt Mixed Integer Program Optimization Package Wrapper:
What is JOpt?
JOpt is an open source Java wrapper that provides objects like Variable, Constraint, and Term and lets you express your linear or mixed integer programs in a natural manner, while remaining agnostic to the details of the solver backend. JOpt is not a solver. Rather, it requires a solver such as CPlex or the free LPSolve to operate.
It is open-source and allows you to do the following.
Why JOpt?
You do linear/quadratic or mixed integer programming, but want to think in terms of simple variables and constraints, not a complex solver-specific api.
You want to automatically distribute and load balance your problems to one or more solver machines (when compiled for this support).
The latest version for CPLEX 12 was released in 2017 and can be accessed here.
For a software that also relies on a free solver, try Java ILP which can be used with GLPK.
I once made CBC work from JAVA with Google's OR-Tools. From the "free" category, it should also allow to use GLPK.