Esempio n. 1
0
//#############################################################################
bool
MibSHeuristic::checkLowerFeasibility1(double * solution)
{

  bool feasible(true);
  MibSModel * model = MibSModel_;
  int * lRowIndices = model->getLowerRowInd();
  int lRows(model->getLowerRowNum());
  const double * origRowLb = model->getOrigRowLb();
  const double * origRowUb = model->getOrigRowUb();
  const CoinPackedMatrix * matrix = model->getSolver()->getMatrixByRow();
  const double * matElements = matrix->getElements();
  const int * matIndices = matrix->getIndices();
  const int * matStarts = matrix->getVectorStarts();


  double lhs(0.0);
  int i(0), j(0), index1(0), index2(0), start(0), end(0);

  for(i = 0; i < lRows; i++){
    index1 = lRowIndices[i];
    start = matStarts[index1];
    end = start + matrix->getVectorSize(index1);
    for(j = start; j < end; j++){
      index2 = matIndices[j];
      lhs += matElements[j] * solution[index2];
    }
    if((origRowLb[index1] > lhs) || (lhs > origRowUb[index1]))
      feasible = false;
    lhs = 0.0;
  }

  return feasible;
}