Thanks for the explanation. It makes sense now. Wasn't very obvious from the documentation. The glp_sort_mat() does not resolve the issue.
I am using a work around using maps. On Sun, Feb 14, 2010 at 5:24 PM, Andrew Makhorin <[email protected]> wrote: > > When I try to set and get the columns of a row the columns index > > changes. In the attached code i am adding a row with 4 columns and > > then retrieving the same. For the code attached below, the output > > looks like : > > > 3.0*x1 5.0*x2 7.0*x3 9.0*x4 > > 9.0*x4 7.0*x3 5.0*x2 3.0*x1 > > > While the <index, coeff> pairs are same the contents of the input and > > output array has changed. I am assuming such a basic thing is probably > > not a bug. What is the proper way to use the API so that my set and > > get arrays contain the same value. > > The order of columns in the column list returned by glp_get_mat_row > is not defined in the sense that you should not expect any particular > ordering. This is usual practice in sparse computations. > Nevertheless, you can use the routine glp_sort_mat to sort the row > and column linked lists of the constraint matrix. For more details > please see the glpk reference manual. > > -- Somsubhra Sharangi Grad Student,Simon Fraser University
_______________________________________________ Help-glpk mailing list [email protected] http://lists.gnu.org/mailman/listinfo/help-glpk
