> My ar[] array has many zero elements. I hope it is allowed. I am a bit
> confused 
> on the subject since the second argument (ne) apparently represents (doc.
> page 
> 21) the number of non-zero elements. Can anyone enlighten me what's going
> on? If 
> zero elements are not allowed then I see no way how I could apply this
> package 
> to my problem since my equations can only be written one way. Or should I
> cheat 
> and instead of using "0.0" use (say) "0.0000001" which is non-zero?

Do not replace zeros by a small number, this is a bad idea. Just
before call to lpx_load_matrix call the following routine:

int remove_zeros(int ne, int ia[], int ja[], double ar[])
{     int new_ne = 0, k;
      for (k = 1; k <= ne; k++)
      {  if (ar[k] != 0.0)
         {  new_ne++;
            ia[new_ne] = ia[k];
            ja[new_ne] = ja[k];
            ar[new_ne] = ar[k];
         }
      }
      return new_ne;
}

i.e. the calling sequence is the following:

. . .
ne = remove_zeros(ne, ia, ja, ar);
lpx_load_matrix(lp, ne, ia, ja, ar);
. . .



_______________________________________________
Help-glpk mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-glpk

Reply via email to