/* $Id$ * * Name: dummyVecMatr.cpp * Author: Pietro Belotti * Purpose: fill in empty or single valued vectors and matrices * * (C) Carnegie-Mellon University, 2008. * This file is licensed under the Eclipse Public License (EPL) */ #include "OsiSolverInterface.hpp" #include "CoinPackedVector.hpp" #include "CoinPackedMatrix.hpp" #include "CoinHelperFunctions.hpp" #include "CouennePrecisions.hpp" using namespace Couenne; // take columns of matrix and add each to arrays for matrix under construction void addSubMatr (int *start, int *len, int *ind, double *el, CoinPackedMatrix &A, CoinPackedVector &v, int &cur, int &ncols, int dispM, int dispVec, int finalrow) { const int *aLe = A.getVectorLengths (), *aIn = A.getIndices (), *vIn = v.getIndices (), aCol = A.getMajorDim (); int vNum = v.getNumElements (); const double *aEl = A.getElements (), *vEl = v.getElements (); // add each column for (int i=0; i %2d] (%2d): ", i, start [i], start [i+1] - 1, len [i]); for (int j=0; j < len [i]; j++) printf ("%d ", ind [start [i] + j]); printf (" | --- | "); for (int j=0, indice = 0; j < len [i] && j < 1000; j++) { while (indice < ind [cur]) {indice++; printf (". ");} indice++; printf ("%2g ", el [cur++]); } printf ("\n"); } printf ("-#-\n"); } void printMatrix (const CoinPackedMatrix *A) { int nrows = A -> getMajorDim (), ncols = A -> getMinorDim (), nel = A -> getNumElements (); const double *el = A -> getElements (); const int *len = A -> getVectorLengths (), *start = A -> getVectorStarts (), *ind = A -> getIndices (); printMatrix (nrows, ncols, nel, start, len, ind, el); } void printLPMatrix (const OsiSolverInterface &si) { // the coefficient matrix const CoinPackedMatrix *A = si.getMatrixByCol (); printMatrix (A); }