[Coin-discuss] cplex row activity.

Vivian.DeSmedt at aisystems.be Vivian.DeSmedt at aisystems.be
Mon Jan 27 11:54:07 EST 2003


Dear Osi,

I think I have discover a small error in the glpk interface:

I propose this new implementation of the loadProblem function.
At least this variation support the test10 part of my small test suite you
will find in attachment.


(See attached file: testOsi.zip)

Regards,
Vivian.


void
OsiGlpkSolverInterface::loadProblem(const int numcols, const int numrows,
                       const int* start, const int* index,
                       const double* value,
                       const double* collb, const double* colub,
                       const double* obj,
                       const double* rowlb, const double* rowub)
{
  freeCachedData( OsiGlpkSolverInterface::KEEPCACHED_NONE );
  LPX *model = getMutableModelPtr();
  double inf = getInfinity();

  lpx_add_cols( model, numcols );
  lpx_add_rows( model, numrows );

  // How many elements?
  int numelem = start[ numrows ];
  //  int numelem = 0;
  //  while ( index[numelem] != 0 )
  //    numelem++;
  int *index_adj = new int[1+numelem];
  double *value_adj = new double[1+numelem];

  int i;
  for ( i=1; i <= numelem; i++)
    {
      index_adj[i] = index[i-1] + 1;
      value_adj[i] = value[i-1];
    }

  int j;
  for( j = 0; j < numrows; j++ )
    {
      setRowBounds( j, rowlb ? rowlb[j]:-inf, rowub ? rowub[j]:inf );

      // Note that we should really add one to start[j].  However, we need
      // to give GLPK the address one before that, so it turns out to be
      // just start[j]
      lpx_set_mat_row( model, j+1, start[j+1]-start[j],
                 &(index_adj[start[j]]), &(value_adj[start[j]]) );
    }

  for( i = 0; i < numcols; i++ )
    {
      setColBounds( i, collb ? collb[i]:0.0,
              colub ? colub[i]:inf );
      setObjCoeff( i, obj ? obj[i]:0.0 );
    }

}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: testOsi.zip
Type: application/zip
Size: 37186 bytes
Desc: .ZIP File
URL: <http://list.coin-or.org/pipermail/coin-discuss/attachments/20030127/107c1c0c/attachment.zip>


More information about the Coin-discuss mailing list