[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
## Re: [Help-glpk] Got a wrong order of column by lpx_get_mat_row(lp, j, nd

**From**: |
Andrew Makhorin |

**Subject**: |
Re: [Help-glpk] Got a wrong order of column by lpx_get_mat_row(lp, j, ndx, val)? |

**Date**: |
Thu, 20 Jan 2005 08:06:32 +0300 |

>*Dose anyone meet this problem:*
>
>*for example in jth row : *
>*a*x-y+b*z=0;*
>
>*by len=lpx_get_mat_row(lp, j, ndx, val), I found *
>*val=[-1,a,b], that mean the order of column is y,x,z.*
>
>*I added two new columns to this row like:*
>
>*ndx[len+1]=w, ndx[len+2]=v, val[len+1]=d, *
>*val[len+2]=e, len+=2*
>
>*lpx_set_mat_row(lp,j,len,ndx,val)*
>
>*then I thought the jth row should be *
>*a*x-y+b*z+d*w+e*v=0, but when I tried len=lpx_get_mat_row(lp, j, ndx, val) *
>*again,*
>
>*I found it's d*w+e*v+a*x-y+b*z=0.*
>
>*I wonder whether the order of columns in row is *
>*fixed and how the order of columns in a row is arranged there.*
The order of (column) indices in sparse vectors returned by
lpx_get_mat_row (as well as other similar api routines) is *undefined*
in the sense that there is no simple way to predict that order.
However, there is the routine lpx_order_matrix, which allows ordering
the row/column lists of the constraint matrix (it is not documented, so
see the comments to this routine in glplpx1.c).