Changeset 2024 for trunk


Ignore:
Timestamp:
Mar 7, 2014 12:18:15 PM (6 years ago)
Author:
forrest
Message:

changes to abc

Location:
trunk/Clp/src
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/Clp/src/AbcMatrix.cpp

    r1910 r2024  
    144144  minimumGoodReducedCosts_ = -1;
    145145}
    146 
     146#ifdef ABC_SPRINT
     147/* Subset constructor (without gaps). */
     148AbcMatrix::AbcMatrix (const AbcMatrix & wholeMatrix,
     149                      int numberRows, const int * whichRows,
     150                      int numberColumns, const int * whichColumns)
     151{
     152#ifndef COIN_SPARSE_MATRIX
     153  matrix_ = new CoinPackedMatrix(*wholeMatrix.matrix_,numberRows,whichRows,
     154                                 numberColumns,whichColumns);
     155#else
     156  matrix_ = new CoinPackedMatrix(rhs, -0, -0);
     157  abort();
     158#endif
     159  matrix_->cleanMatrix();
     160  model_=NULL;
     161  rowStart_ = NULL;
     162  element_ = NULL;
     163  column_ = NULL;
     164#ifdef COUNT_COPY
     165  countRealColumn_ = NULL;
     166  countStartLarge_ = NULL;
     167  countRow_ = NULL;
     168  countElement_ = NULL;
     169  smallestCount_ = 0;
     170  largestCount_ = 0;
     171#endif
     172  numberColumnBlocks_=1;
     173  startColumnBlock_[0]=0;
     174  startColumnBlock_[1]=0;
     175  numberRowBlocks_ = 0;
     176  startFraction_ = 0;
     177  endFraction_ = 1.0;
     178  savedBestDj_ = 0;
     179  originalWanted_ = 0;
     180  currentWanted_ = 0;
     181  savedBestSequence_ = -1;
     182  minimumObjectsScan_ = -1;
     183  minimumGoodReducedCosts_ = -1;
     184}
     185#endif
    147186//-------------------------------------------------------------------
    148187// Destructor
     
    31503189   int maximumRows=model_->maximumAbcNumberRows();
    31513190   int number=updateForTableauRow.getNumElements();
    3152    assert (number);
     3191   // was assert (number);
     3192   if (!number) {
     3193     printf("Null tableau row!\n");
     3194   }
    31533195   bool useRowCopy = (gotRowCopy()&&(number<<2)<maximumRows);
    31543196   //useRowCopy=false;
  • trunk/Clp/src/AbcNonLinearCost.hpp

    r1910 r2024  
    4141#define CLP_ABOVE_UPPER 2
    4242#define CLP_SAME 4
     43#ifndef ClpNonLinearCost_H
    4344inline int originalStatus(unsigned char status)
    4445{
     
    6869  status = static_cast<unsigned char>(status | (CLP_SAME << 4));
    6970}
     71#endif
    7072class AbcNonLinearCost  {
    7173 
  • trunk/Clp/src/AbcSimplex.cpp

    r2015 r2024  
    522522  }
    523523}
     524#ifdef ABC_SPRINT
     525// Overwrite to create sub problem (just internal arrays) - save full stuff
     526AbcSimplex *
     527AbcSimplex::createSubProblem(int numberColumns,const int * whichColumn)
     528{
     529  int numberFullColumns = numberColumns_;
     530  numberColumns_ = numberColumns;
     531  AbcSimplex * subProblem = this;
     532  AbcSimplex * fullProblem = reinterpret_cast<AbcSimplex *>(new char[sizeof(AbcSimplex)]);
     533  memset(fullProblem,0,sizeof(AbcSimplex));
     534  fullProblem->maximumAbcNumberRows_ = maximumAbcNumberRows_;
     535  fullProblem->numberColumns_ = numberFullColumns;
     536  fullProblem->numberTotal_ = numberTotal_;
     537  fullProblem->maximumNumberTotal_ = maximumNumberTotal_;
     538  fullProblem->numberTotalWithoutFixed_ = numberTotalWithoutFixed_;
     539  fullProblem->abcPrimalColumnPivot_ =   abcPrimalColumnPivot_;
     540  fullProblem->internalStatus_ =   internalStatus_;
     541  fullProblem->abcLower_ =   abcLower_;
     542  fullProblem->abcUpper_ =   abcUpper_;
     543  fullProblem->abcCost_ =   abcCost_;
     544  fullProblem->abcDj_ =   abcDj_;
     545  fullProblem->abcSolution_ =   abcSolution_;
     546  fullProblem->scaleFromExternal_ =   scaleFromExternal_;
     547  fullProblem->offset_ =   offset_;
     548  fullProblem->abcPerturbation_ =   abcPerturbation_;
     549  fullProblem->abcPivotVariable_ =   abcPivotVariable_;
     550  fullProblem->abcMatrix_ =   abcMatrix_;
     551  fullProblem->abcNonLinearCost_ = abcNonLinearCost_;
     552  fullProblem->setupPointers(maximumAbcNumberRows_,numberFullColumns);
     553  subProblem->numberTotal_= maximumAbcNumberRows_+numberColumns;
     554  subProblem->maximumNumberTotal_= maximumAbcNumberRows_+numberColumns;
     555  subProblem->numberTotalWithoutFixed_= subProblem->numberTotal_;
     556  int sizeArray=2*subProblem->maximumNumberTotal_+maximumAbcNumberRows_;
     557  subProblem->internalStatus_ = newArray(reinterpret_cast<unsigned char *>(NULL),
     558                                         sizeArray+subProblem->maximumNumberTotal_);
     559  subProblem->abcLower_ = newArray(reinterpret_cast<double *>(NULL),sizeArray);
     560  subProblem->abcUpper_ = newArray(reinterpret_cast<double *>(NULL),sizeArray);
     561  subProblem->abcCost_ = newArray(reinterpret_cast<double *>(NULL),sizeArray+subProblem->maximumNumberTotal_);
     562  subProblem->abcDj_ = newArray(reinterpret_cast<double *>(NULL),sizeArray);
     563  subProblem->abcSolution_ = newArray(reinterpret_cast<double *>(NULL),sizeArray+subProblem->maximumNumberTotal_);
     564  //fromExternal_ = newArray(reinterpret_cast<int *>(NULL),sizeArray);
     565  //toExternal_ = newArray(reinterpret_cast<int *>(NULL),sizeArray);
     566  subProblem->scaleFromExternal_ = newArray(reinterpret_cast<double *>(NULL),sizeArray);
     567  subProblem->offset_ = newArray(reinterpret_cast<double *>(NULL),sizeArray);
     568  subProblem->abcPerturbation_ = newArray(reinterpret_cast<double *>(NULL),sizeArray);
     569  subProblem->abcPivotVariable_ = newArray(reinterpret_cast<int *>(NULL),maximumAbcNumberRows_);
     570  subProblem->setupPointers(maximumAbcNumberRows_,numberColumns);
     571  // could use arrays - but for now be safe
     572  int * backward = new int [numberFullColumns+numberRows_];
     573  int * whichRow = backward+numberFullColumns;
     574  for (int i=0;i<numberFullColumns;i++)
     575    backward[i]=-1;
     576  for (int i=0;i<numberColumns;i++)
     577    backward[whichColumn[i]]=i+numberRows_;
     578  for (int i=0;i<numberRows_;i++) {
     579    whichRow[i]=i;
     580    int iPivot = fullProblem->abcPivotVariable_[i];
     581    if (iPivot<numberRows_) {
     582      subProblem->abcPivotVariable_[i]=iPivot;
     583    } else {
     584      assert(backward[iPivot-numberRows_]>=0);
     585      subProblem->abcPivotVariable_[i]=backward[iPivot-numberRows_];
     586    }
     587    subProblem->internalStatus_[i] = fullProblem->internalStatus_[i];
     588    subProblem->abcLower_[i] = fullProblem->abcLower_[i];
     589    subProblem->abcUpper_[i] = fullProblem->abcUpper_[i];
     590    subProblem->abcCost_[i] = fullProblem->abcCost_[i];
     591    subProblem->abcDj_[i] = fullProblem->abcDj_[i];
     592    subProblem->abcSolution_[i] = fullProblem->abcSolution_[i];
     593    subProblem->abcPerturbation_[i] = fullProblem->abcPerturbation_[i];
     594    subProblem->internalStatusSaved_[i] = fullProblem->internalStatusSaved_[i];
     595    subProblem->perturbationSaved_[i] = fullProblem->perturbationSaved_[i];
     596    subProblem->lowerSaved_[i] = fullProblem->lowerSaved_[i];
     597    subProblem->upperSaved_[i] = fullProblem->upperSaved_[i];
     598    subProblem->costSaved_[i] = fullProblem->costSaved_[i];
     599    subProblem->djSaved_[i] = fullProblem->djSaved_[i];
     600    subProblem->solutionSaved_[i] = fullProblem->solutionSaved_[i];
     601    subProblem->offset_[i] = fullProblem->offset_[i];
     602    subProblem->lowerBasic_[i] = fullProblem->lowerBasic_[i];
     603    subProblem->upperBasic_[i] = fullProblem->upperBasic_[i];
     604    subProblem->costBasic_[i] = fullProblem->costBasic_[i];
     605    subProblem->solutionBasic_[i] = fullProblem->solutionBasic_[i];
     606    subProblem->djBasic_[i] = fullProblem->djBasic_[i];
     607  }
     608  for (int i=0;i<numberColumns;i++) {
     609    int k=whichColumn[i];
     610    subProblem->internalStatus_[maximumAbcNumberRows_+i] =
     611      fullProblem->internalStatus_[maximumAbcNumberRows_+k];
     612    subProblem->internalStatus_[maximumAbcNumberRows_+i] = fullProblem->internalStatus_[maximumAbcNumberRows_+k];
     613    subProblem->abcLower_[maximumAbcNumberRows_+i] = fullProblem->abcLower_[maximumAbcNumberRows_+k];
     614    subProblem->abcUpper_[maximumAbcNumberRows_+i] = fullProblem->abcUpper_[maximumAbcNumberRows_+k];
     615    subProblem->abcCost_[maximumAbcNumberRows_+i] = fullProblem->abcCost_[maximumAbcNumberRows_+k];
     616    subProblem->abcDj_[maximumAbcNumberRows_+i] = fullProblem->abcDj_[maximumAbcNumberRows_+k];
     617    subProblem->abcSolution_[maximumAbcNumberRows_+i] = fullProblem->abcSolution_[maximumAbcNumberRows_+k];
     618    subProblem->abcPerturbation_[maximumAbcNumberRows_+i] = fullProblem->abcPerturbation_[maximumAbcNumberRows_+k];
     619    subProblem->internalStatusSaved_[maximumAbcNumberRows_+i] = fullProblem->internalStatusSaved_[maximumAbcNumberRows_+k];
     620    subProblem->perturbationSaved_[maximumAbcNumberRows_+i] = fullProblem->perturbationSaved_[maximumAbcNumberRows_+k];
     621    subProblem->lowerSaved_[maximumAbcNumberRows_+i] = fullProblem->lowerSaved_[maximumAbcNumberRows_+k];
     622    subProblem->upperSaved_[maximumAbcNumberRows_+i] = fullProblem->upperSaved_[maximumAbcNumberRows_+k];
     623    subProblem->costSaved_[maximumAbcNumberRows_+i] = fullProblem->costSaved_[maximumAbcNumberRows_+k];
     624    subProblem->djSaved_[maximumAbcNumberRows_+i] = fullProblem->djSaved_[maximumAbcNumberRows_+k];
     625    subProblem->solutionSaved_[maximumAbcNumberRows_+i] = fullProblem->solutionSaved_[maximumAbcNumberRows_+k];
     626    subProblem->offset_[maximumAbcNumberRows_+i] = fullProblem->offset_[maximumAbcNumberRows_+k];
     627  }
     628  subProblem->abcNonLinearCost_=new AbcNonLinearCost(subProblem);
     629  subProblem->abcNonLinearCost_->checkInfeasibilities(0.0);
     630  subProblem->abcMatrix_ = new AbcMatrix(*fullProblem->abcMatrix_,numberRows_,whichRow,
     631                                         numberColumns,whichColumn);
     632  subProblem->abcMatrix_->setModel(subProblem);
     633  subProblem->abcMatrix_->rebalance();
     634  subProblem->abcPrimalColumnPivot_ = new AbcPrimalColumnSteepest();
     635  subProblem->abcPrimalColumnPivot_->saveWeights(subProblem,2);
     636  delete [] backward;
     637  // swap
     638  return fullProblem;
     639}
     640// Restore stuff from sub problem (and delete sub problem)
     641void
     642AbcSimplex::restoreFromSubProblem(AbcSimplex * fullProblem, const int * whichColumn)
     643{
     644  AbcSimplex * subProblem = this;
     645  for (int i=0;i<numberRows_;i++) {
     646    int iPivot = subProblem->abcPivotVariable_[i];
     647    if (iPivot<numberRows_) {
     648      fullProblem->abcPivotVariable_[i]=iPivot;
     649    } else {
     650      fullProblem->abcPivotVariable_[i]=whichColumn[iPivot-numberRows_]+numberRows_;
     651    }
     652    fullProblem->internalStatus_[i] = subProblem->internalStatus_[i];
     653    fullProblem->abcLower_[i] = subProblem->abcLower_[i];
     654    fullProblem->abcUpper_[i] = subProblem->abcUpper_[i];
     655    fullProblem->abcCost_[i] = subProblem->abcCost_[i];
     656    fullProblem->abcDj_[i] = subProblem->abcDj_[i];
     657    fullProblem->abcSolution_[i] = subProblem->abcSolution_[i];
     658    fullProblem->abcPerturbation_[i] = subProblem->abcPerturbation_[i];
     659    fullProblem->internalStatusSaved_[i] = subProblem->internalStatusSaved_[i];
     660    fullProblem->perturbationSaved_[i] = subProblem->perturbationSaved_[i];
     661    fullProblem->lowerSaved_[i] = subProblem->lowerSaved_[i];
     662    fullProblem->upperSaved_[i] = subProblem->upperSaved_[i];
     663    fullProblem->costSaved_[i] = subProblem->costSaved_[i];
     664    fullProblem->djSaved_[i] = subProblem->djSaved_[i];
     665    fullProblem->solutionSaved_[i] = subProblem->solutionSaved_[i];
     666    fullProblem->offset_[i] = subProblem->offset_[i];
     667    fullProblem->lowerBasic_[i] = subProblem->lowerBasic_[i];
     668    fullProblem->upperBasic_[i] = subProblem->upperBasic_[i];
     669    fullProblem->costBasic_[i] = subProblem->costBasic_[i];
     670    fullProblem->solutionBasic_[i] = subProblem->solutionBasic_[i];
     671    fullProblem->djBasic_[i] = subProblem->djBasic_[i];
     672  }
     673  int numberColumns = subProblem->numberColumns_;
     674  for (int i=0;i<numberColumns;i++) {
     675    int k=whichColumn[i];
     676    fullProblem->internalStatus_[maximumAbcNumberRows_+k] = subProblem->internalStatus_[maximumAbcNumberRows_+i];
     677    fullProblem->abcLower_[maximumAbcNumberRows_+k] = subProblem->abcLower_[maximumAbcNumberRows_+i];
     678    fullProblem->abcUpper_[maximumAbcNumberRows_+k] = subProblem->abcUpper_[maximumAbcNumberRows_+i];
     679    fullProblem->abcCost_[maximumAbcNumberRows_+k] = subProblem->abcCost_[maximumAbcNumberRows_+i];
     680    fullProblem->abcDj_[maximumAbcNumberRows_+k] = subProblem->abcDj_[maximumAbcNumberRows_+i];
     681    fullProblem->abcSolution_[maximumAbcNumberRows_+k] = subProblem->abcSolution_[maximumAbcNumberRows_+i];
     682    fullProblem->abcPerturbation_[maximumAbcNumberRows_+k] = subProblem->abcPerturbation_[maximumAbcNumberRows_+i];
     683    fullProblem->internalStatusSaved_[maximumAbcNumberRows_+k] = subProblem->internalStatusSaved_[maximumAbcNumberRows_+i];
     684    fullProblem->perturbationSaved_[maximumAbcNumberRows_+k] = subProblem->perturbationSaved_[maximumAbcNumberRows_+i];
     685    fullProblem->lowerSaved_[maximumAbcNumberRows_+k] = subProblem->lowerSaved_[maximumAbcNumberRows_+i];
     686    fullProblem->upperSaved_[maximumAbcNumberRows_+k] = subProblem->upperSaved_[maximumAbcNumberRows_+i];
     687    fullProblem->costSaved_[maximumAbcNumberRows_+k] = subProblem->costSaved_[maximumAbcNumberRows_+i];
     688    fullProblem->djSaved_[maximumAbcNumberRows_+k] = subProblem->djSaved_[maximumAbcNumberRows_+i];
     689    fullProblem->solutionSaved_[maximumAbcNumberRows_+k] = subProblem->solutionSaved_[maximumAbcNumberRows_+i];
     690    fullProblem->offset_[maximumAbcNumberRows_+k] = subProblem->offset_[maximumAbcNumberRows_+i];
     691  }
     692  delete [] subProblem->internalStatus_;
     693  delete [] subProblem->abcPerturbation_;
     694  delete subProblem->abcMatrix_;
     695  delete [] subProblem->abcLower_;
     696  delete [] subProblem->abcUpper_;
     697  delete [] subProblem->abcCost_;
     698  delete [] subProblem->abcSolution_;
     699  delete [] subProblem->abcDj_;
     700  delete subProblem->abcPrimalColumnPivot_;
     701  delete [] subProblem->scaleFromExternal_;
     702  delete [] subProblem->offset_;
     703  delete [] subProblem->abcPivotVariable_;
     704  delete [] subProblem->reversePivotVariable_;
     705  delete subProblem->abcNonLinearCost_;
     706  numberColumns_ = fullProblem->numberColumns_;
     707  numberTotal_ =   fullProblem->numberTotal_;
     708  maximumNumberTotal_ =   fullProblem->maximumNumberTotal_;
     709  numberTotalWithoutFixed_ =   fullProblem->numberTotalWithoutFixed_;
     710  abcPrimalColumnPivot_ =   fullProblem->abcPrimalColumnPivot_;
     711  internalStatus_ =   fullProblem->internalStatus_;
     712  abcLower_ =   fullProblem->abcLower_;
     713  abcUpper_ =   fullProblem->abcUpper_;
     714  abcCost_ =   fullProblem->abcCost_;
     715  abcDj_ =   fullProblem->abcDj_;
     716  abcSolution_ =   fullProblem->abcSolution_;
     717  scaleFromExternal_ =   fullProblem->scaleFromExternal_;
     718  offset_ =   fullProblem->offset_;
     719  abcPerturbation_ =   fullProblem->abcPerturbation_;
     720  abcPivotVariable_ =   fullProblem->abcPivotVariable_;
     721  abcMatrix_ =   fullProblem->abcMatrix_;
     722  setupPointers(maximumAbcNumberRows_,numberColumns);
     723  // ? redo nonlinearcost
     724  abcNonLinearCost_ = fullProblem->abcNonLinearCost_;
     725  abcNonLinearCost_->refresh();
     726  delete [] reinterpret_cast<char *>(fullProblem);
     727}
     728#endif
    524729/* Sets dual values pass djs using unscaled duals
    525730   type 1 - values pass
     
    9951200#endif
    9961201#endif
     1202  // *** replace below by cleanStatus
    9971203  for (int iSequence = 0; iSequence < numberTotal_; iSequence++) {
    9981204    AbcSimplex::Status status=getInternalStatus(iSequence);
     
    10501256  }
    10511257  return status;
     1258}
     1259// Make sure no superbasic etc
     1260void
     1261AbcSimplex::cleanStatus(bool valuesPass)
     1262{
     1263  for (int iSequence = 0; iSequence < numberTotal_; iSequence++) {
     1264    AbcSimplex::Status status=getInternalStatus(iSequence);
     1265    if (status!= basic&&status!=isFixed&&abcUpper_[iSequence] == abcLower_[iSequence])
     1266      setInternalStatus(iSequence,isFixed);
     1267  }
     1268  if (numberIterations_==baseIteration_&&!valuesPass) {
     1269    double largeValue = this->largeValue();
     1270    double * COIN_RESTRICT solution = abcSolution_;
     1271    for (int iSequence = 0; iSequence < numberTotal_; iSequence++) {
     1272      AbcSimplex::Status status=getInternalStatus(iSequence);
     1273      if (status== superBasic) {
     1274        double lower = abcLower_[iSequence];
     1275        double upper = abcUpper_[iSequence];
     1276        double value = solution[iSequence];
     1277        AbcSimplex::Status thisStatus=isFree;
     1278        if (lower > -largeValue || upper < largeValue) {
     1279          if (lower!=upper) {
     1280            if (fabs(value - lower) < fabs(value - upper)) {
     1281              thisStatus=AbcSimplex::atLowerBound;
     1282              solution[iSequence] = lower;
     1283            } else {
     1284              thisStatus= AbcSimplex::atUpperBound;
     1285              solution[iSequence] = upper;
     1286            }
     1287          } else {
     1288            thisStatus= AbcSimplex::isFixed;
     1289            solution[iSequence] = upper;
     1290          }
     1291          setInternalStatus(iSequence,thisStatus);
     1292        }
     1293      }
     1294    }
     1295  }
    10521296}
    10531297// Sets objectiveValue_ from rawObjectiveValue_
     
    39754219    //set to force crossover test returnCode=1;
    39764220    abcSimplex_->permuteOut(ROW_PRIMAL_OK|ROW_DUAL_OK|COLUMN_PRIMAL_OK|COLUMN_DUAL_OK|ALL_STATUS_OK);
    3977     if (returnCode) {
     4221    if (returnCode && problemStatus_ < 3) {
    39784222      // fix as this model is all messed up e.g. scaling
    39794223     scalingFlag_ = abs(scalingFlag_);
     
    40074251     }
    40084252     //problemStatus_=-1;
    4009      if (status!=3&&status!=0) {
     4253     if (status<3&&status!=0) {
    40104254       if (status!=10) {
    40114255         primal(); // Do ClpSimplexPrimal
     
    40944338      perturbation_=101;
    40954339    baseIteration_=numberIterations_;
     4340    // make sure no superbasic
     4341    cleanStatus();
    40964342    if ((specialOptions_&8192)==0)
    40974343      static_cast<AbcSimplexDual *> (this)->dual();
     
    48245070    double upperValue=columnUpper_[iColumn];
    48255071    double thisOffset=0.0;
     5072#if 1 //ndef CLP_USER_DRIVEN
    48265073    double lowerValue2 = fabs(lowerValue);
    48275074    double upperValue2 = fabs(upperValue);
     
    48335080        thisOffset=lowerValue;
    48345081    }
     5082#endif
    48355083    offset[iColumn]=thisOffset;
    4836     objectiveOffset_ += thisOffset*objective[iColumn]*optimizationDirection_;
    4837     double scaledOffset = thisOffset*scale;
    4838     for (CoinBigIndex j=columnStart[iColumn];j<columnStart[iColumn+1];j++) {
    4839       int iRow=row[j];
    4840       offsetRhs[iRow]+= scaledOffset*elementByColumn[j];
     5084    if (thisOffset) {
     5085      objectiveOffset_ += thisOffset*objective[iColumn]*optimizationDirection_;
     5086      double scaledOffset = thisOffset*scale;
     5087      for (CoinBigIndex j=columnStart[iColumn];j<columnStart[iColumn+1];j++) {
     5088        int iRow=row[j];
     5089        offsetRhs[iRow]+= scaledOffset*elementByColumn[j];
     5090      }
    48415091    }
    48425092    lowerValue-=thisOffset;
     
    52725522    }
    52735523  }
    5274   if (problemStatus_ == 2) {
    5275     for (int i = 0; i < numberColumns_; i++) {
    5276       ray_[i] *= columnScale[i];
    5277     }
    5278   } else if (problemStatus_ == 1 && ray_) {
    5279     for (int i = 0; i < numberRows_; i++) {
    5280       ray_[i] *= rowScale[i];
     5524  if (scalingFlag_) {
     5525    if (problemStatus_ == 2) {
     5526      for (int i = 0; i < numberColumns_; i++) {
     5527        ray_[i] *= columnScale[i];
     5528      }
     5529    } else if (problemStatus_ == 1 && ray_) {
     5530      for (int i = 0; i < numberRows_; i++) {
     5531        ray_[i] *= rowScale[i];
     5532      }
    52815533    }
    52825534  }
     
    59966248          }
    59976249        } else {
    5998           abort();
    59996250          // primal - change tolerance
    60006251          if (numberBadTimes_ > 3)
  • trunk/Clp/src/AbcSimplex.hpp

    r1910 r2024  
    336336  /// Restore data
    337337  void restoreData(ClpDataSave saved);
    338   /// Clean up status
    339   void cleanStatus();
     338  /// Clean up status - make sure no superbasic etc
     339  void cleanStatus(bool valuesPass=false);
    340340  /** Computes duals from scratch. If givenDjs then
    341341      allows for nonzero basic djs.  Returns number of refinements  */
     
    742742  inline AbcSimplexProgress * abcProgress()
    743743  { return &abcProgress_;}
     744#ifdef ABC_SPRINT
     745  /// Overwrite to create sub problem (just internal arrays) - save full stuff
     746  AbcSimplex * createSubProblem(int numberColumns,const int * whichColumn);
     747  /// Restore stuff from sub problem (and delete sub problem)
     748  void restoreFromSubProblem(AbcSimplex * fullProblem, const int * whichColumn);
     749#endif
    744750public:
    745751  /** Clears an array and says available (-1 does all)
  • trunk/Clp/src/AbcSimplexDual.cpp

    r1990 r2024  
    32943294  double limit = 0.0;
    32953295  getDblParam(ClpDualObjectiveLimit, limit);
     3296  int numberChangedBounds=0;
    32963297  if (primalFeasible()&&ignoreStuff!=2) {
    32973298    // may be optimal - or may be bounds are wrong
    3298     int numberChangedBounds = changeBounds(0, changeCost);
     3299    numberChangedBounds = changeBounds(0, changeCost);
     3300    if (numberChangedBounds)
     3301      gutsOfSolution(2);
     3302  }
     3303  if (primalFeasible()&&ignoreStuff!=2) {
    32993304    if (numberChangedBounds <= 0 && !numberDualInfeasibilities_) {
    33003305      //looks optimal - do we need to reset tolerance
     
    33673372             numberChangedBounds,numberAtFakeBound(),__LINE__,__FILE__);
    33683373#endif
    3369     } else if (numberAtFakeBound()) {
     3374    } else if (numberChangedBounds>0||numberAtFakeBound()) {
    33703375      handler_->message(CLP_DUAL_BOUNDS, messages_)
    33713376        << currentDualBound_
     
    59285933    dualTolerance_ = dblParam_[ClpDualTolerance];
    59295934    primalTolerance_ = dblParam_[ClpPrimalTolerance];
    5930     int tryType=moreSpecialOptions_/131072;
     5935    int tryType=moreSpecialOptions_/65536;
    59315936    if (tryType<5) {
    59325937      currentDualBound_=1.0e8;
  • trunk/Clp/src/AbcSimplexFactorization.hpp

    r1910 r2024  
    236236    return coinAbcFactorization_->pivots() ;
    237237  }
     238  /// Sets model
     239  inline void setModel(AbcSimplex * model)
     240  {model_ = model;}
    238241  /// Sets number of pivots since factorization
    239242  inline void setPivots ( int value ) const {
  • trunk/Clp/src/ClpModel.cpp

    r2022 r2024  
    25822582               }
    25832583               assert (columnLower);
    2584                addColumns(numberColumns2, columnLower, columnUpper, objective, NULL, NULL, NULL);
    25852584#ifndef SLIM_CLP
    25862585               if (!tryPlusMinusOne) {
    25872586#endif
    2588                     /* addColumns just above extended matrix - to keep
    2589                        things clean - take off again.  I know it is a bit
    2590                        clumsy but won't break anything */
    2591                     {
    2592                       int * which = new int [numberColumns2];
    2593                       for (int i=0;i<numberColumns2;i++)
    2594                         which[i]=i+numberColumns;
    2595                       matrix_->deleteCols(numberColumns2,which);
    2596                       delete [] which;
    2597                     }
    25982587                    CoinPackedMatrix matrix;
    25992588                    modelObject.createPackedMatrix(matrix, associated);
    26002589                    assert (!matrix.getExtraGap());
    2601                     if (matrix_->getNumCols()) {
    2602                          const int * row = matrix.getIndices();
    2603                          //const int * columnLength = matrix.getVectorLengths();
    2604                          const CoinBigIndex * columnStart = matrix.getVectorStarts();
    2605                          const double * element = matrix.getElements();
    2606                          // make sure matrix has enough rows
    2607                          matrix_->setDimensions(numberRows_, -1);
    2608                          numberErrors += matrix_->appendMatrix(numberColumns2, 1, columnStart, row, element,
    2609                                                                checkDuplicates ? numberRows_ : -1);
    2610                     } else {
    2611                          delete matrix_;
    2612                          matrix_ = new ClpPackedMatrix(matrix);
    2613                     }
     2590                    const int * row = matrix.getIndices();
     2591                    //const int * columnLength = matrix.getVectorLengths();
     2592                    const CoinBigIndex * columnStart = matrix.getVectorStarts();
     2593                    const double * element = matrix.getElements();
     2594                    // make sure matrix has enough rows
     2595                    matrix_->setDimensions(numberRows_, -1);
     2596                    addColumns(numberColumns2, columnLower, columnUpper,
     2597                               objective, columnStart, row, element);
    26142598#ifndef SLIM_CLP
    26152599               } else {
     2600                    addColumns(numberColumns2, columnLower, columnUpper, objective, NULL, NULL, NULL);
    26162601                    // create +-1 matrix
    26172602                    CoinBigIndex size = startPositive[numberColumns2];
  • trunk/Clp/src/ClpSimplex.cpp

    r1990 r2024  
    25202520          nonLinearCost_ = NULL;
    25212521     solveType_ = rhs.solveType_;
     2522     eventHandler_->setSimplex(this);
    25222523}
    25232524// type == 0 do everything, most + pivot data, 2 factorization data as well
     
    28612862     double relaxedToleranceP = primalTolerance_;
    28622863     // we can't really trust infeasibilities if there is primal error
    2863      double error = CoinMin(1.0e-2, largestPrimalError_);
     2864     double error = CoinMin(1.0e-2, CoinMax(largestPrimalError_,5.0*primalTolerance_));
    28642865     // allow tolerance at least slightly bigger than standard
    28652866     relaxedToleranceP = relaxedToleranceP +  error;
     
    28702871     double relaxedToleranceD = dualTolerance;
    28712872     // we can't really trust infeasibilities if there is dual error
    2872      error = CoinMin(1.0e-2, largestDualError_);
     2873     error = CoinMin(1.0e-2, CoinMax(largestDualError_,5.0*dualTolerance_));
    28732874     // allow tolerance at least slightly bigger than standard
    28742875     relaxedToleranceD = relaxedToleranceD +  error;
  • trunk/Clp/src/CoinAbcBaseFactorization4.cpp

    r1910 r2024  
    45864586      btranAverageAfterR_ = INITIAL_AVERAGE2;
    45874587      btranAverageAfterL_ = INITIAL_AVERAGE2;
     4588      btranFullCountAfterL_ = INITIAL_AVERAGE2;
     4589      btranFullCountAfterR_ = INITIAL_AVERAGE2;
     4590      btranFullCountAfterU_ = INITIAL_AVERAGE2;
    45884591    }
    45894592    ftranFullCountInput_= CoinMax(ftranFullCountInput_,1.0);
  • trunk/Clp/src/Makefile.am

    r1996 r2024  
    236236
    237237if COIN_HAS_ABC
    238 includecoin_HEADERS += AbcSimplex.hpp CoinAbcCommon.hpp AbcCommon.hpp
     238includecoin_HEADERS += AbcSimplex.hpp CoinAbcCommon.hpp AbcCommon.hpp AbcNonLinearCost.hpp
    239239endif
    240240
  • trunk/Clp/src/Makefile.in

    r1996 r2024  
    9999@COIN_HAS_CHOLMOD_TRUE@am__append_7 = -I`$(CYGPATH_W) $(CHOLMODINCDIR)`
    100100@COIN_HAS_AMD_TRUE@am__append_8 = -I`$(CYGPATH_W) $(AMDINCDIR)`
    101 @COIN_HAS_ABC_TRUE@am__append_9 = AbcSimplex.hpp CoinAbcCommon.hpp AbcCommon.hpp
     101@COIN_HAS_ABC_TRUE@am__append_9 = AbcSimplex.hpp CoinAbcCommon.hpp AbcCommon.hpp AbcNonLinearCost.hpp
    102102
    103103# if AMD, CHOLMOD, or GLPK is available, then install ClpCholeskyUfl.hpp (for advanced users)
     
    298298        ClpSimplexPrimal.hpp ClpSolve.hpp CbcOrClpParam.hpp Idiot.hpp \
    299299        AbcSimplex.hpp CoinAbcCommon.hpp AbcCommon.hpp \
    300         ClpCholeskyUfl.hpp ClpCholeskyMumps.hpp ClpCholeskyWssmp.hpp \
    301         ClpCholeskyWssmpKKT.hpp CbcOrClpParam.cpp
     300        AbcNonLinearCost.hpp ClpCholeskyUfl.hpp ClpCholeskyMumps.hpp \
     301        ClpCholeskyWssmp.hpp ClpCholeskyWssmpKKT.hpp CbcOrClpParam.cpp
    302302includecoinHEADERS_INSTALL = $(INSTALL_HEADER)
    303303HEADERS = $(includecoin_HEADERS)
     
    424424GLPK_LIBS = @GLPK_LIBS@
    425425GLPK_LIBS_INSTALLED = @GLPK_LIBS_INSTALLED@
     426GREP = @GREP@
    426427HAVE_EXTERNALS_FALSE = @HAVE_EXTERNALS_FALSE@
    427428HAVE_EXTERNALS_TRUE = @HAVE_EXTERNALS_TRUE@
     
    490491PACKAGE_STRING = @PACKAGE_STRING@
    491492PACKAGE_TARNAME = @PACKAGE_TARNAME@
     493PACKAGE_URL = @PACKAGE_URL@
    492494PACKAGE_VERSION = @PACKAGE_VERSION@
    493495PATH_SEPARATOR = @PATH_SEPARATOR@
     
    512514abs_source_dir = @abs_source_dir@
    513515ac_c_preproc_warn_flag = @ac_c_preproc_warn_flag@
    514 ac_ct_AR = @ac_ct_AR@
    515516ac_ct_CC = @ac_ct_CC@
    516517ac_ct_CXX = @ac_ct_CXX@
    517518ac_ct_F77 = @ac_ct_F77@
    518 ac_ct_PKG_CONFIG = @ac_ct_PKG_CONFIG@
    519 ac_ct_RANLIB = @ac_ct_RANLIB@
    520 ac_ct_STRIP = @ac_ct_STRIP@
    521519ac_cxx_preproc_warn_flag = @ac_cxx_preproc_warn_flag@
    522520am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
     
    542540coin_have_doxygen = @coin_have_doxygen@
    543541datadir = @datadir@
     542datarootdir = @datarootdir@
     543docdir = @docdir@
     544dvidir = @dvidir@
    544545exec_prefix = @exec_prefix@
    545546have_autoconf = @have_autoconf@
     
    552553host_os = @host_os@
    553554host_vendor = @host_vendor@
     555htmldir = @htmldir@
    554556includedir = @includedir@
    555557infodir = @infodir@
     
    557559libdir = @libdir@
    558560libexecdir = @libexecdir@
     561localedir = @localedir@
    559562localstatedir = @localstatedir@
    560563mandir = @mandir@
    561564mkdir_p = @mkdir_p@
    562565oldincludedir = @oldincludedir@
     566pdfdir = @pdfdir@
    563567prefix = @prefix@
    564568program_transform_name = @program_transform_name@
     569psdir = @psdir@
    565570sbindir = @sbindir@
    566571sharedstatedir = @sharedstatedir@
Note: See TracChangeset for help on using the changeset viewer.