Changeset 56


Ignore:
Timestamp:
Nov 25, 2002 12:10:43 PM (17 years ago)
Author:
forrest
Message:

Idiot and modifications for Visual C++

Location:
trunk
Files:
3 added
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/ClpSimplexDual.cpp

    r54 r56  
    21782178    if (rowLowerWork_[iRow]>-largeValue_) {
    21792179      if (fabs(rowLowerWork_[iRow])<fabs(rowUpperWork_[iRow]))
    2180         value *= drand48();
     2180        value *= CoinDrand48();
    21812181      else
    2182         value *= -drand48();
     2182        value *= -CoinDrand48();
    21832183    } else if (rowUpperWork_[iRow]<largeValue_) {
    2184       value *= -drand48();
     2184      value *= -CoinDrand48();
    21852185    } else {
    21862186      value=0.0;
     
    21952195      if (fabs(columnLowerWork_[iColumn])<
    21962196          fabs(columnUpperWork_[iColumn]))
    2197         value *= drand48();
     2197        value *= CoinDrand48();
    21982198      else
    2199         value *= -drand48();
     2199        value *= -CoinDrand48();
    22002200    } else if (columnUpperWork_[iColumn]<largeValue_) {
    2201       value *= -drand48();
     2201      value *= -CoinDrand48();
    22022202    } else {
    22032203      value=0.0;
  • trunk/ClpSimplexPrimal.cpp

    r54 r56  
    14671467    double lowerValue=lower_[i], upperValue=upper_[i];
    14681468    if (upperValue>lowerValue+primalTolerance_) {
    1469       double value = drand48()*perturbation;
     1469      double value = CoinDrand48()*perturbation;
    14701470      if (lowerValue>-1.0e20)
    14711471        lowerValue -= value * (max(1.0,1.0e-3*fabs(lowerValue)));
  • trunk/Makefile.Clp

    r50 r56  
    4444LIBSRC += PresolveUseless.cpp             
    4545
    46 #LIBSRC += Idiot.cpp
    47 #LIBSRC += IdiSolve.cpp
     46LIBSRC += Idiot.cpp
     47LIBSRC += IdiSolve.cpp
    4848
    4949##############################################################################
     
    5757
    5858# Say Idiot code can use Clp interface
    59 #CXXFLAGS += -DCLP_IDIOT
     59CXXFLAGS += -DCLP_IDIOT
    6060CXXFLAGS += -DUSE_PRESOLVE
    6161ifeq ($(OptLevel),-g)
  • trunk/PresolveDoubleton.cpp

    r55 r56  
    457457     
    458458      // don't bother with fixed variables
    459       if (!fabs(cup[icolx] - clo[icolx]) < ZTOLDP &&
    460           !fabs(cup[icoly] - clo[icoly]) < ZTOLDP) {
     459      if ((!fabs(cup[icolx] - clo[icolx]) < ZTOLDP) &&
     460          (!fabs(cup[icoly] - clo[icoly]) < ZTOLDP)) {
    461461        double coeffx, coeffy;
    462462        /* find this row in each of the columns */
  • trunk/PresolveDupcol.cpp

    r55 r56  
    503503      double x_k_sol = sol[icol2];
    504504
    505       PRESOLVEASSERT(l_j + u_k <= l_k + u_j);
    506505      prob->setColumnStatus(icol,prob->getColumnStatus(icol2));
    507506      if (x_k_sol <= l_k + u_j) {
  • trunk/PresolveEmpty.cpp

    r55 r56  
    188188  memset(colmapping,0,ncols2*sizeof(int));
    189189  char *cdone   = prob->cdone_;
    190 
    191   for (int action_i = 0; action_i < nactions; action_i++) {
     190  int action_i;
     191  for (action_i = 0; action_i < nactions; action_i++) {
    192192    const action *e = &actions[action_i];
    193193    int jcol = e->jcol;
     
    222222  delete [] colmapping;
    223223
    224   for (int action_i = 0; action_i < nactions; action_i++) {
     224  for (action_i = 0; action_i < nactions; action_i++) {
    225225    const action *e = &actions[action_i];
    226226    int jcol = e->jcol;
  • trunk/PresolveFixed.cpp

    r55 r56  
    5353  for (int ckc=0; ckc<nfcols; ckc++) {
    5454    int j = fcols[ckc];
    55 
    56     PRESOLVEASSERT(/*hincol[j] > 0 &&*/ cup[j] == clo[j]);
    5755
    5856    double sol = clo[j];
     
    209207        cs = k;
    210208
    211         PRESOLVEASSERT(rdone[row]);
    212 
    213209        if (-PRESOLVE_INF < rlo[row])
    214210          rlo[row] += coeff * thesol;
  • trunk/PresolveForcing.cpp

    r55 r56  
    2121}
    2222#endif
    23 static void implied_bounds1(PresolveMatrix * prob,const double *rowels,
    24                                 const int *mrstrt,
    25                                 const int *hrow,
    26                                 const int *hinrow,
    27                                 const double *clo, const double *cup,
    28                                 const int *hcol,
    29                                 int ncols,
    30                                 const double *rlo, const double *rup,
    31                                 const char *integerType,
    32                                 int nrows,
    33                                 double *ilbound, double *iubound);
    34 
    3523
    3624/*static*/ void implied_bounds(const double *els,
     
    406394    const int *rowcols  = f->rowcols;
    407395    const double *bounds= f->bounds;
    408 
    409     for (int k=0; k<nlo; k++) {
     396    int k;
     397
     398    for (k=0; k<nlo; k++) {
    410399      int jcol = rowcols[k];
    411400      cup[jcol] = bounds[k];
     
    413402    }
    414403
    415     for (int k=nlo; k<ninrow; k++) {
     404    for (k=nlo; k<ninrow; k++) {
    416405      int jcol = rowcols[k];
    417406      clo[jcol] = bounds[k];
     
    433422    int whacked = -1;
    434423    double whack = 0.0;
    435     for (int k=0; k<ninrow; k++) {
     424    for (k=0; k<ninrow; k++) {
    436425      int jcol = rowcols[k];
    437426      CoinBigIndex kk = presolve_find_row2(irow, mcstrt[jcol], hincol[jcol], hrow, link);
     
    453442      rowduals[irow] = whack;
    454443
    455       for (int k=0; k<ninrow; k++) {
     444      for (k=0; k<ninrow; k++) {
    456445        int jcol = rowcols[k];
    457446        CoinBigIndex kk = presolve_find_row2(irow, mcstrt[jcol], hincol[jcol], hrow, link);
     
    465454
    466455
    467 
     456#if 0
    468457// Determine the maximum and minimum values the constraint sums
    469458// may take, given the bounds on the variables.
     
    743732            }
    744733
    745             for (int k=0; k<ninrow; k++) {
     734            for (k=0; k<ninrow; k++) {
    746735              int jcol = rowcols[k];
    747736              CoinBigIndex kk = presolve_find_row(irow, mcstrt[jcol], mcstrt[jcol] + hincol[jcol], hrow);
     
    784773        }
    785774#endif
    786 
    787 
    788 
     775#endif
     776
     777
     778
  • trunk/PresolveImpliedFree.cpp

    r55 r56  
    448448          int jcol = rowcols[k];
    449449          PRESOLVE_STMT(CoinBigIndex kk = presolve_find_row2(irow, mcstrt[jcol], hincol[jcol], hrow, link));
    450           PRESOLVEASSERT(colels[kk] == rowels[k]);
    451450          act += rowels[k] * sol[jcol];
    452451        }
  • trunk/PresolveIsolated.cpp

    r55 r56  
    136136  rup[irow] = this->rup_;
    137137  rlo[irow] = this->rlo_;
     138  int k;
    138139
    139   for (int k=0; k<this->ninrow_; k++) {
     140  for (k=0; k<this->ninrow_; k++) {
    140141    int jcol = this->rowcols_[k];
    141142
  • trunk/PresolveSingleton.cpp

    r55 r56  
    257257    double coeff = f->coeff;
    258258    int jcol = f->col;
    259 
    260     /* the column was in the reduced problem */
    261     PRESOLVEASSERT(cdone[jcol] && rdone[irow]==DROP_ROW);
    262259
    263260    rlo[irow] = f->rlo;
  • trunk/PresolveSubst.cpp

    r55 r56  
    10771077  //  const double ztoldj       = prob->ztoldj_;
    10781078  const double maxmin = prob->maxmin_;
     1079  int k;
    10791080
    10801081  for (const action *f = &actions[nactions-1]; actions<=f; f--) {
     
    11611162      double sol0 = rloy;
    11621163      sol[icol] = 0.0;  // to avoid condition in loop
    1163       for (int k = 0; k<ninrowy; ++k) {
     1164      for (k = 0; k<ninrowy; ++k) {
    11641165        int jcolx = rowcolsy[k];
    11651166        double coeffx = rowelsy[k];
     
    11891190      // (with the exception of icol, which was deleted);
    11901191      // the other rows *must* contain these cols
    1191       for (int k = 0; k<ninrowy; ++k) {
     1192      for (k = 0; k<ninrowy; ++k) {
    11921193        int col = rowcolsy[k];
    11931194
     
    12171218
    12181219          if (jrowx != jrowy)
    1219             for (int k = 0; k<ninrowx; ++k) {
     1220            for (k = 0; k<ninrowx; ++k) {
    12201221              int col = rowcolsx[k];
    12211222              CoinBigIndex kcolx = presolve_find_row3(jrowx, mcstrt[col], hincol[col], hrow, link);
     
    12471248
    12481249      // finally, add original rowy elements
    1249       for (int k = 0; k<ninrowy; ++k) {
     1250      for (k = 0; k<ninrowy; ++k) {
    12501251        int col = rowcolsy[k];
    12511252
     
    12791280      // DEBUG CHECK
    12801281      double acty = 0.0;
    1281       for (int k = 0; k<ninrowy; ++k) {
     1282      for (k = 0; k<ninrowy; ++k) {
    12821283        int col = rowcolsy[k];
    12831284        acty += rowelsy[k] * sol[col];
     
    12971298
    12981299            double actx = 0.0;
    1299             for (int k = 0; k<ninrowx; ++k) {
     1300            for (k = 0; k<ninrowx; ++k) {
    13001301              int col = rowcolsx[k];
    13011302              actx += rowelsx[k] * sol[col];
  • trunk/PresolveTighten.cpp

    r55 r56  
    337337        // adjust to just meet newrlo (solve for correction)
    338338        double new_correction = (newrlo - activity) / coeff;
    339         PRESOLVEASSERT((iflag == 1) == (correction < new_correction));
    340339        correction = new_correction;
    341340      } else if (activity + correction * coeff > newrup) {
     
    343342
    344343        double new_correction = (newrup - activity) / coeff;
    345         PRESOLVEASSERT((iflag == 1) == (correction < new_correction));
    346344        correction = new_correction;
    347345      }
     
    349347
    350348    sol[jcol] += correction;
    351     PRESOLVEASSERT(clo[jcol] - ztolzb < sol[jcol] &&
    352               sol[jcol] <= cup[jcol] + ztolzb);
    353349
    354350    // by construction, the last row corrected (if there was one)
     
    367363      acts[irow] += correction * coeff;
    368364
    369       // ? there isn't really a tolerance for tihs
    370       PRESOLVEASSERT(rlo[irow] - ztolzb <= acts[irow] &&
    371                 acts[irow] <= rup[irow] + ztolzb);
    372365    }
    373366
  • trunk/PresolveUseless.cpp

    r55 r56  
    137137    // I don't know if this is always true
    138138    PRESOLVEASSERT(prob->getRowStatus(irow)==PrePostsolveMatrix::basic);
    139     PRESOLVEASSERT(rowduals[irow] == 0.0);   
    140139    // rcosts are unaffected since rowdual is 0
    141140
  • trunk/Test/Makefile.test

    r50 r56  
    2525CXXFLAGS += $(OPTFLAG)
    2626CXXFLAGS += -DUSE_PRESOLVE
    27 #CXXFLAGS += -DCLP_IDIOT
     27CXXFLAGS += -DCLP_IDIOT
    2828#ifeq ($(OPTFLAG),-g)
    2929#    CXXFLAGS += -DCLP_DEBUG -DPRESOLVE_SUMMARY=1
  • trunk/include/PresolveMatrix.hpp

    r55 r56  
    5252#define PRESOLVEASSERT(x)       ((x) ? 1 : ((std::cerr<< "FAILED ASSERTION at line "<< __LINE__ << ":  " #x "\n"), abort(), 0))
    5353#else
    54 #define PRESOLVEASSERT(x)
     54#define PRESOLVEASSERT(x) assert(x)
    5555#define PRESOLVE_STMT(s)
    5656#endif
Note: See TracChangeset for help on using the changeset viewer.