next up previous
Next: Ineffective Cuts Up: Exercises Previous: Duplicate Cuts

Column Ordered

Exercise: Construct the initial matrix using a column-ordered matrix (rather than a row-ordered matrix).

  CoinPackedMatrix * matrix =  new CoinPackedMatrix(true,0,0);
  matrix->setDimensions(n_rows, 0);
  
  // Create cols and append them to matrix
  // First, create cols related with x
  for (i = 0; i < M; ++i) {
    for (j = 0; j < N; ++j) {
      CoinPackedVector col;
      col.insert(i, 1.0);
      col.insert(j+M, 1.0);
      matrix->appendCol(col);
    }
  }

  // Then, create cols related with y
  for (j = 0; j < N; ++j) {
    CoinPackedVector col2;
    col2.insert(j+M, -total_demand);
    matrix->appendCol(col2);
  }



IP Seminar Series 2004-01-11