Skip to content


Switch branches/tags

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time
Oct 17, 2016
Feb 28, 2016
Oct 17, 2016

Linear Programming in Java

Java interface for the CLP linear solver, optimized towards fast model building and fast resolves.


The interface provides a number of useful features for Java programmers who want to build either large models or apply decomposition strategies that require a lot of resolves. The interface has undergone several rounds of testing and profiling outside of unit tests.

Compact model creation using builders

Variables, constraints, and linear expressions are available as Java objects to make model building as easy as possible.

Decision variables as well as their bounds and objective coefficients can be created in a single line. For example, x \in [-3,3] and y \in \mathbb{R}, would become

CLPVariable x = model.addVariable().lb(-3).ub(3);
CLPVariable y = model.addVariable().free();

Since there is no operator overloading in Java, algebraic formulations are not possible. To avoid excessive use of setters, constraints can be built by using a series of add statements. For example, 3x + 4y \leq 10 can be expressed as


The add statements also accepts vectors of variables and coefficients. See the javadoc for further reference.

Fast model building

Chunks of a model are buffered in heap for model building before being sent to the native lib. The size of the buffer can be set by the user. Models can be formulated in a row-by-row fashion, without bothering about possible performance bottlenecks. Models with millions of constraints can be generated quickly.

Direct memory access

Once a model is build it only lives in native memory, with the exception of referenced objects of variables and constraints which remain in heap. To update model coefficients, the model is accessed directly in native memory via direct byte buffers that are provided by the native interface. When the model gets gc'ed, native memory will be released automatically.



The project is available at the central repository. Simply add the following dependency to your pom file


All-in-one jar file

Download the latest build of the jar from the release page.

The jar file contains the native libs for the most important host systems (Mac, Win 64, Linux 64), so there won't be UnsatisfiedLinkErrormessages and there is no messing around with setting build paths. A copy of the native libs will be created in a temporary directory at runtime. Simply import the jar and you're done.


  • Java JDK 7
  • 64-bit Linux, Mac OS, or Windows


See the javadoc for a full class reference.


Nils Löhndorf