Changeset 341


Ignore:
Timestamp:
Apr 1, 2004 11:46:02 AM (17 years ago)
Author:
forrest
Message:

small changes

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/ClpDualRowSteepest.cpp

    r336 r341  
    2020    state_(-1),
    2121    mode_(mode),
     22    persistence_(normal),
    2223    weights_(NULL),
    2324    infeasible_(NULL),
     
    3738  state_=rhs.state_;
    3839  mode_ = rhs.mode_;
     40  persistence_ = rhs.persistence_;
    3941  model_ = rhs.model_;
    4042  if (rhs.infeasible_) {
     
    9395    state_=rhs.state_;
    9496    mode_ = rhs.mode_;
     97    persistence_ = rhs.persistence_;
    9598    model_ = rhs.model_;
    9699    delete [] weights_;
     
    269272          int iSequence = pivotVariable[iRow];
    270273          if (!model_->flagged(iSequence)) {
    271             //#define CLP_DEBUG 1
     274            //#define CLP_DEBUG 3
    272275#ifdef CLP_DEBUG
    273276            double value2=0.0;
     
    332335      }
    333336      alternateWeights_->setNumElements(0);
    334       if (fabs(weights_[i]-value)>1.0e-4)
     337      double w = max(weights_[i],value)*.1;
     338      if (fabs(weights_[i]-value)>w) {
    335339        printf("%d old %g, true %g\n",i,weights_[i],value);
     340        weights_[i]=value; // to reduce printout
     341      }
    336342      //else
    337343      //printf("%d matches %g\n",i,value);
     
    834840ClpDualRowSteepest::clearArrays()
    835841{
    836   delete [] weights_;
    837   weights_=NULL;
    838   delete [] dubiousWeights_;
    839   dubiousWeights_=NULL;
    840   delete infeasible_;
    841   infeasible_ = NULL;
    842   delete alternateWeights_;
    843   alternateWeights_ = NULL;
    844   delete savedWeights_;
    845   savedWeights_ = NULL;
     842  if (persistence_==normal) {
     843    delete [] weights_;
     844    weights_=NULL;
     845    delete [] dubiousWeights_;
     846    dubiousWeights_=NULL;
     847    delete infeasible_;
     848    infeasible_ = NULL;
     849    delete alternateWeights_;
     850    alternateWeights_ = NULL;
     851    delete savedWeights_;
     852    savedWeights_ = NULL;
     853  }
    846854  state_ =-1;
    847855}
  • trunk/ClpDynamicMatrix.cpp

    r336 r341  
    836836    int iDynamic = sequenceOut-numberColumns-numberStaticRows_;
    837837    int iSet = fromIndex_[iDynamic];
    838     setStatus(iSet,model->getStatus(sequenceOut));
     838    // out may have gone through barrier - so check
     839    double valueOut = model->lowerRegion()[sequenceOut];
     840    if (fabs(valueOut -(double) lowerSet_[iSet])<
     841        fabs(valueOut -(double) upperSet_[iSet]))
     842      setStatus(iSet,ClpSimplex::atLowerBound);
     843    else
     844      setStatus(iSet,ClpSimplex::atUpperBound);
     845    if (getStatus(iSet)!=model->getStatus(sequenceOut))
     846      printf("** set %d status %d, var status %d\n",iSet,
     847             getStatus(iSet),model->getStatus(sequenceOut));
    839848  }
    840849  ClpMatrixBase::updatePivot(model,oldInValue,oldOutValue);
     
    842851  char * inSmall = new char [numberGubColumns_];
    843852  memset(inSmall,0,numberGubColumns_);
     853  const double * solution = model->solutionRegion();
    844854  for (int i=0;i<numberGubColumns_;i++)
    845855    if (getDynamicStatus(i)==ClpDynamicMatrix::inSmall)
     
    848858    int k=id_[i-firstDynamic_];
    849859    inSmall[k]=0;
     860    //if (k>=23289&&k<23357&&solution[i])
     861    //printf("var %d (in small %d) has value %g\n",k,i,solution[i]);
    850862  }
    851863  for (int i=0;i<numberGubColumns_;i++)
     
    856868    int iSet = fromIndex_[i];
    857869    assert (toIndex_[iSet]==i);
    858     assert (model->getRowStatus(i+numberStaticRows_)==getStatus(iSet));
     870    //if (getStatus(iSet)!=model->getRowStatus(i+numberStaticRows_))
     871    //printf("*** set %d status %d, var status %d\n",iSet,
     872    //     getStatus(iSet),model->getRowStatus(i+numberStaticRows_));
     873    //assert (model->getRowStatus(i+numberStaticRows_)==getStatus(iSet));
     874    //if (iSet==1035) {
     875    //printf("rhs for set %d (%d) is %g %g - cost %g\n",iSet,i,model->lowerRegion(0)[i+numberStaticRows_],
     876    //     model->upperRegion(0)[i+numberStaticRows_],model->costRegion(0)[i+numberStaticRows_]);
     877    }
    859878  }
    860879#endif
     
    11261145        }
    11271146        if (doCosts) {
    1128           if (model->nonLinearCost())
     1147          if (model->nonLinearCost()) {
     1148            double trueLower;
     1149            if (lowerSet_[iSet]>-1.0e20)
     1150              trueLower = lowerSet_[iSet];
     1151            else
     1152              trueLower=-COIN_DBL_MAX;
     1153            double trueUpper;
     1154            if (upperSet_[iSet]<1.0e20)
     1155              trueUpper = upperSet_[iSet];
     1156            else
     1157              trueUpper=COIN_DBL_MAX;
    11291158            model->nonLinearCost()->setOne(iSequence,solution[iSequence],
    1130                                            columnLower[iSequence],
    1131                                            columnUpper[iSequence],0.0);
     1159                                           trueLower,trueUpper,0.0);
     1160          }
    11321161        }
    11331162      }
     
    13551384      columnUpper[out]=columnUpper[in];
    13561385      cost[out]=cost[in];
     1386      double trueLower;
     1387      if (lowerSet_[iSet]>-1.0e20)
     1388        trueLower = lowerSet_[iSet];
     1389      else
     1390        trueLower=-COIN_DBL_MAX;
     1391      double trueUpper;
     1392      if (upperSet_[iSet]<1.0e20)
     1393        trueUpper = upperSet_[iSet];
     1394      else
     1395        trueUpper=COIN_DBL_MAX;
    13571396      model->nonLinearCost()->setOne(out,solution[out],
    1358                                          columnLower[out],
    1359                                          columnUpper[out],0.0);
     1397                                     trueLower,trueUpper,0.0);
    13601398      model->setStatus(out,model->getStatus(in));
    13611399      toIndex_[iSet]=numberActiveSets_;
  • trunk/ClpPrimalColumnSteepest.cpp

    r336 r341  
    1212#include "CoinHelperFunctions.hpp"
    1313#include <stdio.h>
    14 
     14//#define CLP_DEBUG
    1515//#############################################################################
    1616// Constructors / Destructor / Assignment
     
    3030    state_(-1),
    3131    mode_(mode),
     32    persistence_(normal),
    3233    numberSwitched_(0),
    3334    pivotSequence_(-1),
     
    4748  state_=rhs.state_;
    4849  mode_ = rhs.mode_;
     50  persistence_ = rhs.persistence_;
    4951  numberSwitched_ = rhs.numberSwitched_;
    5052  model_ = rhs.model_;
     
    104106    state_=rhs.state_;
    105107    mode_ = rhs.mode_;
     108    persistence_ = rhs.persistence_;
    106109    numberSwitched_ = rhs.numberSwitched_;
    107110    model_ = rhs.model_;
     
    33013304ClpPrimalColumnSteepest::clearArrays()
    33023305{
    3303   delete [] weights_;
    3304   weights_=NULL;
    3305   delete infeasible_;
    3306   infeasible_ = NULL;
    3307   delete alternateWeights_;
    3308   alternateWeights_ = NULL;
    3309   delete [] savedWeights_;
    3310   savedWeights_ = NULL;
    3311   delete [] reference_;
    3312   reference_ = NULL;
     3306  if (persistence_==normal) {
     3307    delete [] weights_;
     3308    weights_=NULL;
     3309    delete infeasible_;
     3310    infeasible_ = NULL;
     3311    delete alternateWeights_;
     3312    alternateWeights_ = NULL;
     3313    delete [] savedWeights_;
     3314    savedWeights_ = NULL;
     3315    delete [] reference_;
     3316    reference_ = NULL;
     3317  }
    33133318  pivotSequence_=-1;
    33143319  state_ = -1;
  • trunk/include/ClpDualRowSteepest.hpp

    r225 r341  
    5858  //@}
    5959 
     60  /** enums for persistence
     61  */
     62  enum Persistence {
     63    normal = 0x00, // create (if necessary) and destroy
     64    keep = 0x01 // create (if necessary) and leave
     65  };
    6066 
    6167  ///@name Constructors and destructors
     
    8894  inline int mode() const
    8995    { return mode_;};
     96  /// Set/ get persistence
     97  inline void setPersistence(Persistence life)
     98  { persistence_ = life;};
     99  inline Persistence persistence() const
     100  { return persistence_ ;};
    90101 //@}
    91102
     
    103114      if 2 then uninitialized partial, 3 switchable */
    104115  int mode_;
     116  /// Life of weights
     117  Persistence persistence_;
    105118  /// weight array
    106119  double * weights_;
  • trunk/include/ClpPrimalColumnSteepest.hpp

    r295 r341  
    126126 //@}
    127127
     128  /** enums for persistence
     129  */
     130  enum Persistence {
     131    normal = 0x00, // create (if necessary) and destroy
     132    keep = 0x01 // create (if necessary) and leave
     133  };
    128134 
    129135  ///@name Constructors and destructors
     
    150156  /// Clone
    151157  virtual ClpPrimalColumnPivot * clone(bool copyData = true) const;
    152  
     158
    153159  //@}
    154160
     
    168174      value &= ~(1<<bit);
    169175  }
     176  /// Set/ get persistence
     177  inline void setPersistence(Persistence life)
     178  { persistence_ = life;};
     179  inline Persistence persistence() const
     180  { return persistence_ ;};
     181 
    170182  //@}
    171183  //---------------------------------------------------------------------------
     
    204216  */
    205217  int mode_;
     218  /// Life of weights
     219  Persistence persistence_;
    206220  /// Number of times switched from partial dantzig to 0/2
    207221  int numberSwitched_;
Note: See TracChangeset for help on using the changeset viewer.