I'm using GLPK C API for a mixed integer programming problem. Is there some way to print the objective/constraints in human readable format for debugging?
Perhaps the nicest format is the CPLEX LP format. It looks something like this:
Maximize
obj: x1 + 2 x2 + 3 x3 + x4
Subject To
c1: - x1 + x2 + x3 + 10 x4 <= 20
c2: x1 - 3 x2 + x3 <= 30
c3: x2 - 3.5 x4 = 0
Bounds
0 <= x1 <= 40
2 <= x4 <= 3
General
x4
End
You can write your model in this format by calling:
int glp_write_lp(glp_prob *P, const glp_cpxcp *parm, const char *fname);
See also glp_write_lp
— write problem data in CPLEX LP format in the documentation that comes with GLPK.