Changeset 1219

Ignore:
Timestamp:
Aug 29, 2009 11:43:24 AM (10 years ago)
Message:

changes to think about heuristic changes

Location:
trunk/Cbc/src
Files:
10 edited

Unmodified
Removed
• trunk/Cbc/src/CbcCompareActual.cpp

 r1173 #define TRY_THIS 0 #if TRY_THIS==0 double weight = CoinMax(weight_,0.0); double weight = CoinMax(weight_,1.0e-9); double testX =  x->objectiveValue()+ weight*x->numberUnsatisfied(); double testY = y->objectiveValue() + weight*y->numberUnsatisfied();
• trunk/Cbc/src/CbcHeuristic.cpp

 r1212 decayFactor_(0.0), switches_(0), whereFrom_(255), whereFrom_((255-2-16)*(1+256)), shallowDepth_(1), howOftenShallow_(1), decayFactor_(0.0), switches_(0), whereFrom_(255), whereFrom_((255-2-16)*(1+256)), shallowDepth_(1), howOftenShallow_(1), CbcHeuristic::shouldHeurRun(int whereFrom) { assert (whereFrom>=0&&whereFrom<8); assert (whereFrom>=0&&whereFrom<16); // take off 8 (code - likes new solution) whereFrom &= 7; if ((whereFrom_&(1<
• trunk/Cbc/src/CbcHeuristic.hpp

 r1211 /** Check whether the heuristic should run at all 0 - before cuts at root node (or from doHeuristics) 1 - before cuts at other nodes 1 - during cuts at root 2 - after root node cuts 3 - after cuts at other nodes 4 added if previous heuristic in loop found solution 4 - during cuts at other nodes 8 added if previous heuristic in loop found solution */ virtual bool shouldHeurRun(int whereFrom); /* Runs if bit set 0 - before cuts at root node (or from doHeuristics) 1 - before cuts at other nodes 1 - during cuts at root 2 - after root node cuts 3 - after cuts at other nodes 4 added if previous heuristic in loop found solution 4 - during cuts at other nodes 8 added if previous heuristic in loop found solution */ int whereFrom_;
• trunk/Cbc/src/CbcHeuristicDive.cpp

 r1211 maxSimplexIterationsAtRoot_ = 1000000; maxTime_ = 600; whereFrom_=16+15; whereFrom_=255-2-16+256; } maxSimplexIterationsAtRoot_ = 1000000; maxTime_ = 600; whereFrom_=16+15; whereFrom_=255-2-16+256; }
• trunk/Cbc/src/CbcHeuristicFPump.cpp

 r1212 int passNumber = model_->getCurrentPassNumber(); // just do once if (!atRoot||passNumber!=1) if (!atRoot) return 0; // probably a good idea //if (model_->getSolutionCount()) return 0; int options = feasibilityPumpOptions_; if ((options%1000000)>0) { int kOption = options/1000000; options = options%1000000; /* Add 10 to do even if solution 1 - do after cuts 2 - do after cuts (not before) 3 - not used do after every cut round (and after cuts) k not used do after every (k-2)th round */ if (kOption<10&&model_->getSolutionCount()) return 0; if (model_->getSolutionCount()) kOption = kOption %10; bool good; if (kOption==1) { good = (passNumber==999999); } else if (kOption==2) { good = (passNumber==999999); passNumber=2; // so won't run before //} else if (kOption==3) { //good = true; } else { //good = (((passNumber-1)%(kOption-2))==0); good = false; } if (passNumber!=1&&!good) return 0; } else { if (passNumber!=1) return 0; } // loop round doing repeated pumps double cutoff; int maximumAllowed=-1; bool moreIterations=false; if (feasibilityPumpOptions_>0) { if (feasibilityPumpOptions_>=1000) maximumAllowed = feasibilityPumpOptions_/1000; int options2 = (feasibilityPumpOptions_%1000)/100; if (options>0) { if (options>=1000) maximumAllowed = options/1000; int options2 = (options%1000)/100; #ifdef RAND_RAND offRandom=options2&1; #endif moreIterations = (options2&2)!=0; secondPassOpt = (feasibilityPumpOptions_/10)%10; secondPassOpt = (options/10)%10; /* 1 to 7 - re-use solution 8 use dual and current solution(ish)
• trunk/Cbc/src/CbcHeuristicFPump.hpp

 r1200 2 - reuse solves, do not accumulate integer solutions for local search 3 - reuse solves, accumulate integer solutions for local search If we add 4 then use second form of problem (with extra rows and variables for general integers) If we add 8 then can run after initial cuts (if no solution) */ inline void setAccumulate(int value) If we do not accumulate solutions then no mini branch and bounds will be done reuse - refers to initial solve after adding in new "cut" If we add 8 then can run after initial cuts (if no solution) */ int accumulate_;
• trunk/Cbc/src/CbcHeuristicRINS.cpp

 r1211 decayFactor_ = 0.5; used_=NULL; whereFrom_=255-15+1+8; whereFrom_=1+8+255*256; } used_ = new char[numberColumns]; memset(used_,0,numberColumns); whereFrom_=255-15+1+8; whereFrom_=1+8+255*256; } { numberTries_=0; whereFrom_=16+1; whereFrom_=256+1; } { numberTries_=0; whereFrom_=16+1; whereFrom_=256+1; }
