glpk.LPX backward compatiblity?

2019-07-17 08:19发布

问题:

Newer versions of glpk do not have the LPX api, which is required by older packages. How can I use an older package (like COBRA) with the newer versions of glpk?

Note that COBRA is available for MATLAB and Python. Both require glpk and the LPX api, and I would like to use both.

回答1:

Ideally you should switch to a version that uses the new API. It has been around for years. If that is no option, then the following entry in the ChangeLog to V4.53 points in the right direction

    * examples/oldapi/lpx.h, examples/oldapi/lpx.c
    A set of routines that simulate the old GLPK API (as defined
    in 4.48) were added. Thanks to Jan Engelhardt <jengelh@inai.de>
    for suggestion.

In the directory examples/oldapi of the source release you find everything you need. Excerpt from README:

The program module in this subdirectory contains an implementation of
the old GLPK API as it was defined in GLPK 4.48.

To compile an existing project using the old GLPK API you need to add
to the project two files lpx.h and lpx.c.