>> I'm having troubles while trying to get the solution variables via C
>> API. Below is the code I use in my program:
> 
>>       return (int) glp_get_col_prim(lp, i);
> 
> Please note that glp_get_col_prim returns a floating-point value, so
> it would be better to write:
> 
>    return (int) (glp_get_col_prim(lp, i) + .5);

Yes, this may cause incorrect results. Imagine that x = 0.999999 due
to round-off errors in the simplex solver. Then

   (int)x -> 0 (incorrect)

while

   (int)(x + .5) -> 1 (correct)



_______________________________________________
Help-glpk mailing list
Help-glpk@gnu.org
http://lists.gnu.org/mailman/listinfo/help-glpk

Reply via email to