Changeset 15 for branches


Ignore:
Timestamp:
Aug 16, 2002 12:02:38 PM (17 years ago)
Author:
forrest
Message:

Hope this works from wincvs

Fix error in values pass

Location:
branches/devel-1
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • branches/devel-1/ClpFactorization.cpp

    r2 r15  
    9191  if ( numberBasic > numberRows ) {
    9292    return -2; // say too many in basis
    93   }                             
     93  }
    9494  numberElements = 3 * numberBasic + 3 * numberElements + 10000;
    9595  getAreas ( numberRows, numberBasic, numberElements,
  • branches/devel-1/ClpMessage.cpp

    r8 r15  
    3535  {CLP_PRIMAL_WEIGHT,16,2,"New infeasibility weight of %g"},
    3636  {CLP_PRIMAL_OPTIMAL,17,2,"Looking optimal with tolerance of %g"},
     37  {CLP_SINGULARITIES,18,2,"%d total structurals rejected in initial factorization"},
    3738  {CLP_SIMPLEX_HOUSE1,101,32,"dirOut %d, dirIn %d, theta %g, out %g, dj %g, alpha %g"},
    3839  {CLP_SIMPLEX_HOUSE2,102,4,"%d %g In: %c%d Out: %c%d%? dj ratio %g distance %g%? dj %g distance %g"},
  • branches/devel-1/ClpPrimalColumnDantzig.cpp

    r2 r15  
    145145     
    146146      switch(status) {
    147        
     147
    148148      case ClpSimplex::basic:
    149149        break;
  • branches/devel-1/ClpPrimalColumnSteepest.cpp

    r14 r15  
    225225          continue;
    226226        ClpSimplex::Status status = model_->getStatus(iSequence+addSequence);
    227        
     227
    228228        switch(status) {
    229229         
     
    288288     
    289289      switch(status) {
    290        
     290
    291291      case ClpSimplex::basic:
    292292        break;
     
    352352     
    353353      switch(status) {
    354        
     354
    355355      case ClpSimplex::basic:
    356356        infeasible_->zero(iSequence+addSequence);
     
    457457      }
    458458      weight[iSequence] = thisWeight;
    459     }                   
     459    }
    460460   
    461461    // columns
     
    495495      }
    496496      weight[iSequence] = thisWeight;
    497     }                   
     497    }
    498498    // restore outgoing weight
    499499    weights_[sequenceOut]=outgoingWeight;
     
    686686     
    687687      switch(status) {
    688        
     688
    689689      case ClpSimplex::basic:
    690690        break;
     
    830830                                          <<OsiMessageEol;
    831831      initializeWeights();
    832     }                           
     832    }
    833833  }
    834834  if (pivotRow>=0) {
  • branches/devel-1/ClpSimplex.cpp

    r8 r15  
    218218      for (iRow=0;iRow<numberRows_;iRow++) {
    219219        int iPivot=pivotVariable_[iRow];
    220        
     220
    221221        if (iPivot<numberColumns_) {
    222222          // column
     
    234234        int iColumn=sort[iRow];
    235235        setColumnStatus(iColumn,ClpSimplex::superBasic);
    236        
     236
    237237      }
    238238      delete [] sort;
     
    502502      If 10 added then in primal values pass
    503503*/
    504 // Return codes are as from ClpFactorization
     504/* Return codes are as from ClpFactorization unless initial factorization
     505   when total number of singularities is returned */
    505506int ClpSimplex::internalFactorize ( int solveType)
    506507{
    507508
    508509  int iRow,iColumn;
     510  int totalSlacks=numberRows_;
    509511
    510512  bool valuesPass=false;
     
    560562          }
    561563        }
     564        totalSlacks=numberBasic;
    562565        for (iColumn=0;iColumn<numberColumns_;iColumn++) {
    563566          switch(getColumnStatus(iColumn)) {
     
    683686            setRowStatus(iRow,ClpSimplex::superBasic);
    684687        }
     688        totalSlacks=numberBasic;
    685689        for (iColumn=0;iColumn<numberColumns_;iColumn++) {
    686690          if (getColumnStatus(iColumn)==ClpSimplex::basic) {
     
    834838      <<OsiMessageEol;
    835839    return -1;
     840  } else if (!solveType) {
     841    // Initial basis - return number of singularities
     842    int numberSlacks=0;
     843    for (iRow=0;iRow<numberRows_;iRow++) {
     844      if (getRowStatus(iRow) == ClpSimplex::basic)
     845        numberSlacks++;
     846    }
     847    status= numberSlacks-totalSlacks;
    836848  }
    837849
  • branches/devel-1/ClpSimplexDual.cpp

    r14 r15  
    260260  int saveSparse = factorization_->sparseThreshold();
    261261
    262   if (internalFactorize(0))
     262  int factorizationStatus = internalFactorize(0);
     263  if (factorizationStatus<0)
    263264    return 1; // some error
     265  else if (factorizationStatus)
     266    handler_->message(CLP_SINGULARITIES,messages_)
     267    <<factorizationStatus
     268    <<OsiMessageEol;
    264269
    265270  // If user asked for perturbation - do it
     
    727732        FakeBound bound = getFakeBound(iSequence+addSequence);
    728733        Status status = getStatus(iSequence+addSequence);
    729        
     734
    730735        switch(status) {
    731736         
     
    906911      setFakeBound(iSequence,ClpSimplexDual::noFake);
    907912      switch(getStatus(iSequence)) {
    908        
     913
    909914      case ClpSimplex::basic:
    910915        break;
     
    11361141      double value = oldValue-tentativeTheta*alpha;
    11371142      int keep = 0;
    1138        
     1143
    11391144      switch(getStatus(iSequence+addSequence)) {
    11401145         
     
    19671972      work[iSequence]=0.0;
    19681973      Status status = getStatus(iSequence+addSequence);
    1969        
     1974
    19701975      switch(status) {
    1971        
     1976
    19721977      case ClpSimplex::basic:
    19731978      case ClpSimplex::isFree:
  • branches/devel-1/ClpSimplexPrimal.cpp

    r14 r15  
    259259  int numberThrownOut = -1;
    260260  int firstSuperBasic=numberRows_+numberColumns_;
     261  int totalNumberThrownOut=0;
    261262  while(numberThrownOut) {
    262     if (internalFactorize(0+10*ifValuesPass))
     263    int status = internalFactorize(0+10*ifValuesPass);
     264    if (status<0)
    263265      return 1; // some error
     266    else
     267      totalNumberThrownOut+= status;
     268
    264269    // for this we need clean basis so it is after factorize
    265270    numberThrownOut=gutsOfSolution(rowActivityWork_,columnActivityWork_,
    266271                                   ifValuesPass);
     272    totalNumberThrownOut+= numberThrownOut;
    267273
    268274    // find first superbasic - columns, then rows
     
    273279    }
    274280  }
     281
     282  if (totalNumberThrownOut)
     283    handler_->message(CLP_SINGULARITIES,messages_)
     284    <<totalNumberThrownOut
     285    <<OsiMessageEol;
    275286
    276287  problemStatus_ = -1;
     
    366377}
    367378void
    368 ClpSimplexPrimal::whileIterating(int firstSuperBasic)
     379ClpSimplexPrimal::whileIterating(int & firstSuperBasic)
    369380{
    370381
     
    442453          break;
    443454        }
    444        
     455
    445456        // and get variable
    446457        primalColumn(rowArray_[1],rowArray_[2],rowArray_[3],
     
    496507        printf("btran dj %g, ftran dj %g\n",saveDj,dualIn_);
    497508#endif
    498       if (saveDj*dualIn_<1.0e-20||
     509      if ((saveDj*dualIn_<1.0e-20&&!ifValuesPass)||
    499510          fabs(saveDj-dualIn_)>1.0e-5*(1.0+fabs(saveDj))) {
    500511        handler_->message(CLP_PRIMAL_DJ,messages_)
     
    725736        infeasibilityCost_=1.0e30;
    726737      }
    727        
     738
    728739      if (infeasibilityCost_<1.0e20) {
    729740        infeasibilityCost_ *= 5.0;
     
    10111022     
    10121023      for (iIndex=0;iIndex<numberRemaining;iIndex++) {
    1013        
     1024
    10141025        int iRow = index[iIndex];
    10151026        double alpha = spare[iIndex];
    10161027        double oldValue = rhs[iRow];
    10171028        double value = oldValue-tentativeTheta*fabs(alpha);
    1018        
     1029
    10191030        if (value<-primalTolerance_) {
    10201031          // how much would it cost to go thru
  • branches/devel-1/include/ClpMessage.hpp

    r2 r15  
    4949  CLP_IMPORT_RESULT,
    5050  CLP_IMPORT_ERRORS,
     51  CLP_SINGULARITIES,
    5152  CLP_DUMMY_END
    5253};
  • branches/devel-1/include/ClpSimplex.hpp

    r8 r15  
    177177      solveType - 1 iterating, 0 initial, -1 external
    178178      If 10 added then in primal values pass
     179      Return codes are as from ClpFactorization unless initial factorization
     180      when total number of singularities is returned
    179181  */
    180182  int internalFactorize(int solveType);
  • branches/devel-1/include/ClpSimplexPrimal.hpp

    r14 r15  
    126126      otherwise first super basic variable
    127127   */
    128   void whileIterating(int firstSuperBasic);
     128  void whileIterating(int & firstSuperBasic);
    129129  /** The primals are updated by the given array.
    130130      Returns number of infeasibilities.
Note: See TracChangeset for help on using the changeset viewer.