Scala drivers to Second Order Cone Programming (ECOS) Solver.
This library is licensed under Apache. See LICENSE for more details. ecos-java-scala project uses ecos as a submodule which is licensed under GNU GPL V3. See https://github.com/embotech/ecos/blob/master/COPYING for more details on ECOS licensing. amd and ldl JNI libraries are licensed under LGPL honoring original Tim Davis's license.
- io.citrine.ecos.NativeECOS - interface to native ecos library with
solveSocp()
- io.citrine.ecos.QpSolver - solves quadratic programming problem
- io.citrine.ecos.RunECOS - example usage of NativeECOS
- sbt
- cmake
- [optional] Java SDK 11 (for javah)
After cloning this repository, remember to clone submodules:
git submodule update --init --recursive
To generate src/native/include/io_citrine_ecos_NativeECOS.h
use javah
task from sbt-jni
:
sbt javah
The file is committed into the repository, so you need to invoke above only after some changes in the code.
To publish the Scala 2.13 version to local repository invoke:
./local_dev/publish_local_with_lowered_log_levels.sh
The above will set the ecos log level configurtions to sane levels, compile native ecos library and put that into jar. Platform is added as classifier to the published jar. For Mac OS below files will be generated:
${HOME}/.ivy2/local/io.citrine/ecos_2.13/X.X.X/jars/ecos_2.13-Mac_OS_X.jar
For certain combinations of Java, CMake, and XCode the FindJNI
module does not work properly, leading to the following error during compilation:
Could NOT find JNI (missing: JAVA_INCLUDE_PATH JAVA_INCLUDE_PATH2 JAVA_AWT_INCLUDE_PATH)
The solution is to add the following lines to src/native/CMakeLists.txt
, setting some paths explicitly.
Source.
set(JAVA_HOME "$ENV{JAVA_HOME}")
set(JAVA_INCLUDE_PATH "${JAVA_HOME}/include")
set(JAVA_INCLUDE_PATH2 "${JAVA_HOME}/include/darwin")
set(JAVA_AWT_INCLUDE_PATH "${JAVA_HOME}/include")
- Unconstrained quadratic minimization
- Quadratic program with bound constraints
- Quadratic program with L1 constraints
- Quadratic program with equality constraints
Add library dependency including classifier, e.g.:
private val osNameClassifier = System.getProperty("os.name").replace(' ', '_').trim
private val osArchitecture = System.getProperty("os.arch").replace(' ', '_').trim
private val artifactClassifier = osNameClassifier + "_" + osArchitecture
[...]
libraryDependencies += "io.citrine" %% "ecos" % "X.X.X" classifier artifactClassifier
Native library will be loaded when instance of NativeECOS
is created.
io.citrine.ecos.RunECOS
contains runnable example.
The following people have been, and are, involved in the development of ecos-java-scala:
- Debasish Das
- Stephen Boyd
- Alexander Domahidi
The main technical idea behind ECOS is described in a short paper. More details are given in Alexander Domahidi's PhD Thesis in Chapter 9.