[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-glpk] column index inconsistency
From: |
Andrew Makhorin |
Subject: |
Re: [Help-glpk] column index inconsistency |
Date: |
Mon, 15 Feb 2010 04:24:54 +0300 |
> 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.