oj! Algorithms – ojAlgo – is Open Source Java code to do mathematics, linear algebra and optimisation.
High Performance on a Rich Feature Set with Zero Dependencies
About a month ago Yahoo deliberately broke downloading historical data from their web site. This was not a problem with ojAlgo – it broke for everyone. ojAlgo has now adapted to Yahoo's new method. The new code in the master branch of the repository at GitHub, and will of course be part the next release.
The changelog, covering the latest 10 releases, will give more details on what's new.
As of v38 ojAlgo requires Java 8.
Java 7 users should instead use ojAlgo v37.1.1
With the v42 release the CVS repository at SourceForge will be abandoned. From now on the source code will be maintained at GitHub only.
The author of EJML benchmark his library against several other libraries – ojAlgo is one of them. To do that he created the Java Matrix Benchmark. Executing that benchmark takes about 2 weeks. It doesn't get executed very often! It is almost 2 years since the Java Matrix Benchmark site last published any results. Now, finally the wait is over...
ojAlgo is now available at The Central Repository to be used with your favourite dependency management tool. v38.0, that was released today, is the first official Maven release. The versions currently existing as downloads from SourceForge will also be made available. (Previously v31.0 existed by a third party independent effort.) The intention is that all future releases will be available at The Central Repository.
The feature set is extensive...
Much of the development has been motivated by various financial applications. ojAlgo contains code that allow you to:
Everything necessary to do that is in ojAlgo itself – it has zero dependencies.
The portfolio optimisation functionality is backed by a set of mathematical programming tools:
When using the mathematical programming models and solvers there is nothing "financial" about them – they're simply optimisation tools equally useful to any domain. To build the various solvers wouldn't be possible without a full featured linear algebra package. ojAlgo is a full featured high performance linear package. It supports three element types:
and includes all the most common matrix decompositions:
ojAlgo is an Open Source project. It is available as source code, and every single source code file contain a copyright statement and a license agreement. All files have the same copyright and license. Optimatika holds the copyright, and the license used is the generous and easy to understand MIT license. Please read and comply with the license agreement – it's not hard.
Typically the top of every java source code file looks like this:
* Copyright © 2015 Optimatika (www.optimatika.se)
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
Well... There is this web site, the JavaDoc. and a growing number of wiki pages. More will follow, but the JavaDoc (and source code) will always be the main source of documentation. Improving the documentation will mainly be improving the JavaDoc.
For bug reports, questions or discussions related to ojAlgo; please use the ojAlgo-user mailing list.
"In a mathematical programming (or optimisation) problem, one seeks to minimize or maximize a real function of real or integer variables, subject to constraints on the variables. The term mathematical programming refers to the study of these problems: their mathematical properties, the development and implementation of algorithms to solve these problems, and the application of these algorithms to real world problems. Note in particular the word "programming" does not specifically refer to computer programming. In fact, the term "mathematical programming" was coined before the word "programming" became closely associated with computer software. This confusion is sometimes avoided by using the term optimisation as an approximate synonym for mathematical programming."
ojAlgo contains LP (Linear Programming), QP (Quadratic Programming) and MIP (Mixed Integer Programming) solvers:
There's also a simple framework to model problems using standardised expressions as well as the ability to read MPS (Mathematical Programming System) files.
The ojAlgo LP/QP/MIP solvers are designed for when you need a pure Java solver for a smaller/simpler problem. Today the best commercial solvers (typically not written i Java) are very capable. ojAlgo can not compete with them. On the other hand, in many cases, a commercial solver is total overkill. There's a huge set of use cases where something like ojAlgo is a better choice.
The ojAlgo solvers have been around for years - particularly the QP solver. It dates back to the very beginning of ojAlgo 10 years ago. ojAlgo is extensively tested. Among the current test cases the only thing that doesn't work is semi continuous variables in MPS files/models. (This feature simply isn't supported at the moment.)
The Mixed Integer Problem Library (MIPLIB) maintains a collection of reference MIP problems. Among these a problem is considered "easy" if a commercial solver can solve it in less than 1 hour, and some problems are not yet solved by any solver. ojAlgo can solve several cases from that collection, but it typically takes longer than 1 hour. If you need to solve problems of this caliber you probably should get one the commercial solvers, but in many other cases ojAlgo will do just fine.
"Modern portfolio theory (MPT)—or portfolio theory—was introduced by Harry Markowitz with his paper "Portfolio Selection," which appeared in the 1952 Journal of Finance. Thirty-eight years later, he shared a Nobel Prize with Merton Miller and William Sharpe for what has become a broad theory for portfolio selection.
Prior to Markowitz's work, investors focused on assessing the risks and rewards of individual securities in constructing their portfolios. Standard investment advice was to identify those securities that offered the best opportunities for gain with the least risk and then construct a portfolio from these. Following this advice, an investor might conclude that railroad stocks all offered good risk-reward characteristics and compile a portfolio entirely from these. Intuitively, this would be foolish. Markowitz formalized this intuition. Detailing a mathematics of diversification, he proposed that investors focus on selecting portfolios based on their overall risk-reward characteristics instead of merely compiling portfolios from securities that each individually have attractive risk-reward characteristics. In a nutshell, inventors should select portfolios not individual securities."
ojAlgo contains a collection of portfolio selection models, notably:
The classes in the FinancePortfolio hierarchy/package are designed to complement each other to, as a whole, offer extensive and flexible portfolio selection features.
In addition ojAlgo supports other things useful with "finance":
There are currently 8 modules in CVS, but perhaps only 1 is relevant to you:
ojAlgo currently targets Java 7. Up until v33 Java 5 was enough.
The SourceForge CVS module DevProj is mirrored at GitHub. The two source code repositories are used in parallel. It may not always be like this, but for now they're equally good. Use whichever you prefer.
Each of the CVS modules mentioned above are complete eclipse projects. Once you've set up your CVS repository location, in eclipse, all you need to do is "Check Out As..." on one of the modules (most likely DevProj). You do not need to do anything else! Required libraries (if any) are in the module/project. Some projects/modules may require you to also get one or some of the other projects/modules.
To build ojAlgo from source using the supplied ant script you need to check out all 8 cvs modules. Further the script assumes that DevProj, BizProj and TestProj are renamed ojAlgo, ModBusiness and ojAlgoTests respectively. (Actually you can name any of the 8 modules/projects anything you want. You just modify build.properties to match.)
There is this web site, the JavaDoc. and a couple of wiki pages. More will follow, but the JavaDoc (and source code) will always be the main source of documentation. Improving the documentation will mainly be improving the JavaDoc.
For bug reports, questions or discussions related to ojAlgo; please use the ojAlgo-user mailing list. And remember... others have done this before you. The list archives may answer some of your questions.
For bug reports, questions or discussions related to ojAlgo; please use the ojAlgo-user mailing list.
Please use the mailing list. Do not contact Optimatika directly with bug reports, support requests, and/or academic discussions.
Regarding the list:
Please also note that the source code repository is browsable online.
Optimatika is a software consulting company specialising in advanced decision support systems. The ojAlgo code base only represents a small part of what we know. We build complete systems, and work extensively with databases and application servers as well as commercially available mathematics, optimisation and decision support tools.
In these cases please contact Optimatika directly.
No one knows the ojAlgo code base better than Optimatika!
BLaadin is a financial market simulation tool. It facilitates market analysis and forecasting as well as making portfolio recommendations. In particular it asserts consistency between forecasts and recommendations. At its core it makes use of the Black-Litterman model.
Information about BLaadin is currently maintained at the BLaadin Edge Financial Systems site.
There is a "public beta" version of BLaadin available on-line as a cloud service. The BLaadin Edge Financial Systems site contains information about how to find and use it.
BLaadin has its origin in a cooperation between Optimatika and the Royal Institute of Technology in Stockholm (KTH). That cooperation aimed to develop a prototype system/application using the Black-Litterman model, and to use that application in a behavioural finance case study. The case study resulted in a PhD thesis.
That was years ago... The prototype died and was revitalised several times until it was finally completely rewritten with a much more ambitious goal. BLaadin is now a full-fledged market simulation and portfolio construction tool.
BLaadin is programmed in Java, and everything related to mathematics and financials is in ojAlgo. BLaadin is NOT open source! ojAlgo is, but not BLaadin. The on-line "public beta" is free for you to try.
Project and site sponsored by Optimatika
Copyright © 2000 - 2015