• trunk/Cbc/src/CbcModel.cpp

 r1216 //const CoinBigIndex * columnStart = matrixByCol.getVectorStarts(); const int * columnLength = matrixByCol->getVectorLengths(); const double * solution = clpSolver->getColSolution(); #if 0 int nAtBound=0; for (int i=0;iisInteger(i)) { double lowerValue=lower[i]; double upperValue=upper[i]; double value=solution[i]; if (valueupperValue-1.0e-6) nAtBound++; } } #endif for (int i=0;ifabs(upperValue)) value = - value; if (clpSolver->isInteger(i)) { double solValue=solution[i]; // Better to add in 0.5 or 1.0?? if (solValueupperValue-1.0e-6) value = -fabs(value)-0.5; //-fabs(value*1.5); } } else { value=0.0; } if (clpSolver->isInteger(i)) value *= 100; fakeObj[i]=value; } if (debugger) { printf("Contains optimal\n") ; OsiSolverInterface * temp = saveSolver->clone(); const double * solution = debugger->optimalSolution(); const double *lower = temp->getColLower() ; const double *upper = temp->getColUpper() ; int n=temp->getNumCols(); for (int i=0;iisInteger(i)) { double value = floor(solution[i]+0.5); assert (value>=lower[i]&&value<=upper[i]); temp->setColLower(i,value); temp->setColUpper(i,value); } } temp->writeMps("reduced_fix"); delete temp; saveSolver->writeMps("reduced"); } else { if (debugger) { printf("Contains optimal\n") ; OsiSolverInterface * temp = saveSolver->clone(); const double * solution = debugger->optimalSolution(); const double *lower = temp->getColLower() ; const double *upper = temp->getColUpper() ; int n=temp->getNumCols(); for (int i=0;iisInteger(i)) { double value = floor(solution[i]+0.5); assert (value>=lower[i]&&value<=upper[i]); temp->setColLower(i,value); temp->setColUpper(i,value); } } temp->writeMps("reduced_fix"); delete temp; saveSolver->writeMps("reduced"); } else { - unless at root node and first pass */ if ((numberNodes_||currentPassNumber_!=1)&&false) { if ((numberNodes_||currentPassNumber_!=1)&&true) { double * newSolution = new double [numberColumns] ; double heuristicValue = getCutoff() ; int found = -1; // no solution found int whereFrom = 3; int whereFrom = numberNodes_ ? 4 : 1; for (i = 0;iexitNow(bestObjective_)) break; CbcHeuristicFPump * pump = dynamic_cast (heuristic_[i]); if (pump) { if (pump&&pump->feasibilityPumpOptions()<1000000) { delete pump; numberHeuristics_ --; setBestSolution(CBC_ROUNDING,heurValue,newSolution) ; foundSolution=1; whereFrom |= 4; // say solution found whereFrom |= 8; // say solution found } } else if (ifSol < 0)       { // just returning an estimate found=iHeuristic; incrementUsed(newSolution); whereFrom |= 4; // say solution found whereFrom |= 8; // say solution found } else if (ifSol<0) { heuristicValue = saveValue;
• trunk/Cbc/src/CbcSolver.cpp

 r1217 int pumpTune2=parameters_[whichParam(FPUMPTUNE2,numberParameters_,parameters_)].intValue(); if (pumpTune>0) { bool printStuff = (pumpTune!=initialPumpTune||logLevel>1) bool printStuff = (pumpTune!=initialPumpTune||logLevel>1||pumpTune2>0) &&!noPrinting_; if (printStuff) { } /* >=10000000 for using obj >=10000000 for using obj >=1000000 use as accumulate switch >=1000 use index+1 as number of large loops int offRandomEtc=0; if (pumpTune2) { if ((pumpTune2/1000)!=0) { offRandomEtc = 1000000*(pumpTune2/1000); if (printStuff) { generalMessageHandler->message(CBC_GENERAL,generalMessages) << "Feasibility pump may run twice" <message(CBC_GENERAL,generalMessages) strongChanged=true; else if (parameters_[iParam].type()==FPUMPTUNE|| parameters_[iParam].type()==FPUMPTUNE2|| parameters_[iParam].type()==FPUMPITS) pumpChanged=true;
• trunk/Cbc/src/unitTestClp.cpp

 r1215 model->solver()->activateRowCutDebugger(problemName.c_str()) ; } if (model->getNumCols()==-1224&&model->getNumRows()<1380) { //PUSH_MPS("gesa2_o",1248,1224,25779856.372,25476489.678,1); // gesa2_o std::string problemName ; model->solver()->getStrParam(OsiProbName,problemName) ; model->solver()->activateRowCutDebugger(problemName.c_str()) ; } if (model->getNumCols()==-1152&&model->getNumRows()==1368) { //PUSH_MPS("gesa3",1368,1152,27991042.648,27833632.451,7);
Note: See TracChangeset for help on using the changeset viewer.