Changeset 223 for branches


Ignore:
Timestamp:
Oct 15, 2003 2:37:22 PM (16 years ago)
Author:
forrest
Message:

Stuff

Location:
branches/pre
Files:
28 edited

Legend:

Unmodified
Added
Removed
  • branches/pre/ClpMatrixBase.cpp

    r210 r223  
    121121  abort();
    122122}
     123/* Returns largest and smallest elements of both signs.
     124   Largest refers to largest absolute value.
     125*/
     126void
     127ClpMatrixBase::rangeOfElements(double & smallestNegative, double & largestNegative,
     128                       double & smallestPositive, double & largestPositive)
     129{
     130  smallestNegative=0.0;
     131  largestNegative=0.0;
     132  smallestPositive=0.0;
     133  largestPositive=0.0;
     134}
  • branches/pre/ClpMessage.cpp

    r212 r223  
    5050  {CLP_PACKEDSCALE_FINAL,1003,2,"Final range of elements is %g to %g"},
    5151  {CLP_PACKEDSCALE_FORGET,1004,2,"Not bothering to scale as good enough"},
    52   {CLP_INITIALIZE_STEEP,1005,2,"Initializing steepest edge weights - old %g, new %g"},
     52  {CLP_INITIALIZE_STEEP,1005,3,"Initializing steepest edge weights - old %g, new %g"},
    5353  {CLP_UNABLE_OPEN,6001,0,"Unable to open file %s for reading"},
    5454  {CLP_BAD_BOUNDS,6002,0,"%d bad bound pairs or bad objectives were found - first at %c%d"},
  • branches/pre/ClpNetworkMatrix.cpp

    r221 r223  
    866866  return weights;
    867867}
     868/* Returns largest and smallest elements of both signs.
     869   Largest refers to largest absolute value.
     870*/
     871void
     872ClpNetworkMatrix::rangeOfElements(double & smallestNegative, double & largestNegative,
     873                       double & smallestPositive, double & largestPositive)
     874{
     875  smallestNegative=-1.0;
     876  largestNegative=-1.0;
     877  smallestPositive=1.0;
     878  largestPositive=1.0;
     879}
  • branches/pre/ClpNonLinearCost.cpp

    r210 r223  
    432432        // With increasing tolerances - we may be at wrong place
    433433        if (fabs(value-upperValue)>oldTolerance*1.0001) {
    434           assert(fabs(value-lowerValue)<=oldTolerance*1.0001);
    435           if  (fabs(value-lowerValue)>primalTolerance)
    436             solution[iSequence]=lowerValue;
    437           model_->setStatus(iSequence,ClpSimplex::atLowerBound);
     434          if (fabs(value-lowerValue)<=oldTolerance*1.0001) {
     435            if  (fabs(value-lowerValue)>primalTolerance)
     436              solution[iSequence]=lowerValue;
     437            model_->setStatus(iSequence,ClpSimplex::atLowerBound);
     438          } else {
     439            model_->setStatus(iSequence,ClpSimplex::superBasic);
     440          }
    438441        } else if  (fabs(value-upperValue)>primalTolerance) {
    439442          solution[iSequence]=upperValue;
     
    459462        // With increasing tolerances - we may be at wrong place
    460463        if (fabs(value-lowerValue)>oldTolerance*1.0001) {
    461           assert(fabs(value-upperValue)<=oldTolerance*1.0001);
    462           if  (fabs(value-upperValue)>primalTolerance)
    463             solution[iSequence]=upperValue;
    464           model_->setStatus(iSequence,ClpSimplex::atLowerBound);
     464          if (fabs(value-upperValue)<=oldTolerance*1.0001) {
     465            if  (fabs(value-upperValue)>primalTolerance)
     466              solution[iSequence]=upperValue;
     467            model_->setStatus(iSequence,ClpSimplex::atLowerBound);
     468          } else {
     469            model_->setStatus(iSequence,ClpSimplex::superBasic);
     470          }
    465471        } else if  (fabs(value-lowerValue)>primalTolerance) {
    466472          solution[iSequence]=lowerValue;
  • branches/pre/ClpPackedMatrix.cpp

    r213 r223  
    11641164    return 1;
    11651165  } else {
     1166      // need to scale
    11661167    int scalingMethod = model->scalingFlag();
    11671168    if (scalingMethod==3) {
     
    13011302#endif
    13021303    }
     1304    // If ranges will make horrid then scale
     1305    double tolerance = 5.0*model->primalTolerance();
     1306    for (iRow=0;iRow<numberRows;iRow++) {
     1307      if (usefulRow[iRow]) {
     1308        double difference = rowUpper[iRow]-rowLower[iRow];
     1309        double scaledDifference = difference*rowScale[iRow];
     1310        if (scaledDifference>tolerance&&scaledDifference<1.0e-4) {
     1311          // make gap larger
     1312          rowScale[iRow] *= 1.0e-4/scaledDifference;
     1313          //printf("Row %d difference %g scaled diff %g => %g\n",iRow,difference,
     1314          // scaledDifference,difference*rowScale[iRow]);
     1315        }
     1316      }
     1317    }
    13031318    // final pass to scale columns so largest is reasonable
    13041319    // See what smallest will be if largest is 1.0
     
    13541369        columnScale[iColumn] *= (1.0+0.1*value);
    13551370#endif
     1371        double difference = columnUpper[iColumn]-columnLower[iColumn];
     1372        double scaledDifference = difference*columnScale[iColumn];
     1373        if (scaledDifference>tolerance&&scaledDifference<1.0e-4) {
     1374          // make gap larger
     1375          columnScale[iColumn] *= 1.0e-4/scaledDifference;
     1376          //printf("Column %d difference %g scaled diff %g => %g\n",iColumn,difference,
     1377          // scaledDifference,difference*columnScale[iColumn]);
     1378        }
    13561379        overallSmallest = min(overallSmallest,smallest*columnScale[iColumn]);
    13571380      }
     
    16601683  return weights;
    16611684}
     1685/* Returns largest and smallest elements of both signs.
     1686   Largest refers to largest absolute value.
     1687*/
     1688void
     1689ClpPackedMatrix::rangeOfElements(double & smallestNegative, double & largestNegative,
     1690                       double & smallestPositive, double & largestPositive)
     1691{
     1692  smallestNegative=-COIN_DBL_MAX;
     1693  largestNegative=0.0;
     1694  smallestPositive=COIN_DBL_MAX;
     1695  largestPositive=0.0;
     1696  int numberColumns = matrix_->getNumCols();
     1697  // get matrix data pointers
     1698  const double * elementByColumn = matrix_->getElements();
     1699  const CoinBigIndex * columnStart = matrix_->getVectorStarts();
     1700  const int * columnLength = matrix_->getVectorLengths();
     1701  int i;
     1702  for (i=0;i<numberColumns;i++) {
     1703    CoinBigIndex j;
     1704    for (j=columnStart[i];j<columnStart[i]+columnLength[i];j++) {
     1705      double value = elementByColumn[j];
     1706      if (value>0.0) {
     1707        smallestPositive = min(smallestPositive,value);
     1708        largestPositive = max(largestPositive,value);
     1709      } else if (value<0.0) {
     1710        smallestNegative = max(smallestNegative,value);
     1711        largestNegative = min(largestNegative,value);
     1712      }
     1713    }
     1714  }
     1715}
    16621716
    16631717
  • branches/pre/ClpPlusMinusOneMatrix.cpp

    r210 r223  
    222222    int numberMinor1 = (!columnOrdered_) ? rhs.numberColumns_ : rhs.numberRows_;
    223223    int numberMajor1 = (columnOrdered_) ? rhs.numberColumns_ : rhs.numberRows_;
     224    // Also swap incoming if not column ordered
     225    if (!columnOrdered_) {
     226      int temp1 = numberRows;
     227      numberRows = numberColumns;
     228      numberColumns = temp1;
     229      const int * temp2;
     230      temp2 = whichRow;
     231      whichRow = whichColumn;
     232      whichColumn = temp2;
     233    }
    224234    // Throw exception if rhs empty
    225235    if (numberMajor1 <= 0 || numberMinor1 <= 0)
     
    14391449  numberRows_ += number;
    14401450}
     1451/* Returns largest and smallest elements of both signs.
     1452   Largest refers to largest absolute value.
     1453*/
     1454void
     1455ClpPlusMinusOneMatrix::rangeOfElements(double & smallestNegative, double & largestNegative,
     1456                       double & smallestPositive, double & largestPositive)
     1457{
     1458  int iColumn;
     1459  bool plusOne=false;
     1460  bool minusOne=false;
     1461  for (iColumn=0;iColumn<numberColumns_;iColumn++) {
     1462    if (startNegative_[iColumn]>startPositive_[iColumn])
     1463      plusOne=true;
     1464    if (startPositive_[iColumn+1]>startNegative_[iColumn])
     1465      minusOne=true;
     1466  }
     1467  if (minusOne) {
     1468    smallestNegative=-1.0;
     1469    largestNegative=-1.0;
     1470  } else {
     1471    smallestNegative=0.0;
     1472    largestNegative=0.0;
     1473  }
     1474  if (plusOne) {
     1475    smallestPositive=1.0;
     1476    largestPositive=1.0;
     1477  } else {
     1478    smallestPositive=0.0;
     1479    largestPositive=0.0;
     1480  }
     1481}
  • branches/pre/ClpPrimalColumnSteepest.cpp

    r222 r223  
    183183  if (mode_==4)
    184184    switchType = 5-numberSwitched_;
     185  else if (mode_>=10)
     186    switchType=3;
    185187  else
    186188    switchType = mode_;
     
    192194     4 - devex
    193195     5 - dantzig
     196     10 - can go to mini-sprint
    194197  */
    195198  if (updates->getNumElements()) {
     
    349352    if (ratio<1.0) {
    350353      numberWanted = max(2000,number/20);
    351     } else if (ratio<2.0) {
     354    } else if (ratio<4.0) {
    352355      numberWanted = max(2000,number/10);
    353356      numberWanted = max(numberWanted,numberColumns/20);
     
    395398      }
    396399    }
    397     if (model_->numberIterations()%1000==0)
    398     printf("numels %d ratio %g wanted %d type %d\n",numberElements,ratio,numberWanted,
    399     switchType);
     400    //if (model_->numberIterations()%1000==0)
     401    //printf("numels %d ratio %g wanted %d type %d\n",numberElements,ratio,numberWanted,
     402    //switchType);
    400403  }
    401404
     
    511514    printf("%d best %g\n",bestSequence,bestDj);*/
    512515 
    513 #ifdef CLP_DEBUG
     516#ifndef NDEBUG
    514517  if (bestSequence>=0) {
    515518    if (model_->getStatus(bestSequence)==ClpSimplex::atLowerBound)
     
    12991302  infeasible_->zero(sequenceIn);
    13001303  // for weights update we use pivotSequence
    1301   assert (pivotSequence_>=0);
    1302   pivotRow = pivotSequence_;
    1303   // unset in case sub flip
    1304   pivotSequence_=-1;
    1305   // make sure infeasibility on incoming is 0.0
    1306   const int * pivotVariable = model_->pivotVariable();
    1307   sequenceIn = pivotVariable[pivotRow];
    1308   infeasible_->zero(sequenceIn);
    1309   // and we can see if reference
    1310   double referenceIn=0.0;
    1311   if (mode_!=1&&reference(sequenceIn))
    1312     referenceIn=1.0;
    1313   // save outgoing weight round update
    1314   double outgoingWeight=0.0;
    1315   int sequenceOut = model_->sequenceOut();
    1316   if (sequenceOut>=0)
    1317     outgoingWeight=weights_[sequenceOut];
    1318   // update weights
    1319   updates->setNumElements(0);
    1320   spareColumn1->setNumElements(0);
    1321   // might as well set dj to 1
    1322   dj = 1.0;
    1323   updates->insert(pivotRow,-dj);
    1324   model_->factorization()->updateColumnTranspose(spareRow2,updates);
    1325   // put row of tableau in rowArray and columnArray
    1326   model_->clpMatrix()->transposeTimes(model_,-1.0,
    1327                                       updates,spareColumn2,spareColumn1);
    1328   double * weight;
    1329   int numberColumns = model_->numberColumns();
    1330   double scaleFactor = -1.0/dj; // as formula is with 1.0
    1331   // rows
    1332   number = updates->getNumElements();
    1333   index = updates->getIndices();
    1334   updateBy = updates->denseVector();
    1335   weight = weights_+numberColumns;
    1336  
    1337   assert (devex_>0.0);
    1338   for (j=0;j<number;j++) {
    1339     int iSequence = index[j];
    1340     double thisWeight = weight[iSequence];
    1341     // row has -1
    1342     double pivot = updateBy[iSequence]*scaleFactor;
    1343     updateBy[iSequence]=0.0;
    1344     double value = pivot * pivot*devex_;
    1345     if (reference(iSequence+numberColumns))
    1346       value += 1.0;
    1347     weight[iSequence] = max(0.99*thisWeight,value);
    1348   }
    1349  
    1350   // columns
    1351   weight = weights_;
    1352  
    1353   scaleFactor = -scaleFactor;
    1354  
    1355   number = spareColumn1->getNumElements();
    1356   index = spareColumn1->getIndices();
    1357   updateBy = spareColumn1->denseVector();
    1358   for (j=0;j<number;j++) {
    1359     int iSequence = index[j];
    1360     double thisWeight = weight[iSequence];
    1361     // row has -1
    1362     double pivot = updateBy[iSequence]*scaleFactor;
    1363     updateBy[iSequence]=0.0;
    1364     double value = pivot * pivot*devex_;
    1365     if (reference(iSequence))
    1366       value += 1.0;
    1367     weight[iSequence] = max(0.99*thisWeight,value);
    1368   }
    1369   // restore outgoing weight
    1370   if (sequenceOut>=0)
    1371     weights_[sequenceOut]=outgoingWeight;
    1372   spareColumn2->setNumElements(0);
    1373   //#define SOME_DEBUG_1
     1304  if (pivotSequence_>=0) {
     1305    pivotRow = pivotSequence_;
     1306    // unset in case sub flip
     1307    pivotSequence_=-1;
     1308    // make sure infeasibility on incoming is 0.0
     1309    const int * pivotVariable = model_->pivotVariable();
     1310    sequenceIn = pivotVariable[pivotRow];
     1311    infeasible_->zero(sequenceIn);
     1312    // and we can see if reference
     1313    double referenceIn=0.0;
     1314    if (mode_!=1&&reference(sequenceIn))
     1315      referenceIn=1.0;
     1316    // save outgoing weight round update
     1317    double outgoingWeight=0.0;
     1318    int sequenceOut = model_->sequenceOut();
     1319    if (sequenceOut>=0)
     1320      outgoingWeight=weights_[sequenceOut];
     1321    // update weights
     1322    updates->setNumElements(0);
     1323    spareColumn1->setNumElements(0);
     1324    // might as well set dj to 1
     1325    dj = 1.0;
     1326    updates->insert(pivotRow,-dj);
     1327    model_->factorization()->updateColumnTranspose(spareRow2,updates);
     1328    // put row of tableau in rowArray and columnArray
     1329    model_->clpMatrix()->transposeTimes(model_,-1.0,
     1330                                        updates,spareColumn2,spareColumn1);
     1331    double * weight;
     1332    int numberColumns = model_->numberColumns();
     1333    double scaleFactor = -1.0/dj; // as formula is with 1.0
     1334    // rows
     1335    number = updates->getNumElements();
     1336    index = updates->getIndices();
     1337    updateBy = updates->denseVector();
     1338    weight = weights_+numberColumns;
     1339   
     1340    assert (devex_>0.0);
     1341    for (j=0;j<number;j++) {
     1342      int iSequence = index[j];
     1343      double thisWeight = weight[iSequence];
     1344      // row has -1
     1345      double pivot = updateBy[iSequence]*scaleFactor;
     1346      updateBy[iSequence]=0.0;
     1347      double value = pivot * pivot*devex_;
     1348      if (reference(iSequence+numberColumns))
     1349        value += 1.0;
     1350      weight[iSequence] = max(0.99*thisWeight,value);
     1351    }
     1352   
     1353    // columns
     1354    weight = weights_;
     1355   
     1356    scaleFactor = -scaleFactor;
     1357   
     1358    number = spareColumn1->getNumElements();
     1359    index = spareColumn1->getIndices();
     1360    updateBy = spareColumn1->denseVector();
     1361    for (j=0;j<number;j++) {
     1362      int iSequence = index[j];
     1363      double thisWeight = weight[iSequence];
     1364      // row has -1
     1365      double pivot = updateBy[iSequence]*scaleFactor;
     1366      updateBy[iSequence]=0.0;
     1367      double value = pivot * pivot*devex_;
     1368      if (reference(iSequence))
     1369        value += 1.0;
     1370      weight[iSequence] = max(0.99*thisWeight,value);
     1371    }
     1372    // restore outgoing weight
     1373    if (sequenceOut>=0)
     1374      weights_[sequenceOut]=outgoingWeight;
     1375    spareColumn2->setNumElements(0);
     1376    //#define SOME_DEBUG_1
    13741377#ifdef SOME_DEBUG_1
    1375   // check for accuracy
    1376   int iCheck=229;
    1377   //printf("weight for iCheck is %g\n",weights_[iCheck]);
    1378   int numberRows = model_->numberRows();
    1379   //int numberColumns = model_->numberColumns();
    1380   for (iCheck=0;iCheck<numberRows+numberColumns;iCheck++) {
    1381     if (model_->getStatus(iCheck)!=ClpSimplex::basic&&
    1382         !model_->getStatus(iCheck)!=ClpSimplex::isFixed)
    1383       checkAccuracy(iCheck,1.0e-1,updates,spareRow2);
    1384   }
     1378    // check for accuracy
     1379    int iCheck=229;
     1380    //printf("weight for iCheck is %g\n",weights_[iCheck]);
     1381    int numberRows = model_->numberRows();
     1382    //int numberColumns = model_->numberColumns();
     1383    for (iCheck=0;iCheck<numberRows+numberColumns;iCheck++) {
     1384      if (model_->getStatus(iCheck)!=ClpSimplex::basic&&
     1385          !model_->getStatus(iCheck)!=ClpSimplex::isFixed)
     1386        checkAccuracy(iCheck,1.0e-1,updates,spareRow2);
     1387    }
    13851388#endif
    1386   updates->setNumElements(0);
    1387   spareColumn1->setNumElements(0);
     1389    updates->setNumElements(0);
     1390    spareColumn1->setNumElements(0);
     1391  }
    13881392}
    13891393// Update djs, weights for Steepest
     
    15311535    weight = weights_+numberColumns;
    15321536   
    1533     if (mode_<4||numberSwitched_>1) {
     1537    if (mode_<4||numberSwitched_>1||mode_>=10) {
    15341538      // Exact
    15351539      // now update weight update array
     
    15841588    index = spareColumn1->getIndices();
    15851589    updateBy = spareColumn1->denseVector();
    1586     if (mode_<4||numberSwitched_>1) {
     1590    if (mode_<4||numberSwitched_>1||mode_>=10) {
    15871591      // Exact
    15881592      // get subset which have nonzero tableau elements
     
    19411945  if (mode_==4)
    19421946    switchType = 5-numberSwitched_;
     1947  else if (mode_>=10)
     1948    switchType=3;
    19431949  else
    19441950    switchType = mode_;
     
    32563262ClpPrimalColumnSteepest::numberSprintColumns(int & numberIterations) const
    32573263{
    3258   return 0;
     3264  numberIterations=0;
     3265  int numberAdd=0;
     3266  if (!numberSwitched_&&mode_>=10) {
     3267    numberIterations = min(2000,model_->numberRows()/5);
     3268    numberIterations = max(numberIterations,model_->factorizationFrequency());
     3269    numberIterations = max(numberIterations,500);
     3270    if (mode_==10) {
     3271      numberAdd=max(300,model_->numberColumns()/10);
     3272      numberAdd=max(numberAdd,model_->numberRows()/5);
     3273      // fake all
     3274      //numberAdd=1000000;
     3275      numberAdd = min(numberAdd,model_->numberColumns());
     3276    } else {
     3277      abort();
     3278    }
     3279  }
     3280  return numberAdd;
    32593281}
    32603282// Switch off sprint idea
     
    32623284ClpPrimalColumnSteepest::switchOffSprint()
    32633285{
     3286  numberSwitched_=10;
    32643287}
  • branches/pre/ClpSimplex.cpp

    r222 r223  
    26712671int ClpSimplex::dual (int ifValuesPass )
    26722672{
     2673  assert (ifValuesPass>=0&&ifValuesPass<2);
    26732674  int returnCode = ((ClpSimplexDual *) this)->dual(ifValuesPass);
    26742675  if (problemStatus_==10) {
     
    26882689int ClpSimplex::primal (int ifValuesPass )
    26892690{
     2691  assert (ifValuesPass>=0&&ifValuesPass<2);
    26902692  int returnCode = ((ClpSimplexPrimal *) this)->primal(ifValuesPass);
    26912693  if (problemStatus_==10) {
     
    32293231  largestObj=0.0;
    32303232  // If bounds are too close - fix
    3231   double fixTolerance = 1.1*primalTolerance_;
     3233  double fixTolerance = 10.0*primalTolerance_;
    32323234  for (i=numberColumns_;i<numberColumns_+numberRows_;i++) {
    32333235    double value;
     
    35023504  double dualTolerance=dblParam_[ClpDualTolerance];
    35033505  //double primalTolerance=dblParam_[ClpPrimalTolerance];
    3504 
     3506  int returnCode=0;
    35053507  // If no basis then make all slack one
    35063508  if (!status_)
     
    35113513      numberBasic++;
    35123514  }
    3513   if (numberBasic) {
    3514     // not all slack
    3515     return 0;
    3516   } else {
     3515  if (!numberBasic) {
     3516    // all slack
    35173517    double * dj = new double [numberColumns_];
    35183518    double * solution = columnActivity_;
     
    35743574      if (!pivot) {
    35753575        delete [] dj;
    3576         return 1;
     3576        returnCode = 1;
    35773577      } else {
    35783578        // see if can be made dual feasible with gubs etc
     
    39233923          <<numberBad
    39243924          <<CoinMessageEol;
    3925         return -1;
     3925        returnCode = -1;
    39263926      }
    39273927    } else {
    39283928      delete [] dj;
    3929       return -1;
    3930     }
    3931   }
     3929      returnCode =  -1;
     3930    }
     3931    //cleanStatus();
     3932  }
     3933  return returnCode;
    39323934}
    39333935/* Pivot in a variable and out a variable.  Returns 0 if okay,
     
    47054707
    47064708  // Set up dummy row selection list
     4709  numberRows_ = wholeModel->numberRows_;
    47074710  int * whichRow = new int [numberRows_];
    47084711  int iRow;
     
    47134716  rowCopy_ = wholeModel->rowCopy_;
    47144717  if (wholeModel->rowCopy_) {
     4718    // note reversal of order
    47154719    wholeModel->rowCopy_ = wholeModel->rowCopy_->subsetClone(numberRows_,whichRow,
    47164720                                                             numberColumns,whichColumns);
     
    47224726                                        numberColumns,whichColumns);
    47234727  delete [] whichRow;
     4728  numberColumns_ = wholeModel->numberColumns_;
    47244729  // Now ClpSimplex stuff and status_
    47254730  ClpPrimalColumnSteepest * steep =
    47264731    dynamic_cast< ClpPrimalColumnSteepest*>(wholeModel->primalColumnPivot_);
     4732#ifdef NDEBUG
     4733  if (!steep)
     4734    abort();
     4735#else
    47274736  assert (steep);
    4728   primalColumnPivot_ = wholeModel->primalColumnPivot_;
     4737#endif
     4738  delete  wholeModel->primalColumnPivot_;
    47294739  wholeModel->primalColumnPivot_ = new ClpPrimalColumnSteepest(0);
    47304740  nonLinearCost_ = wholeModel->nonLinearCost_;
     
    47334743  int iColumn;
    47344744  int numberTotal = numberRows_+numberColumns;
     4745  printf("%d %d %d\n",numberTotal,numberRows_,numberColumns);
    47354746  // mapping
    47364747  int * mapping = new int[numberRows_+numberColumns_];
     
    47394750  for (iRow=0;iRow<numberRows_;iRow++)
    47404751    mapping[iRow+numberColumns_] = iRow+numberColumns;
     4752  // Redo costs and bounds of whole model
     4753  wholeModel->createRim(5,false);
    47414754  lower_ = wholeModel->lower_;
    47424755  wholeModel->lower_ = new double [numberTotal];
     
    47484761    mapping[jColumn]=iColumn;
    47494762  }
     4763#ifdef CLP_DEBUG
     4764  for (iColumn=0;iColumn<numberRows_+numberColumns_;iColumn++)
     4765    printf("mapx %d %d\n",iColumn,mapping[iColumn]);
     4766#endif
    47504767  // Re-define pivotVariable_
    47514768  for (iRow=0;iRow<numberRows_;iRow++) {
    4752     int iPivot = pivotVariable_[iRow];
    4753     pivotVariable_[iRow]=mapping[iPivot];
     4769    int iPivot = wholeModel->pivotVariable_[iRow];
     4770    wholeModel->pivotVariable_[iRow]=mapping[iPivot];
     4771#ifdef CLP_DEBUG
     4772    printf("p row %d, pivot %d -> %d\n",iRow,iPivot,mapping[iPivot]);
     4773#endif
     4774    assert (wholeModel->pivotVariable_[iRow]>=0);
    47544775  }
    47554776  // Reverse mapping (so extended version of whichColumns)
    4756   int iBig;
    4757   for (iColumn=0;iColumn<numberTotal;iColumn++)
    4758     if (mapping[iColumn]>=0)
    4759       mapping[iBig++]=iColumn;
     4777  for (iColumn=0;iColumn<numberColumns;iColumn++)
     4778    mapping[iColumn]=whichColumns[iColumn];
     4779  for (;iColumn<numberRows_+numberColumns;iColumn++)
     4780    mapping[iColumn] = iColumn + (numberColumns_-numberColumns);
     4781#ifdef CLP_DEBUG
     4782  for (iColumn=0;iColumn<numberRows_+numberColumns;iColumn++)
     4783    printf("map %d %d\n",iColumn,mapping[iColumn]);
     4784#endif
    47604785  // Save mapping somewhere - doesn't matter
    47614786  rowUpper_ = (double *) mapping;
     
    47844809    wholeModel->solution_[iColumn]=solution_[jColumn];
    47854810  }
     4811  // now see what variables left out do to row solution
     4812  double * rowSolution = wholeModel->solution_+numberColumns;
     4813  double * fullSolution = solution_;
     4814  double * sumFixed = new double[numberRows_];
     4815  memset (sumFixed,0,numberRows_*sizeof(double));
     4816  // zero out ones in small problem
     4817  for (iColumn=0;iColumn<numberColumns;iColumn++) {
     4818    int jColumn = mapping[iColumn];
     4819    fullSolution[jColumn]=0.0;
     4820  }
     4821  // Get objective offset
     4822  double originalOffset;
     4823  wholeModel->getDblParam(ClpObjOffset,originalOffset);
     4824  double offset=0.0;
     4825  const double * cost = cost_;
     4826  for (iColumn=0;iColumn<numberColumns_;iColumn++)
     4827    offset += fullSolution[iColumn]*cost[iColumn];
     4828  wholeModel->setDblParam(ClpObjOffset,originalOffset-offset);
     4829  setDblParam(ClpObjOffset,originalOffset);
     4830  matrix_->times(1.0,fullSolution,sumFixed,wholeModel->rowScale_,wholeModel->columnScale_);
     4831     
     4832  double * lower = lower_+numberColumns;
     4833  double * upper = upper_+numberColumns;
     4834  double fixed=0.0;
     4835  for (iRow=0;iRow<numberRows_;iRow++) {
     4836    fixed += fabs(sumFixed[iRow]);
     4837    if (lower[iRow]>-1.0e50)
     4838      lower[iRow] -= sumFixed[iRow];
     4839    if (upper[iRow]<1.0e50)
     4840      upper[iRow] -= sumFixed[iRow];
     4841    rowSolution[iRow] -= sumFixed[iRow];
     4842  }
     4843  printf("offset %g sumfixed %g\n",offset,fixed);
     4844  delete [] sumFixed;
    47864845  columnScale_ = wholeModel->columnScale_;
    47874846  if (columnScale_) {
    47884847    wholeModel->columnScale_ = new double [numberTotal];
    4789     for (iColumn=0;iColumn<numberTotal;iColumn++) {
     4848    for (iColumn=0;iColumn<numberColumns;iColumn++) {
    47904849      int jColumn = mapping[iColumn];
    47914850      wholeModel->columnScale_[iColumn]=columnScale_[jColumn];
     
    48154874  }
    48164875 
    4817  
    4818   numberColumns_ = wholeModel->numberColumns_;
    48194876  wholeModel->numberColumns_ = numberColumns;
    48204877  // Initialize weights
    4821   wholeModel->primalColumnPivot_->saveWeights(wholeModel,5);
     4878  wholeModel->primalColumnPivot_->saveWeights(wholeModel,2);
    48224879  // Costs
    48234880  wholeModel->nonLinearCost_ = new ClpNonLinearCost(wholeModel);
     4881  wholeModel->nonLinearCost_->checkInfeasibilities();
     4882  printf("after contraction %d infeasibilities summing to %g\n",
     4883         nonLinearCost_->numberInfeasibilities(),nonLinearCost_->sumInfeasibilities());
     4884  // Redo some stuff
     4885  wholeModel->reducedCostWork_ = wholeModel->dj_;
     4886  wholeModel->rowReducedCost_ = wholeModel->dj_+wholeModel->numberColumns_;
     4887  wholeModel->columnActivityWork_ = wholeModel->solution_;
     4888  wholeModel->rowActivityWork_ = wholeModel->solution_+wholeModel->numberColumns_;
     4889  wholeModel->objectiveWork_ = wholeModel->cost_;
     4890  wholeModel->rowObjectiveWork_ = wholeModel->cost_+wholeModel->numberColumns_;
     4891  wholeModel->rowLowerWork_ = wholeModel->lower_+wholeModel->numberColumns_;
     4892  wholeModel->columnLowerWork_ = wholeModel->lower_;
     4893  wholeModel->rowUpperWork_ = wholeModel->upper_+wholeModel->numberColumns_;
     4894  wholeModel->columnUpperWork_ = wholeModel->upper_;
     4895#ifndef NDEBUG
     4896  // Check status
     4897  ClpSimplex * xxxx = wholeModel;
     4898  int nBasic=0;
     4899  for (iColumn=0;iColumn<xxxx->numberRows_+xxxx->numberColumns_;iColumn++)
     4900    if (xxxx->getStatus(iColumn)==basic)
     4901      nBasic++;
     4902  assert (nBasic==xxxx->numberRows_);
     4903  for (iRow=0;iRow<xxxx->numberRows_;iRow++) {
     4904    int iPivot=xxxx->pivotVariable_[iRow];
     4905    assert (xxxx->getStatus(iPivot)==basic);
     4906  }
     4907#endif
    48244908}
    48254909/* This copies back stuff from miniModel and then deletes miniModel.
     
    48284912ClpSimplex::originalModel(ClpSimplex * miniModel)
    48294913{
    4830   int numberSmall = miniModel->numberColumns_;
     4914  int numberSmall = numberColumns_;
     4915  numberColumns_ = miniModel->numberColumns_;
    48314916  int numberTotal = numberSmall+numberRows_;
    48324917  // copy back
    48334918  int iColumn;
    48344919  int * mapping = (int *) miniModel->rowUpper_;
     4920#ifdef CLP_DEBUG
     4921  for (iColumn=0;iColumn<numberRows_+numberColumns_;iColumn++)
     4922    printf("mapb %d %d\n",iColumn,mapping[iColumn]);
     4923#endif
     4924  // miniModel actually has full arrays
     4925  // now see what variables left out do to row solution
     4926  double * fullSolution = miniModel->solution_;
     4927  double * sumFixed = new double[numberRows_];
     4928  memset (sumFixed,0,numberRows_*sizeof(double));
     4929  miniModel->matrix_->times(1.0,fullSolution,sumFixed,rowScale_,miniModel->columnScale_);
     4930     
    48354931  for (iColumn=0;iColumn<numberTotal;iColumn++) {
    48364932    int jColumn = mapping[iColumn];
    4837     lower_[jColumn]=miniModel->lower_[iColumn];
    4838   }
    4839   delete [] miniModel->lower_;
    4840   for (iColumn=0;iColumn<numberTotal;iColumn++) {
    4841     int jColumn = mapping[iColumn];
    4842     upper_[jColumn]=miniModel->upper_[iColumn];
    4843   }
    4844   delete [] miniModel->upper_;
    4845   for (iColumn=0;iColumn<numberTotal;iColumn++) {
    4846     int jColumn = mapping[iColumn];
    4847     cost_[jColumn]=miniModel->cost_[iColumn];
    4848   }
    4849   delete [] miniModel->cost_;
    4850   for (iColumn=0;iColumn<numberTotal;iColumn++) {
    4851     int jColumn = mapping[iColumn];
    4852     dj_[jColumn]=miniModel->dj_[iColumn];
    4853   }
    4854   delete [] miniModel->dj_;
    4855   for (iColumn=0;iColumn<numberTotal;iColumn++) {
    4856     int jColumn = mapping[iColumn];
    4857     solution_[jColumn]=miniModel->solution_[iColumn];
    4858   }
    4859   delete [] miniModel->solution_;
    4860   for (iColumn=0;iColumn<numberTotal;iColumn++) {
    4861     int jColumn = mapping[iColumn];
    4862     status_[jColumn]=miniModel->status_[iColumn];
    4863   }
    4864   delete [] miniModel->status_;
     4933    miniModel->lower_[jColumn]=lower_[iColumn];
     4934    miniModel->upper_[jColumn]=upper_[iColumn];
     4935    miniModel->cost_[jColumn]=cost_[iColumn];
     4936    miniModel->dj_[jColumn]=dj_[iColumn];
     4937    miniModel->solution_[jColumn]=solution_[iColumn];
     4938    miniModel->status_[jColumn]=status_[iColumn];
     4939#ifdef CLP_DEBUG
     4940    printf("%d in small -> %d in original\n",iColumn,jColumn);
     4941#endif
     4942  }
     4943  delete [] lower_;
     4944  lower_ =  miniModel->lower_;
     4945  delete [] upper_;
     4946  upper_ =  miniModel->upper_;
     4947  delete [] cost_;
     4948  cost_ =  miniModel->cost_;
     4949  delete [] dj_;
     4950  dj_ =  miniModel->dj_;
     4951  delete [] solution_;
     4952  solution_ =  miniModel->solution_;
     4953  delete [] status_;
     4954  status_ =  miniModel->status_;
    48654955  if (columnScale_) {
    4866     for (iColumn=0;iColumn<numberTotal;iColumn++) {
     4956    for (iColumn=0;iColumn<numberSmall;iColumn++) {
    48674957      int jColumn = mapping[iColumn];
    4868       columnScale_[jColumn]=miniModel->columnScale_[iColumn];
    4869     }
    4870     delete [] miniModel->columnScale_;
     4958      miniModel->columnScale_[jColumn]=columnScale_[iColumn];
     4959    }
     4960    delete [] columnScale_;
     4961    columnScale_ =  miniModel->columnScale_;
    48714962  }
    48724963  if (savedSolution_) {
    4873     for (iColumn=0;iColumn<numberTotal;iColumn++) {
    4874       int jColumn = mapping[iColumn];
    4875       savedSolution_[jColumn]=miniModel->savedSolution_[iColumn];
    4876     }
    4877   }
    4878   delete [] miniModel->savedSolution_;
     4964    if (!miniModel->savedSolution_) {
     4965      miniModel->savedSolution_ = ClpCopyOfArray(solution_,numberColumns_+numberRows_);
     4966    } else {
     4967      for (iColumn=0;iColumn<numberTotal;iColumn++) {
     4968        int jColumn = mapping[iColumn];
     4969        miniModel->savedSolution_[jColumn]=savedSolution_[iColumn];
     4970      }
     4971    }
     4972    delete [] savedSolution_;
     4973    savedSolution_ =  miniModel->savedSolution_;
     4974  }
    48794975  if (saveStatus_) {
    4880     for (iColumn=0;iColumn<numberTotal;iColumn++) {
    4881       int jColumn = mapping[iColumn];
    4882       saveStatus_[jColumn]=miniModel->saveStatus_[iColumn];
    4883     }
    4884   }
    4885   delete [] miniModel->saveStatus_;
    4886   // delete stuff
    4887   delete miniModel->matrix_;
    4888   delete miniModel->rowCopy_;
    4889   delete miniModel->primalColumnPivot_;
    4890   delete miniModel->nonLinearCost_;
    4891 }
     4976    if (!miniModel->saveStatus_) {
     4977      miniModel->saveStatus_ = ClpCopyOfArray(status_,numberColumns_+numberRows_);
     4978    } else {
     4979      for (iColumn=0;iColumn<numberTotal;iColumn++) {
     4980        int jColumn = mapping[iColumn];
     4981        miniModel->saveStatus_[jColumn]=saveStatus_[iColumn];
     4982      }
     4983    }
     4984    delete [] saveStatus_;
     4985    saveStatus_ =  miniModel->saveStatus_;
     4986  }
     4987  // Re-define pivotVariable_
     4988  int iRow;
     4989  for (iRow=0;iRow<numberRows_;iRow++) {
     4990    int iPivot = pivotVariable_[iRow];
     4991#ifdef CLP_DEBUG
     4992    printf("pb row %d, pivot %d -> %d\n",iRow,iPivot,mapping[iPivot]);
     4993#endif
     4994    pivotVariable_[iRow]=mapping[iPivot];
     4995    assert (pivotVariable_[iRow]>=0);
     4996  }
     4997  // delete stuff and move back
     4998  delete matrix_;
     4999  delete rowCopy_;
     5000  delete primalColumnPivot_;
     5001  delete nonLinearCost_;
     5002  matrix_ = miniModel->matrix_;
     5003  rowCopy_ = miniModel->rowCopy_;
     5004  nonLinearCost_ = miniModel->nonLinearCost_;
     5005  double originalOffset;
     5006  miniModel->getDblParam(ClpObjOffset,originalOffset);
     5007  setDblParam(ClpObjOffset,originalOffset);
     5008  // Redo some stuff
     5009  reducedCostWork_ = dj_;
     5010  rowReducedCost_ = dj_+numberColumns_;
     5011  columnActivityWork_ = solution_;
     5012  rowActivityWork_ = solution_+numberColumns_;
     5013  objectiveWork_ = cost_;
     5014  rowObjectiveWork_ = cost_+numberColumns_;
     5015  rowLowerWork_ = lower_+numberColumns_;
     5016  columnLowerWork_ = lower_;
     5017  rowUpperWork_ = upper_+numberColumns_;
     5018  columnUpperWork_ = upper_;
     5019  // Cleanup
     5020  for (iRow=0;iRow<numberRows_;iRow++) {
     5021    double value = rowActivityWork_[iRow] + sumFixed[iRow];
     5022    rowActivityWork_[iRow] = value;
     5023    switch(getRowStatus(iRow)) {
     5024     
     5025    case basic:
     5026      break;
     5027    case atUpperBound:
     5028      //rowActivityWork_[iRow]=rowUpperWork_[iRow];
     5029      break;
     5030    case ClpSimplex::isFixed:
     5031    case atLowerBound:
     5032      //rowActivityWork_[iRow]=rowLowerWork_[iRow];
     5033      break;
     5034    case isFree:
     5035      break;
     5036      // superbasic
     5037    case superBasic:
     5038      break;
     5039    }
     5040  }
     5041  delete [] sumFixed;
     5042  nonLinearCost_->checkInfeasibilities();
     5043  printf("in original %d infeasibilities summing to %g\n",
     5044         nonLinearCost_->numberInfeasibilities(),nonLinearCost_->sumInfeasibilities());
     5045  // Initialize weights
     5046  primalColumnPivot_ = new ClpPrimalColumnSteepest(10);
     5047  primalColumnPivot_->saveWeights(this,2);
     5048#ifndef NDEBUG
     5049  // Check status
     5050  ClpSimplex * xxxx = this;
     5051  int nBasic=0;
     5052  for (iColumn=0;iColumn<xxxx->numberRows_+xxxx->numberColumns_;iColumn++)
     5053    if (xxxx->getStatus(iColumn)==basic)
     5054      nBasic++;
     5055  assert (nBasic==xxxx->numberRows_);
     5056  for (iRow=0;iRow<xxxx->numberRows_;iRow++) {
     5057    int iPivot=xxxx->pivotVariable_[iRow];
     5058    assert (xxxx->getStatus(iPivot)==basic);
     5059  }
     5060#endif
     5061}
  • branches/pre/ClpSimplexDual.cpp

    r212 r223  
    630630                 rowArray_[3],acceptablePivot,dubiousWeights);
    631631      } else {
     632        // Make sure direction plausible
     633        assert (upperOut_<1.0e50||lowerOut_>-1.0e50);
     634        if (directionOut_<0&&fabs(valueOut_-upperOut_)>dualBound_+primalTolerance_) {
     635          if (fabs(valueOut_-upperOut_)>fabs(valueOut_-lowerOut_))
     636            directionOut_=1;
     637        } else if (directionOut_>0&&fabs(valueOut_-upperOut_)<dualBound_+primalTolerance_) {
     638          if (fabs(valueOut_-upperOut_)>fabs(valueOut_-lowerOut_))
     639            directionOut_=-1;
     640        }
    632641        double direction=directionOut_;
    633642        rowArray_[0]->createPacked(1,&pivotRow_,&direction);
     
    29292938    // See if we need to perturb
    29302939    double * sort = new double[numberColumns_];
     2940    // Use objective BEFORE scaling
     2941    const double * obj = objective();
    29312942    int i;
    29322943    for (i=0;i<numberColumns_;i++) {
    2933       double value = fabs(objectiveWork_[i]);
     2944      double value = fabs(obj[i]);
    29342945      sort[i]=value;
    29352946    }
     
    29432954    }
    29442955    delete [] sort;
     2956#if 0
     2957    printf("nnz %d percent %d",number,(number*100)/numberColumns_);
    29452958    if (number*4>numberColumns_)
     2959      printf(" - Would not perturb\n");
     2960    else
     2961      printf(" - Would perturb\n");
     2962    exit(0);
     2963#endif
     2964    if (number*4>numberColumns_) {
     2965      perturbation_=100;
    29462966      return; // good enough
     2967    }
    29472968  }
    29482969  int iColumn;
     
    29712992  int iRow;
    29722993  double smallestNonZero=1.0e100;
     2994  int numberNonZero=0;
    29732995  if (perturbation_>=50) {
    29742996    perturbation = 1.0e-8;
     
    29873009      }
    29883010      if (lo&&lo>-1.0e10) {
     3011        numberNonZero++;
    29893012        lo=fabs(lo);
    29903013        if (!lastValue)
     
    29943017      }
    29953018      if (up&&up<1.0e10) {
     3019        numberNonZero++;
    29963020        up=fabs(up);
    29973021        if (!lastValue)
     
    30013025      }
    30023026    }
     3027    double lastValue2=0.0;
    30033028    for (iColumn=0;iColumn<numberColumns_;iColumn++) {
    30043029      double lo = columnLowerWork_[iColumn];
     
    30133038      }
    30143039      if (lo&&lo>-1.0e10) {
     3040        //numberNonZero++;
    30153041        lo=fabs(lo);
    3016         if (!lastValue)
    3017           lastValue=lo;
    3018         else if (fabs(lo-lastValue)>1.0e-7)
     3042        if (!lastValue2)
     3043          lastValue2=lo;
     3044        else if (fabs(lo-lastValue2)>1.0e-7)
    30193045          allSame=false;
    30203046      }
    30213047      if (up&&up<1.0e10) {
     3048        //numberNonZero++;
    30223049        up=fabs(up);
    3023         if (!lastValue)
    3024           lastValue=up;
    3025         else if (fabs(up-lastValue)>1.0e-7)
     3050        if (!lastValue2)
     3051          lastValue2=up;
     3052        else if (fabs(up-lastValue2)>1.0e-7)
    30263053          allSame=false;
    30273054      }
    30283055    }
    30293056    if (allSame) {
    3030       // Really hit perturbation
    3031       maximumFraction = max(1.0e-2*lastValue,maximumFraction);
     3057      // Check elements
     3058      double smallestNegative;
     3059      double largestNegative;
     3060      double smallestPositive;
     3061      double largestPositive;
     3062      matrix_->rangeOfElements(smallestNegative,largestNegative,
     3063                               smallestPositive,largestPositive);
     3064      if (smallestNegative==largestNegative&&
     3065          smallestPositive==largestPositive) {
     3066        // Really hit perturbation
     3067        maximumFraction = max(1.0e-3*max(lastValue,lastValue2),maximumFraction);
     3068      }
    30323069    }
    30333070    perturbation = min(perturbation,smallestNonZero/maximumFraction);
  • branches/pre/ClpSimplexPrimal.cpp

    r222 r223  
    189189  int initialStatus=problemStatus_;
    190190  // initialize - maybe values pass and algorithm_ is +1
    191     if (!startup(ifValuesPass)) {
    192 
     191  if (!startup(ifValuesPass)) {
     192   
    193193    int lastCleaned=0; // last time objective or bounds cleaned up
    194194   
     
    216216      }
    217217    }
     218    ClpSimplex * saveModel=NULL;
     219    int stopSprint=-1;
     220    int sprintPass=0;
     221    int reasonableSprintIteration=0;
     222    int lastSprintIteration=0;
     223    double lastObjectiveValue=COIN_DBL_MAX;
    218224    /*
    219225      Status of problem:
     
    250256      if (lastGoodIteration_==numberIterations_&&factorType)
    251257        factorType=3;
     258      if (saveModel) {
     259        // Doing sprint
     260        if (sequenceIn_<0||numberIterations_>=stopSprint) {
     261          problemStatus_=-1;
     262          originalModel(saveModel);
     263          saveModel=NULL;
     264          if (sequenceIn_<0&&numberIterations_<reasonableSprintIteration&&
     265              sprintPass>100)
     266            primalColumnPivot_->switchOffSprint();
     267          //lastSprintIteration=numberIterations_;
     268          printf("End small model\n");
     269        }
     270      }
     271         
    252272      // may factorize, checks if problem finished
    253       statusOfProblemInPrimal(lastCleaned,factorType,progress_);
     273      statusOfProblemInPrimal(lastCleaned,factorType,progress_,true,saveModel);
     274      // See if sprint says redo beacuse of problems
     275      if (numberDualInfeasibilities_==-776) {
     276        // Need new set of variables
     277        problemStatus_=-1;
     278        originalModel(saveModel);
     279        saveModel=NULL;
     280        //lastSprintIteration=numberIterations_;
     281        printf("End small model after\n");
     282        statusOfProblemInPrimal(lastCleaned,factorType,progress_,true,saveModel);
     283      }
     284      int numberSprintIterations=0;
     285      int numberSprintColumns = primalColumnPivot_->numberSprintColumns(numberSprintIterations);
     286      if (problemStatus_==777) {
     287        // problems so do one pass with normal
     288        problemStatus_=-1;
     289        originalModel(saveModel);
     290        saveModel=NULL;
     291        // Skip factorization
     292        //statusOfProblemInPrimal(lastCleaned,factorType,progress_,false,saveModel);
     293        statusOfProblemInPrimal(lastCleaned,factorType,progress_,true,saveModel);
     294      } else if (problemStatus_<0&&!saveModel&&numberSprintColumns&&firstFree_<0) {
     295        int numberSort=0;
     296        int numberFixed=0;
     297        int numberBasic=0;
     298        reasonableSprintIteration = numberIterations_ + 100;
     299        int * whichColumns = new int[numberColumns_];
     300        double * weight = new double[numberColumns_];
     301        int numberNegative=0;
     302        double sumNegative = 0.0;
     303        // now massage weight so all basic in plus good djs
     304        for (iColumn=0;iColumn<numberColumns_;iColumn++) {
     305          double dj = dj_[iColumn];
     306          switch(getColumnStatus(iColumn)) {
     307           
     308          case basic:
     309            dj = -1.0e50;
     310            numberBasic++;
     311            break;
     312          case atUpperBound:
     313            dj = -dj;
     314            break;
     315          case isFixed:
     316            dj=1.0e50;
     317            numberFixed++;
     318            break;
     319          case atLowerBound:
     320            dj = dj;
     321            break;
     322          case isFree:
     323            dj = -100.0*fabs(dj);
     324              break;
     325          case superBasic:
     326            dj = -100.0*fabs(dj);
     327            break;
     328          }
     329          if (dj<-dualTolerance_&&dj>-1.0e50) {
     330            numberNegative++;
     331            sumNegative -= dj;
     332          }
     333          weight[iColumn]=dj;
     334          whichColumns[iColumn] = iColumn;
     335        }
     336        handler_->message(CLP_SPRINT,messages_)
     337          <<sprintPass<<numberIterations_-lastSprintIteration<<objectiveValue()<<sumNegative
     338          <<numberNegative
     339          <<CoinMessageEol;
     340        sprintPass++;
     341        lastSprintIteration=numberIterations_;
     342        if (objectiveValue()*optimizationDirection_>lastObjectiveValue-1.0e-7&&sprintPass>5) {
     343          // switch off
     344          printf("Switching off sprint\n");
     345          primalColumnPivot_->switchOffSprint();
     346        } else {
     347          lastObjectiveValue = objectiveValue()*optimizationDirection_;
     348          // sort
     349          CoinSort_2(weight,weight+numberColumns_,whichColumns);
     350          numberSort = min(numberColumns_-numberFixed,numberBasic+numberSprintColumns);
     351          // Sort to make consistent ?
     352          std::sort(whichColumns,whichColumns+numberSort);
     353          saveModel = new ClpSimplex(this,numberSort,whichColumns);
     354          delete [] whichColumns;
     355          delete [] weight;
     356          // Skip factorization
     357          //statusOfProblemInPrimal(lastCleaned,factorType,progress_,false,saveModel);
     358          //statusOfProblemInPrimal(lastCleaned,factorType,progress_,true,saveModel);
     359          stopSprint = numberIterations_+numberSprintIterations;
     360          printf("Sprint with %d columns for %d iterations\n",
     361                 numberSprintColumns,numberSprintIterations);
     362        }
     363      }
    254364     
    255365      // Say good factorization
     
    433543ClpSimplexPrimal::statusOfProblemInPrimal(int & lastCleaned,int type,
    434544                                          ClpSimplexProgress * progress,
     545                                          bool doFactorization,
    435546                                          ClpSimplex * originalModel)
    436547{
     
    454565    // do weights
    455566    // This may save pivotRow_ for use
     567    if (doFactorization)
    456568    primalColumnPivot_->saveWeights(this,1);
    457569
    458     if (type) {
     570    if (type&&doFactorization) {
    459571      // is factorization okay?
    460572      if (internalFactorize(1)) {
     
    545657    numberPrimalInfeasibilities_ = 0;
    546658    sumPrimalInfeasibilities_ = 0.0;
     659    // But check if in sprint
     660    if (originalModel) {
     661      // Carry on and re-do
     662      numberDualInfeasibilities_ = -776;
     663    }
    547664  }
    548665  // had ||(type==3&&problemStatus_!=-5) -- ??? why ????
     
    757874    memcpy(savedSolution_ ,columnActivityWork_,numberColumns_*sizeof(double));
    758875  }
    759   // restore weights (if saved) - also recompute infeasibility list
    760   if (tentativeStatus>-3)
    761     primalColumnPivot_->saveWeights(this,(type <2) ? 2 : 4);
    762   else
    763     primalColumnPivot_->saveWeights(this,3);
     876  if (doFactorization) {
     877    // restore weights (if saved) - also recompute infeasibility list
     878    if (tentativeStatus>-3)
     879      primalColumnPivot_->saveWeights(this,(type <2) ? 2 : 4);
     880    else
     881      primalColumnPivot_->saveWeights(this,3);
     882    if (saveThreshold) {
     883      // use default at present
     884      factorization_->sparseThreshold(0);
     885      factorization_->goSparse();
     886    }
     887  }
    764888  if (problemStatus_<0&&!changeMade_) {
    765889    problemStatus_=4; // unknown
    766   }
    767   if (saveThreshold) {
    768     // use default at present
    769     factorization_->sparseThreshold(0);
    770     factorization_->goSparse();
    771890  }
    772891  lastGoodIteration_ = numberIterations_;
     
    14121531    }
    14131532    delete [] sort;
    1414     if (number*4>numberRows_)
     1533    if (number*4>numberRows_) {
     1534      perturbation_=100;
    14151535      return; // good enough
     1536    }
    14161537  }
    14171538  // primal perturbation
     
    18431964            ClpSimplexProgress dummyProgress;
    18441965            if (saveStatus_)
    1845               statusOfProblemInPrimal(lastCleaned,1,&dummyProgress);
     1966              statusOfProblemInPrimal(lastCleaned,1,&dummyProgress,true);
    18461967            else
    1847               statusOfProblemInPrimal(lastCleaned,0,&dummyProgress);
     1968              statusOfProblemInPrimal(lastCleaned,0,&dummyProgress,true);
    18481969            roundAgain=true;
    18491970            continue;
     
    18942015          ClpSimplexProgress dummyProgress;
    18952016          if (saveStatus_)
    1896             statusOfProblemInPrimal(lastCleaned,1,&dummyProgress);
     2017            statusOfProblemInPrimal(lastCleaned,1,&dummyProgress,true);
    18972018          else
    1898             statusOfProblemInPrimal(lastCleaned,0,&dummyProgress);
     2019            statusOfProblemInPrimal(lastCleaned,0,&dummyProgress,true);
    18992020          roundAgain=true;
    19002021          continue;
     
    19782099    ClpSimplexProgress dummyProgress;
    19792100    if (saveStatus_)
    1980       statusOfProblemInPrimal(lastCleaned,1,&dummyProgress);
     2101      statusOfProblemInPrimal(lastCleaned,1,&dummyProgress,true);
    19812102    else
    1982       statusOfProblemInPrimal(lastCleaned,0,&dummyProgress);
     2103      statusOfProblemInPrimal(lastCleaned,0,&dummyProgress,true);
    19832104    if (problemStatus_==5) {
    19842105      printf("Singular basis\n");
  • branches/pre/ClpSolve.cpp

    r222 r223  
    7676    presolve = ClpSolve::presolveOff;
    7777  }
     78  // For below >0 overrides
     79  // 0 means no, -1 means maybe
     80  int doIdiot=0;
     81  int doCrash=0;
     82  int doSprint=0;
     83  if (method!=ClpSolve::useDual) {
     84    switch (options.getSpecialOption(1)) {
     85    case 0:
     86      doIdiot=-1;
     87      doCrash=-1;
     88      doSprint=-1;
     89      break;
     90    case 1:
     91      doIdiot=0;
     92      doCrash=1;
     93      doSprint=0;
     94      break;
     95    case 2:
     96      doIdiot=1;
     97      doCrash=0;
     98      doSprint=0;
     99      break;
     100    case 3:
     101      doIdiot=0;
     102      doCrash=0;
     103      doSprint=1;
     104      break;
     105    case 4:
     106      doIdiot=0;
     107      doCrash=0;
     108      doSprint=0;
     109      break;
     110    case 5:
     111      doIdiot=0;
     112      doCrash=-1;
     113      doSprint=-1;
     114      break;
     115    case 6:
     116      doIdiot=-1;
     117      doCrash=-1;
     118      doSprint=0;
     119      break;
     120    case 7:
     121      doIdiot=-1;
     122      doCrash=0;
     123      doSprint=-1;
     124      break;
     125    case 8:
     126      doIdiot=-1;
     127      doCrash=0;
     128      doSprint=0;
     129      break;
     130    case 9:
     131      doIdiot=0;
     132      doCrash=0;
     133      doSprint=-1;
     134      break;
     135    default:
     136      abort();
     137    }
     138  } else {
     139    // Dual
     140    switch (options.getSpecialOption(0)) {
     141    case 0:
     142      doIdiot=0;
     143      doCrash=0;
     144      doSprint=0;
     145      break;
     146    case 1:
     147      doIdiot=0;
     148      doCrash=1;
     149      doSprint=0;
     150      break;
     151    case 2:
     152      doIdiot=-1;
     153      if (options.getExtraInfo(0)>0)
     154        doIdiot = options.getExtraInfo(0);
     155      doCrash=0;
     156      doSprint=0;
     157      break;
     158    default:
     159      abort();
     160    }
     161  }
     162  // Just do this number of passes in Sprint
     163  int maxSprintPass=100;
    78164
    79165  if (presolve!=ClpSolve::presolveOff) {
     
    92178    timeX=time2;
    93179    if (model2) {
    94       if (method==ClpSolve::useDual) {
    95         int numberInfeasibilities = model2->tightenPrimalBounds();
    96         if (numberInfeasibilities) {
    97           handler_->message(CLP_INFEASIBLE,messages_)
    98             <<CoinMessageEol;
    99           model2 = this;
    100           presolve=ClpSolve::presolveOff;
    101         }
    102       }
    103180    } else {
    104181      handler_->message(CLP_INFEASIBLE,messages_)
     
    121198  bool plusMinus=false;
    122199  int numberElements=model2->getNumElements();
    123   // For below >0 overrides
    124   // 0 means no, -1 means maybe
    125   int doIdiot=0;
    126   int doCrash=0;
    127   int doSprint=0;
    128   switch (options.getSpecialOption(1)) {
    129   case 0:
    130     doIdiot=-1;
    131     doCrash=-1;
    132     doSprint=-1;
    133     break;
    134   case 1:
    135     doIdiot=0;
    136     doCrash=1;
    137     doSprint=0;
    138     break;
    139   case 2:
    140     doIdiot=1;
    141     doCrash=0;
    142     doSprint=0;
    143     break;
    144   case 3:
    145     doIdiot=0;
    146     doCrash=0;
    147     doSprint=1;
    148     break;
    149   case 4:
    150     doIdiot=0;
    151     doCrash=0;
    152     doSprint=0;
    153     break;
    154   case 5:
    155     doIdiot=0;
    156     doCrash=-1;
    157     doSprint=-1;
    158     break;
    159   case 6:
    160     doIdiot=-1;
    161     doCrash=-1;
    162     doSprint=0;
    163     break;
    164   case 7:
    165     doIdiot=-1;
    166     doCrash=0;
    167     doSprint=-1;
    168     break;
    169   case 8:
    170     doIdiot=-1;
    171     doCrash=0;
    172     doSprint=0;
    173     break;
    174   case 9:
    175     doIdiot=0;
    176     doCrash=0;
    177     doSprint=-1;
    178     break;
    179   default:
    180     abort();
    181   }
    182200  if (dynamic_cast< ClpNetworkMatrix*>(matrix_)) {
    183201    // network - switch off stuff
     
    201219    if(numberElements>100000)
    202220      plusMinus=true;
    203     if(numberElements>10000&&((doIdiot||doSprint)&&method==ClpSolve::usePrimal))
     221    if(numberElements>10000&&(doIdiot||doSprint))
    204222      plusMinus=true;
    205223  }
     
    231249  if (method==ClpSolve::usePrimalorSprint) {
    232250    if (doSprint<0) {
    233       if(numberRows*10>numberColumns||numberColumns<6000
    234          ||(numberRows*20>numberColumns&&!plusMinus))
    235         method=ClpSolve::usePrimal; // switch off sprint
     251      if (numberElements<500000) {
     252        // Small problem
     253        if(numberRows*10>numberColumns||numberColumns<6000
     254           ||(numberRows*20>numberColumns&&!plusMinus))
     255          method=ClpSolve::usePrimal; // switch off sprint
     256      } else {
     257        // larger problem
     258        if(numberRows*8>numberColumns)
     259          method=ClpSolve::usePrimal; // switch off sprint
     260        // but make lightweight
     261        if(numberRows*10>numberColumns||numberColumns<6000
     262           ||(numberRows*20>numberColumns&&!plusMinus))
     263          maxSprintPass=5;
     264      }
    236265    } else if (doSprint==0) {
    237266      method=ClpSolve::usePrimal; // switch off sprint
     
    239268  }
    240269  if (method==ClpSolve::useDual) {
    241     if (options.getSpecialOption(0)!=0)
     270    // pick up number passes
     271    int nPasses=0;
     272    int numberNotE=0;
     273    if ((doIdiot<0&&plusMinus)||doIdiot>0) {
     274      // See if candidate for idiot
     275      nPasses=0;
     276      Idiot info(*model2);
     277      // Get average number of elements per column
     278      double ratio  = ((double) numberElements/(double) numberColumns);
     279      // look at rhs
     280      int iRow;
     281      double largest=0.0;
     282      double smallest = 1.0e30;
     283      double largestGap=0.0;
     284      for (iRow=0;iRow<numberRows;iRow++) {
     285        double value1 = model2->rowLower_[iRow];
     286        if (value1&&value1>-1.0e31) {
     287          largest = max(largest,fabs(value1));
     288          smallest=min(smallest,fabs(value1));
     289        }
     290        double value2 = model2->rowUpper_[iRow];
     291        if (value2&&value2<1.0e31) {
     292          largest = max(largest,fabs(value2));
     293          smallest=min(smallest,fabs(value2));
     294        }
     295        if (value2>value1) {
     296          numberNotE++;
     297          if (value2>1.0e31||value1<-1.0e31)
     298            largestGap = COIN_DBL_MAX;
     299          else
     300            largestGap = value2-value1;
     301        }
     302      }
     303      if (doIdiot<0) {
     304        if (numberRows>200&&numberColumns>5000&&ratio>=3.0&&
     305            largest/smallest<1.1&&!numberNotE) {
     306          nPasses = 71;
     307        }
     308      }
     309      if (doIdiot>0) {
     310        nPasses=max(nPasses,doIdiot);
     311        if (nPasses>70)
     312          info.setStartingWeight(1.0e3);
     313      }
     314      if (nPasses) {
     315        info.setReduceIterations(5);
     316        doCrash=0;
     317        info.crash(nPasses,model2->messageHandler(),model2->messagesPointer());
     318        time2 = CoinCpuTime();
     319        timeIdiot = time2-timeX;
     320        handler_->message(CLP_INTERVAL_TIMING,messages_)
     321          <<"Idiot Crash"<<timeIdiot<<time2-time1
     322          <<CoinMessageEol;
     323        timeX=time2;
     324      }
     325    }
     326    int numberInfeasibilities = model2->tightenPrimalBounds();
     327    if (numberInfeasibilities) {
     328      handler_->message(CLP_INFEASIBLE,messages_)
     329        <<CoinMessageEol;
     330      model2 = this;
     331      presolve=ClpSolve::presolveOff;
     332    }
     333    if (options.getSpecialOption(0)==1)
    242334      model2->crash(1000,1);
    243     model2->dual();
     335    if (!nPasses) {
     336      model2->dual(0);
     337    } else if (!numberNotE&&0) {
     338      // E so we can do in another way
     339      double * pi = model2->dualRowSolution();
     340      int i;
     341      int numberColumns = model2->numberColumns();
     342      int numberRows = model2->numberRows();
     343      double * saveObj = new double[numberColumns];
     344      memcpy(saveObj,model2->objective(),numberColumns*sizeof(double));
     345      memcpy(model2->dualColumnSolution(),model2->objective(),
     346             numberColumns*sizeof(double));
     347      model2->clpMatrix()->transposeTimes(-1.0,pi,model2->dualColumnSolution());
     348      memcpy(model2->objective(),model2->dualColumnSolution(),
     349             numberColumns*sizeof(double));
     350      const double * rowsol = model2->primalRowSolution();
     351      double offset=0.0;
     352      for (i=0;i<numberRows;i++) {
     353        offset += pi[i]*rowsol[i];
     354      }
     355      double value2;
     356      model2->getDblParam(ClpObjOffset,value2);
     357      printf("Offset %g %g\n",offset,value2);
     358      model2->setRowObjective(pi);
     359      // zero out pi
     360      memset(pi,0,numberRows*sizeof(double));
     361      // Could put some in basis - only partially tested
     362      model2->allSlackBasis();
     363      model2->factorization()->maximumPivots(200);
     364      //model2->setLogLevel(63);
     365      // solve
     366      model2->dual(1);
     367      memcpy(model2->objective(),saveObj,numberColumns*sizeof(double));
     368      // zero out pi
     369      memset(pi,0,numberRows*sizeof(double));
     370      model2->setRowObjective(pi);
     371      delete [] saveObj;
     372      model2->primal();
     373    } else {
     374      // solve
     375      model2->dual(1);
     376    }
    244377    time2 = CoinCpuTime();
    245378    timeCore = time2-timeX;
     
    362495          info.setStartingWeight(1.0e3);
    363496          info.setReduceIterations(6);
     497        } else if (nPasses>=50) {
     498          info.setStartingWeight(1.0e3);
     499          //info.setReduceIterations(6);
     500        }
     501        // For experimenting
     502        if (nPasses<70&&(nPasses%10)>0&&(nPasses%10)<4) {
     503          info.setStartingWeight(1.0e3);
     504          info.setLightweight(nPasses%10); // special testing
     505          //info.setReduceIterations(6);
    364506        }
    365507      }
     
    379521    if (doCrash)
    380522      model2->crash(1000,1);
    381     model2->primal(2);
     523    model2->primal(1);
    382524    time2 = CoinCpuTime();
    383525    timeCore = time2-timeX;
     
    528670    double * fullSolution = model2->primalColumnSolution();
    529671   
    530     // Just do this number of passes
    531     int maxPass=100;
     672    // Just do this number of passes in Sprint
    532673    if (doSprint>0)
    533       maxPass=options.getExtraInfo(1);
     674      maxSprintPass=options.getExtraInfo(1);
    534675    int iPass;
    535676    double lastObjective=1.0e31;
     
    550691    model2->getDblParam(ClpObjOffset,originalOffset);
    551692    int totalIterations=0;
    552     for (iPass=0;iPass<maxPass;iPass++) {
     693    for (iPass=0;iPass<maxSprintPass;iPass++) {
    553694      //printf("Bug until submodel new version\n");
    554695      //CoinSort_2(sort,sort+numberSort,weight);
     
    632773      if ((small.objectiveValue()*optimizationDirection_>lastObjective-1.0e-7&&iPass>5)||
    633774          !small.numberIterations()||
    634           iPass==maxPass-1||small.status()==3) {
     775          iPass==maxSprintPass-1||small.status()==3) {
    635776       
    636777        break; // finished
  • branches/pre/IdiSolve.cpp

    r210 r223  
    267267        costExtra[extraBlock]=lambda[i]*value;
    268268        upperExtra[extraBlock]=difference;
     269        rowsol[i]+=value*solExtra[extraBlock];
    269270        rowExtra[extraBlock++]=i;
    270         rowsol[i]+=value*solExtra[extraBlock];
    271271      }
    272272    }
  • branches/pre/Idiot.cpp

    r221 r223  
    133133  if (!lightWeight_) {
    134134    maxIts2_=105;
     135  } else if (lightWeight_==1) {
     136    mu_ *= 10.0;
     137    maxIts2_=23;
     138  } else if (lightWeight_==2) {
     139    maxIts2_=11;
    135140  } else {
    136     mu_ *= 10.0;
    137141    maxIts2_=23;
    138142  }
     
    412416    if (iteration>50&&n==numberAway&&result.infeas<1.0e-4)
    413417      break; // not much happening
    414     if (lightWeight_&&iteration>10&&result.infeas>1.0) {
     418    if (lightWeight_==1&&iteration>10&&result.infeas>1.0) {
    415419      if (lastInfeas!=bestInfeas&&min(result.infeas,lastInfeas)>0.95*bestInfeas)
    416420        break; // not getting feasible
     
    987991  maxIts2_ =200+baseIts+5;
    988992  reasonableInfeas_ =((double) nrows)*0.05;
     993  lightWeight_=0;
    989994}
    990995// Constructor from model
     
    10251030  maxIts2_ =200+baseIts+5;
    10261031  reasonableInfeas_ =((double) nrows)*0.05;
     1032  lightWeight_=0;
    10271033}
    10281034// Copy constructor.
     
    10581064  maxIts2_ = rhs.maxIts2_;
    10591065  strategy_ = rhs.strategy_;
     1066  lightWeight_=rhs.lightWeight_;
    10601067}
    10611068// Assignment operator. This copies the data
     
    10941101    maxIts2_ = rhs.maxIts2_;
    10951102    strategy_ = rhs.strategy_;
     1103    lightWeight_=rhs.lightWeight_;
    10961104  }
    10971105  return *this;
  • branches/pre/Makefile.Clp

    r222 r223  
    77# between then specify the exact level you want, e.g., -O1 or -O2
    88OptLevel := -g
    9 #OptLevel := -O1
     9OptLevel := -O1
    1010
    1111LIBNAME := Clp
  • branches/pre/Samples/Makefile.driver

    r91 r223  
    6060endif
    6161
     62ifeq (${DENSE},yes)
     63#if DENSE and using given libraries
     64LDFLAGS += -llapack -lblas -lg2c
     65endif
     66
     67
    6268###############################################################################
    6369
  • branches/pre/Samples/driver2.cpp

    r222 r223  
    2828  double time1 = CoinCpuTime();
    2929  /*
    30     This driver show how to do presolve.
     30    This driver shows how to do presolve.
    3131  */
    3232  ClpSimplex * model2;
  • branches/pre/Samples/useVolume.cpp

    r221 r223  
    211211    }
    212212  }
     213  // Can't use read_param as private
     214  // anyway I want automatic use - so maybe this is problem
    213215#if 0
    214216  FILE* infile = fopen("parameters", "r");
     
    219221  }
    220222#endif
    221   // should save and restore
     223#if 0
     224  // should save and restore bounds
    222225  model.tightenPrimalBounds();
     226#else
     227  double * colUpper = model.columnUpper();
     228  for (i=0;i<psize;i++)
     229    colUpper[i]=1.0;
     230#endif
    223231  lpHook myHook(model.getColLower(), model.getColUpper(),
    224232                model.getObjCoefficients(),
    225233                rhs, sense, *mat);
    226 
    227234  // move duals
    228235  double * pi = model.dualRowSolution();
    229236  memcpy(volprob.dsol.v,pi,dsize*sizeof(double));
    230237  volprob.solve(myHook,  false /* not warmstart */);
     238  // For now stop as not doing any good
     239  exit(77);
    231240  // create objectives
    232241  int numberRows = model.numberRows();
  • branches/pre/Test/ClpMain.cpp

    r221 r223  
    11731173    parameters[numberParameters-1].append("steep!est");
    11741174    parameters[numberParameters-1].append("change");
     1175    parameters[numberParameters-1].append("sprint");
    11751176    parameters[numberParameters-1].setLonghelp
    11761177      (
     
    12541255    parameters[numberParameters++]=
    12551256      ClpItem("scal!ing","Whether to scale problem",
    1256               "on",SCALING);
    1257     parameters[numberParameters-1].append("off");
     1257              "off",SCALING);
     1258    parameters[numberParameters-1].append("equi!librium");
    12581259    parameters[numberParameters-1].append("geo!metric");
    12591260    parameters[numberParameters-1].append("auto!matic");
     
    12651266 infeasibilities."
    12661267       );
     1268    parameters[numberParameters-1].setCurrentOption(3); // say auto
    12671269    parameters[numberParameters++]=
    12681270      ClpItem("sec!onds","maximum seconds",
     
    15211523                ClpPrimalColumnSteepest steep(4);
    15221524                models[iModel].setPrimalColumnPivotAlgorithm(steep);
     1525              } else if (action==6) {
     1526                ClpPrimalColumnSteepest steep(10);
     1527                models[iModel].setPrimalColumnPivotAlgorithm(steep);
    15231528              }
    15241529              break;
    15251530            case SCALING:
    1526               if (action<2)
    1527                 models[iModel].scaling(1-action);
    1528               else
    1529                 models[iModel].scaling(action);
     1531              models[iModel].scaling(action);
    15301532              break;
    15311533            case SPARSEFACTOR:
     
    15931595                if (doCrash)
    15941596                  solveOptions.setSpecialOption(0,1); // crash
     1597                else if (doIdiot)
     1598                  solveOptions.setSpecialOption(0,2,doIdiot); // possible idiot
    15951599              } else {
    15961600                // primal
  • branches/pre/include/ClpMatrixBase.hpp

    r213 r223  
    9999                                  double smallest, double largest)
    100100  { return true;};
     101  /** Returns largest and smallest elements of both signs.
     102      Largest refers to largest absolute value.
     103      If returns zeros then can't tell anything */
     104  virtual void rangeOfElements(double & smallestNegative, double & largestNegative,
     105                       double & smallestPositive, double & largestPositive);
    101106
    102107  /** Unpacks a column into an CoinIndexedvector
  • branches/pre/include/ClpNetworkMatrix.hpp

    r207 r223  
    7575  */
    7676  virtual CoinBigIndex * dubiousWeights(const ClpSimplex * model,int * inputWeights) const;
     77  /** Returns largest and smallest elements of both signs.
     78      Largest refers to largest absolute value.
     79  */
     80  virtual void rangeOfElements(double & smallestNegative, double & largestNegative,
     81                       double & smallestPositive, double & largestPositive);
    7782  /** Unpacks a column into an CoinIndexedvector
    7883   */
     
    8085                   int column) const ;
    8186  /** Unpacks a column into an CoinIndexedvector
    82    ** in packed foramt
     87   ** in packed format
    8388      Note that model is NOT const.  Bounds and objective could
    8489      be modified if doing column generation (just for this variable) */
  • branches/pre/include/ClpPackedMatrix.hpp

    r213 r223  
    9999  virtual bool allElementsInRange(ClpModel * model,
    100100                                  double smallest, double largest);
     101  /** Returns largest and smallest elements of both signs.
     102      Largest refers to largest absolute value.
     103  */
     104  virtual void rangeOfElements(double & smallestNegative, double & largestNegative,
     105                       double & smallestPositive, double & largestPositive);
    101106
    102107  /** Unpacks a column into an CoinIndexedvector
  • branches/pre/include/ClpPlusMinusOneMatrix.hpp

    r210 r223  
    7777  */
    7878  virtual CoinBigIndex * dubiousWeights(const ClpSimplex * model,int * inputWeights) const;
     79  /** Returns largest and smallest elements of both signs.
     80      Largest refers to largest absolute value.
     81  */
     82  virtual void rangeOfElements(double & smallestNegative, double & largestNegative,
     83                       double & smallestPositive, double & largestPositive);
    7984  /** Unpacks a column into an CoinIndexedvector
    8085   */
  • branches/pre/include/ClpPrimalColumnPivot.hpp

    r222 r223  
    112112      Also number of iterations before recompute
    113113  */
    114   int numberSprintColumns(int & numberIterations) const;
     114  virtual int numberSprintColumns(int & numberIterations) const;
    115115  /// Switch off sprint idea
    116   void switchOffSprint();
     116  virtual void switchOffSprint();
    117117 
    118118  //@}
  • branches/pre/include/ClpPrimalColumnSteepest.hpp

    r222 r223  
    113113      Also number of iterations before recompute
    114114  */
    115   int numberSprintColumns(int & numberIterations) const;
     115  virtual int numberSprintColumns(int & numberIterations) const;
    116116  /// Switch off sprint idea
    117   void switchOffSprint();
     117  virtual void switchOffSprint();
    118118 
    119119 //@}
     
    190190      By partial exact devex is meant that the weights are updated as normal
    191191      but only part of the nonbasic variables are scanned. 
    192       This can be faster on very easy problems.*/
     192      This can be faster on very easy problems.
     193
     194      New dubious option is >=10 which does mini-sprint
     195  */
    193196  int mode_;
    194197  /// Number of times switched from partial dantzig to 0/2
  • branches/pre/include/ClpSimplex.hpp

    r222 r223  
    6161    isFixed = 0x05
    6262  };
    63 
     63  // For Dual
    6464  enum FakeBound {
    6565    noFake = 0x00,
     
    705705  inline bool pivoted(int sequence) const
    706706  {return (((status_[sequence]>>5)&1)!=0);};
     707  /// To flag a variable
    707708  inline void setFlagged( int sequence)
    708709  {
     
    714715  };
    715716  inline bool flagged(int sequence) const
    716   {return (((status_[sequence]>>6)&1)!=0);};
     717  {return ((status_[sequence]&64)!=0);};
     718  /// To say variable active in primal pivot row choice
     719  inline void setActive( int sequence)
     720  {
     721    status_[sequence] |= 128;
     722  };
     723  inline void clearActive( int sequence)
     724  {
     725    status_[sequence] &= ~128;
     726  };
     727  inline bool active(int sequence) const
     728  {return ((status_[sequence]&128)!=0);};
    717729  /** Set up status array (can be used by OsiClp).
    718730      Also can be used to set up all slack basis */
  • branches/pre/include/ClpSimplexPrimal.hpp

    r222 r223  
    210210            - 1 normal -if good update save
    211211            - 2 restoring from saved
    212        originalModel is normally NULL but may not be if doing Sprint
     212       saveModel is normally NULL but may not be if doing Sprint
    213213  */
    214214  void statusOfProblemInPrimal(int & lastCleaned, int type,
    215215                             ClpSimplexProgress * progress,
    216                                ClpSimplex * originalModel=NULL);
     216                               bool doFactorization,
     217                               ClpSimplex * saveModel=NULL);
    217218  /// Perturbs problem (method depends on perturbation())
    218219  void perturb(int type);
  • branches/pre/include/ClpSolve.hpp

    r210 r223  
    5959      which:
    6060      0 - startup in Dual  (nothing if basis exists).:
    61                    0 - no basis, 1 crash
     61                   0 - no basis
     62                   1 - crash
     63                   2 - use initiative about idiot! but no crash
    6264      1 - startup in Primal (nothing if basis exists):
    6365                   0 - use initiative
  • branches/pre/include/Idiot.hpp

    r212 r223  
    144144  inline void setLogLevel(int value)
    145145  { logLevel_ = value;};
    146   /// How lightweight - 0 not, 1 yes
     146  /// How lightweight - 0 not, 1 yes, 2 very lightweight
    147147  inline int getLightweight() const
    148148  { return lightWeight_;};
Note: See TracChangeset for help on using the changeset viewer.