GLPK/Fortran

Fortran is a high-performance scientific computing language which dates from the 1950s and is still in use.

Bindings for GNU gfortran
Jeff Kelly has made the following GNU gfortran GLPK language bindings available. See the next section for further details and discussion.

Bindings for Fortran 2003
Jeff Kelly has made the following main program example available, complete with language bindings. This code was developed using the Intel Fortran 2003 compiler.

The program itself calls GLPK to:

max c'*x such that A*x <= b and lower <= x <= upper

The example includes the necessary Fortran bindings and also shows how to setup the callback for integer optimization (if required) using GLPKintsolcb and the Fortran LOC intrinsic.

The most difficult part when interfacing GLPK to Fortran concerns the two derived types glp_smcp (simplex settings) and glp_iocp (integer optimization settings). These derived types are treated as "blind arrays" so that one simply needs to match the bit pattern of the blind array with the derived type and then pass this via glp_init_smcp &mdash; for example (as shown below), the first integer value problem1_set1%msg_lev acts like an integer pointer to the blind array as usual.

GLPK-Fortran
A FORTRAN 90 binding by Jeff Armstrong can be found at https://github.com/ArmstrongJ/GLPK-Fortran. Development stopped in 2014. The code in licensed under GPL 3.