c++linear-programmingglpkmathprog

Equivalent of "glpsol" in GLPK API


I was wondering if there is an equivalent in GLPK Api of the command line function "glpsol".

Because I have a model which is written in a .mod file and data in .dat file. In command line I can solve it by calling this line :

glpsol --model flow-glpk.mod --data your_data_set.dat

I would like to solve the same problem in a C/C++ program without execute an "execv()" call.


Solution

  • Have a look at mplsamp2.c in the examples directory of the source distribution, I believe it does what you want, you just have to change the hardcoded names appropriately to your application.

    GLPK comes with a nice manual, 3.2 Routines for processing MathProg models details how to deal with MathProg models using the C API.