Hello GLPK uses a tolerance internally. Please change your tests, e.g.
fabs(nx) < .0001 Best regards Xypron -------- Original-Nachricht -------- > Datum: Wed, 28 Apr 2010 17:26:16 +0300 > Von: Volkan YAZICI <[email protected]> > An: [email protected] > Betreff: [Help-glpk] Rounding Problem > Hi, > > I get below solutions > > (gdb) p glp_get_col_val(lp, 'n', 7) > $4 = 0 > (gdb) p glp_get_col_val(lp, 'c', 0) > $5 = 1 > (gdb) p glp_get_col_val(lp, 'c', 1) > $6 = 1 > (gdb) p glp_get_col_val(lp, 'c', 2) > $7 = 1 > (gdb) p glp_get_col_val(lp, 'c', 4) > $8 = 1.0000000000000002 > > for the following constraint. > > n7 - c0 - c1 - c2 - c4 >= -4 > > n7 should be greater than 0, but because of rounding errors it passes > the constraint check. > > (gdb) p (0 - 1 - 1 - 1 - 1.0000000000000002) >= -4 > 1 > > What's the recommended way of solving such problems? I looked at ml > archives and found out that people use glp_scale_prob() method. But for > my particular case -- where I just check if (nx == 0.0) and if (cx == > 1.0) -- I couldn't figure out which option to use with glp_scale_prob() > method. Any ideas? > > > Regards. > > > _______________________________________________ > Help-glpk mailing list > [email protected] > http://lists.gnu.org/mailman/listinfo/help-glpk -- GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT! Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01 _______________________________________________ Help-glpk mailing list [email protected] http://lists.gnu.org/mailman/listinfo/help-glpk
