9
$\begingroup$

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?

$\endgroup$
2
  • $\begingroup$ Get a lot of money, then hire a team from Gurobi or CPLEX to build a MIP solver under JAVA, and release it to the world as free software. Then you will have a top performing MIP solver which is free for everyone. $\endgroup$ Jun 20, 2019 at 9:04
  • $\begingroup$ @MarkL.Stone Your comment was probably just a joke, but to make this point clear: I do not expect a free solver to have the performance of CPLEX or Gurobi, not even to come close to one of those. I just want to solve MIPs in Java. If CPLEX is 100x faster, this is fine for me. $\endgroup$ Jun 20, 2019 at 14:02

4 Answers 4

9
$\begingroup$

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.

$\endgroup$
1
  • $\begingroup$ This link is dead. $\endgroup$
    – J. Schmidt
    Jun 28 at 9:30
5
$\begingroup$

OptaPlanner is an open source constraint solver in Java. It's:

  • Used across the globe in governments, Fortune 500 and other companies, startups, nonprofits, ...
  • 1000+ zip downloads per month and far more from Maven Central
  • 100% pure java - just a jar
  • compatible with Kotlin and Scala too
  • open source (Apache License), so you can modify/redistribute without fees

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

$\endgroup$
1
  • 1
    $\begingroup$ Certainly interesting. $\endgroup$ Jun 21, 2019 at 11:05
2
$\begingroup$

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.

$\endgroup$
3
  • $\begingroup$ Thank you for the interesting hint, but unfortunately, JOpt will not help me without a free solver. $\endgroup$ Jun 19, 2019 at 19:06
  • $\begingroup$ @J.FabianMeier I have added another one at the end. What do you think? $\endgroup$
    – TheSimpliFire
    Jun 19, 2019 at 19:11
  • $\begingroup$ Thank you, so you would recommend Java ILP with GLPK? Or is JOpt still on the table? Maybe you could edit out the "non-free" part of your answer, then I could follow it better. $\endgroup$ Jun 19, 2019 at 19:46
1
$\begingroup$

I once made CBC work from JAVA with Google's OR-Tools. From the "free" category, it should also allow to use GLPK.

$\endgroup$
1
  • 1
    $\begingroup$ Please consider Provide context for links for answers that are little more than just a link. This will make your answer much more valuable for future visitors, especially as links rot. $\endgroup$ Jun 21, 2019 at 16:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.