At 5:12am -0400 Sun, 08 Jun 2014, Lukas Meyer wrote:
I would like to use a GLPK linear programming model in Ruby using the
Rglpk wrapper. Unfortunately, I do not get the same solution when
comparing the glpk and Rglpk outputs. Despite I am setting the column
kind to Binary (cols.kind = Rglpk::GLP_BV), the solution shows
integer values instead of boolean.
The model is rather simple, but somehow I am missing something in the
ruby code. Do you have any hint what could be wrong?
I don't speak Ruby currently, but I can offer a starting point for
debugging: have both pathways to GLPK write the problem they think
they're solving to a file, then compare the two.
Obviously, pick the format of your choice, but for a first ditch effort,
you may find CPLEX LP format to be slightly easier to read and compare.
For example, the command line version might be:
$ glpsol --math your_problem --wlp CommandLineProblem.lp
# or
$ glpsol --lp your_problem.lp --wlp CommandLineProblem.lp
For the script version, do the moral equivalent in your code and then
compare the two. (If you're not a command line junkie, 'diff -u file1
file2' might come in handy.) It may help you find the discrepancy.
Good luck,
Kevin