I’m looking for a linear programming solver in Fortran (preferably modern Fortran). I googled and I found DLPRS from IMSL libraries but I don’t have access to IMSL. I also found some small programs written mostly for pedagogical/teaching purposes.
My problem has something like 10000-50000 variables and speed is important.
Any suggestion would be greatly appreciated!
If you’re looking for linear solvers, then PETSc might be helpful : https://petsc.org/
It is written in C, but has Fortran bindings, and is widely used by many.
My problem has something like 10000-50000 variables and speed is important.
PETSc can run in both serial and parallel mode (with MPI), so based on your requirements, you can use them to your liking. Also, PETSc is mostly used for solving sparse linear systems, and if your system is dense, it may not be the best solution.
Although one major CON of using PETSc is: It is significantly difficult to setup and use for a first time user, however once you get the hang of it, it becomes easier to use.
I have been tinkering with HiGHS. It is written in C++ and has Fortran bindings.
All I have done so far is proof of concept - calling from Fortran (Intel and gfortran) to solve problems of up to 20k variables. It seems viable and the MIT licence is attractive to us.
Highs is used by Matlab too. The Matlab function linprog calls Highs behind the scenes (for default algorithm)
I had missed that recent news. We did the HiGHS evaluation last year and have put that work aside for now.
Looking at this project could shed light on how to call PETSc from Fortran.
This is a great resource. Thanks for sharing.
I also learned using PETSc with Fortran using this exact resource, since I knew Dr. Kadapa (the author) personally and he recommended this to me.
He has also created this article to explain in more details: Parlallel Programming for FEA with Fortran/PETSc
I was wondering if the Intel MKL (which is free) has a linear programming solver. I read that it has many linear algebra routines: matrix-vector and matrix-matrix multiplications, LU, Choleski and QR factorizations, etc but I didn’t find any info on linear programming
I think linear programming is a quite commercially-oriented field. I know some people use Gurobi, and I think it has a Fortran interface (don’t take my word for it).
Maybe try searching for recommendations on Stack Exchange?
I’ve found this article online: The design and application of IPMLO. A FORTRAN library for linear optimization with interior point methods
At the end it reads:
AVAILABILITY OF CODE
It is our intention to make the IPMLO code available for any research purposes. More information regarding this can be obtained by contacting Jacek Gondzio.
Given that the article is more than 30yo, I’m wondering how easy would that be.
If the code is 30 years old, it’s going to be very slow compared to modern solvers. Linear Programming is an area that has received continual advancements in algorithms over the past 50 years.
Early 2020 I had used GLPK through the Fortran C bindings. I don’t know if my bindings still work with the newer versions of GLP. Other things came up so I have not worked with it since neither have I tested since, but if you wish, I can post the code to you so you can use whatever you find useful.
Unfortunately Gurobi has no official Fortran interface last time I checked. And I failed miserably to use the Fortran C bindings on it!