To fix the bug please replace line 4990 in file glpmpl3.c (glpk 4.8): write_text(mpl, from, (int)(value + 0.5));
by the following one: write_text(mpl, from, (int)floor(value + 0.5)); and then recompile/reinstall the package in a usual way. Note that the bug will be fixed in a next release of Glpk. The bug appears if the value to be printed is negative and %d format specifier is used. The value should be properly rounded to the nearest integer while it was simply truncated. So, in your case it was (int)(-6 + 0.5) = (int)(-5.5) = -5 while the correct answer is obviously -6. Andrew Makhorin Reading model section from bug.mod... 23 lines were read Generating r1... Generating r2... Generating r3... Generating r4... Generating obj... Model has been successfully generated lpx_simplex: original LP has 5 rows, 4 columns, 13 non-zeros lpx_simplex: presolved LP has 4 rows, 4 columns, 9 non-zeros lpx_adv_basis: size of triangular part = 4 * 0: objval = 0.000000000e+00 infeas = 0.000000000e+00 (0) * 3: objval = 1.750000000e+01 infeas = 0.000000000e+00 (0) OPTIMAL SOLUTION FOUND Integer optimization begins... Objective function is integral + 3: mip = not found yet <= +inf (1; 0) + 4: mip = 1.700000000e+01 <= 1.700000000e+01 0.0% (2; 0) + 4: mip = 1.700000000e+01 <= tree is empty 0.0% (0; 3) INTEGER OPTIMAL SOLUTION FOUND Time used: 0.0 secs Memory used: 0.1M (151244 bytes) x1=0, x2=5, x3=-6, x4=9 (obj: 17) Model has been successfully processed _______________________________________________ Bug-glpk mailing list [email protected] http://lists.gnu.org/mailman/listinfo/bug-glpk
