Changeset 982 for branches


Ignore:
Timestamp:
Mar 5, 2007 2:57:39 PM (13 years ago)
Author:
forrest
Message:

try a few more options

Location:
branches/devel/Clp/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/devel/Clp/src/Idiot.cpp

    r933 r982  
    147147#ifndef OSI_IDIOT
    148148  double averageInfeas = model_->sumPrimalInfeasibilities()/((double) model_->numberRows());
    149   if (averageInfeas<0.01&&(strategy_&512)!=0)
     149  if ((averageInfeas<0.01&&(strategy_&512)!=0)||(strategy_&8192)!=0)
    150150    crossOver(16+1);
    151151  else
     
    842842  double * saveUpper = NULL;
    843843  double * saveLower = NULL;
     844  double * saveRowUpper = NULL;
     845  double * saveRowLower = NULL;
     846  bool allowInfeasible = (strategy_&8192)!=0;
    844847  if (addAll<3) {
    845848    saveUpper = new double [ncols];
     
    847850    memcpy(saveUpper,upper,ncols*sizeof(double));
    848851    memcpy(saveLower,lower,ncols*sizeof(double));
     852    if (allowInfeasible) {
     853      saveRowUpper = new double [nrows];
     854      saveRowLower = new double [nrows];
     855      memcpy(saveRowUpper,rowupper,nrows*sizeof(double));
     856      memcpy(saveRowLower,rowlower,nrows*sizeof(double));
     857      double averageInfeas = model_->sumPrimalInfeasibilities()/((double) model_->numberRows());
     858      fixTolerance = CoinMax(fixTolerance,1.0e-5*averageInfeas);
     859    }
    849860  }
    850861  if (slackStart>=0) {
     
    10251036    ClpPresolve pinfo;
    10261037    if (presolve) {
     1038      if (allowInfeasible) {
     1039        // fix up so will be feasible
     1040        double * rhs = new double[nrows];
     1041        memset(rhs,0,nrows*sizeof(double));
     1042        model_->clpMatrix()->times(1.0,colsol,rhs);
     1043        double * rowupper = model_->rowUpper();
     1044        double * rowlower= model_->rowLower();
     1045        double sum = 0.0;
     1046        for (i=0;i<nrows;i++) {
     1047          if (rhs[i]>rowupper[i]) {
     1048            sum += rhs[i]-rowupper[i];
     1049            rowupper[i]=rhs[i];
     1050          }
     1051          if (rhs[i]<rowlower[i]) {
     1052            sum += rowlower[i]-rhs[i];
     1053            rowlower[i]=rhs[i];
     1054          }
     1055        }
     1056        printf("sum of infeasibilities %g\n",sum);
     1057        delete [] rhs;
     1058      }
    10271059      saveModel = model_;
    10281060      model_ = pinfo.presolvedModel(*model_,1.0e-8,false,5);
     
    10511083      model_ = saveModel;
    10521084      saveModel=NULL;
     1085    }
     1086    if (allowInfeasible) {
     1087      memcpy(model_->rowUpper(),saveRowUpper,nrows*sizeof(double));
     1088      memcpy(model_->rowLower(),saveRowLower,nrows*sizeof(double));
     1089      delete [] saveRowUpper;
     1090      delete [] saveRowLower;
     1091      saveRowUpper = NULL;
     1092      saveRowLower = NULL;
    10531093    }
    10541094    if (addAll<2) {
     
    10741114          }
    10751115        }
     1116        delete [] saveUpper;
     1117        delete [] saveLower;
     1118        saveUpper=NULL;
     1119        saveLower=NULL;
    10761120      }
    10771121      printf("Time so far %g, %d now added from previous iterations\n",
     
    11101154          }
    11111155        }
     1156        delete [] saveUpper;
     1157        delete [] saveLower;
     1158        saveUpper=NULL;
     1159        saveLower=NULL;
    11121160        printf("Time so far %g, %d now added from previous iterations\n",
    11131161               CoinCpuTime()-startTime,n);
     
    11771225  baseIts *= 10;
    11781226  maxIts2_ =200+baseIts+5;
     1227  maxIts2_=100;
    11791228  reasonableInfeas_ =((double) nrows)*0.05;
    11801229  lightWeight_=0;
     
    12161265  baseIts *= 10;
    12171266  maxIts2_ =200+baseIts+5;
     1267  maxIts2_=100;
    12181268  reasonableInfeas_ =((double) nrows)*0.05;
    12191269  lightWeight_=0;
  • branches/devel/Clp/src/Idiot.hpp

    r933 r982  
    240240                   512 - crossover
    241241                  2048 - keep lambda across mu change
    242                   4096 - return best solution (not last found) */
     242                  4096 - return best solution (not last found)
     243                  8192 - always do a presolve in crossover */
    243244  int lightWeight_; // 0 - normal, 1 lightweight
    244245};
Note: See TracChangeset for help on using the changeset viewer.