Alex Thornton
Alex Thornton

Reputation: 31

Apache Commons math optimization "Hello World" example

I am attempting to implement the apache commons math optimization package. I am searching for a "hello world" example to solve a constrained non-linear system of two equations. My system is differentialable and consists of two independent variables. The apache commons documentation and a thorough google search have yielded no code examples for me to build off of -- any suggestions out there?

Upvotes: 3

Views: 2017

Answers (1)

Anders Gustafsson
Anders Gustafsson

Reputation: 15981

If you want to optimize a nonlinear function and your problem consists of nonlinear constraints, the algorithms in Apache Commons Math is not sufficient. Currently, only nonlinear objective functions with variable bounds is supported.

To solve general NLP problems where the derivatives are known, you might instead consider using Ipopt via its Java interface.

If the derivatives are not known, and the number of variables is relatively small (less than 100), you could consider to use the Java port of the COBYLA2 optimizer, which is available here.

Upvotes: 3

Related Questions