I am looking for an open source implementation of a method doing constrained optimization for nonlinear multivariable function in Java.
Asked
Active
Viewed 7,690 times
9
-
Have you looked at Apache Commons Math? I seem to remember some non-linear optimization utilities... – Nathan Ryan May 16 '12 at 14:15
-
1could you give an example of the kind of problem you are trying to solve? – Victor P. May 17 '12 at 07:21
-
Does the problem you want to solve have discrete variables or continuous variables? – willem May 20 '12 at 21:22
4 Answers
5
IPOPT is the most robust solver I know of.
It has a Java interface although I have no idea how good that is, I only use the C++ API.

Ali
- 56,466
- 29
- 168
- 265
-
My experience with IPOPT is that it is the most performant open-source solver I have used for large, sparse convex problems. Unfortunately, the library is not thread-safe and is prone to segfault or worse, corrupt your memory and cause the JVM to segfault later if you do anything slightly wrong, which is all but impossible to debug from Java. In the end I decided it was better to isolate any code using IPOPT to a separate process, written in C++. – Owen Jun 14 '16 at 16:57
-
@Owen Interesting. I have used the Java API very extensively since, and it worked reliably; no segfaults, no memory corruption, no memory leaks. However, I agree: If it is possible for you, just put it into a separate process, and avoid the interfacing difficulties altogether. – Ali Jun 14 '16 at 18:07
-
You may be right. I ended up tracing my memory corruption to the fact that the finalizer for `Ipopt` was being called on a different thread (as finalizer's usually are). So I suppose it may all come back to the fact that Ipopt isn't thread-safe, [which is documented](https://projects.coin-or.org/Ipopt/ticket/167). – Owen Jun 15 '16 at 20:02
3
There are several open source java implementations that can do this, such as:
- OptaPlanner (apache license, 100% java, lots of examples and documentation)
- jacop
- choco
- ...

Geoffrey De Smet
- 26,223
- 11
- 73
- 120
2
I recently ported Michael Powells' COBYLA2 derivative-free optimizer for nonlinear objective functions and constraints to Java. You'll find the source code here.

Anders Gustafsson
- 15,837
- 8
- 56
- 114