/* Set a run of row names. Quietly fail if the specified indices are invalid. On the target side, [tgtStart, tgtStart+len-1] must be in the range [0,m-1], where m is the number of rows. On the source side, srcStart must be zero or greater. If we run off the end of srcNames, we just generate default names. */ void OsiSolverInterface::setRowNames (OsiNameVec &srcNames, int srcStart, int len, int tgtStart) { int nameDiscipline ; /* Determine how we're handling names. It's possible that the underlying solver has overridden getIntParam, but doesn't recognise OsiNameDiscipline. In that case, we want to default to auto names */ bool recognisesOsiNames = getIntParam(OsiNameDiscipline,nameDiscipline) ; if (recognisesOsiNames == false) { nameDiscipline = 0 ; } /* If the name discipline is auto, we're already done. */ if (nameDiscipline == 0) { return ; } /* A little self-protection. Check that we're within [0,m-1] on the target side, and that srcStart is zero or greater. Quietly fail if the indices don't fit. */ int m = getNumRows() ; if (tgtStart < 0 || tgtStart+len > m) { return ; } if (srcStart < 0) { return ; } int srcLen = static_cast<int>(srcNames.size()) ; /* Load 'em up. */ int srcNdx = srcStart ; int tgtNdx = tgtStart ; for ( ; tgtNdx < tgtStart+len ; srcNdx++,tgtNdx++) { if (srcNdx < srcLen) { setRowName(tgtNdx,srcNames[srcNdx]) ; } else { setRowName(tgtNdx,dfltRowColName('r',tgtNdx)) ; } } return ; }
foreach (QString line, listOfLines) { if (start) {start=0; continue;} //пропускаем начальную строку QStringList lineList = line.split("\t"); setRowName(i, lineList.at(0)); for (int j = 1; j<lineList.count()-1; j++) { setValue(j-1, i,lineList.at(j).toDouble()); } i++; }