Changeset 1802 for trunk/Cbc/src/CbcHeuristic.cpp
 Timestamp:
 Nov 21, 2012 4:38:56 AM (8 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/Cbc/src/CbcHeuristic.cpp
r1730 r1802 707 707 { 708 708 int saveLogLevel = solver>messageHandler()>logLevel(); 709 if (saveLogLevel == 1) 709 if (saveLogLevel == 1) 710 710 solver>messageHandler()>setLogLevel(0); 711 711 OsiPresolve * pinfo = new OsiPresolve(); … … 838 838 if (solver>isProvenOptimal()) { 839 839 CglPreProcess process; 840 OsiSolverInterface * solver2 = NULL; 840 841 if ((model_>moreSpecialOptions()&65536)!=0) 841 842 process.setOptions(2+4+8); // no cuts 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 843 /* Do not try and produce equality cliques and 844 do up to 2 passes (normally) 5 if restart */ 845 int numberPasses = 2; 846 if (numberNodes < 0) { 847 numberPasses = 5; 848 // Say some rows cuts 849 int numberRows = solver>getNumRows(); 850 if (numberNodes_ < numberRows && true /* think */) { 851 char * type = new char[numberRows]; 852 memset(type, 0, numberNodes_); 853 memset(type + numberNodes_, 1, numberRows  numberNodes_); 854 process.passInRowTypes(type, numberRows); 855 delete [] type; 856 } 857 } 858 if (logLevel <= 1) 859 process.messageHandler()>setLogLevel(0); 859 860 if (!solver>defaultHandler()&& 860 861 solver>messageHandler()>logLevel(0)!=1000) 861 862 process.passInMessageHandler(solver>messageHandler()); 862 OsiSolverInterface *solver2 = process.preProcessNonDefault(*solver, false,863 864 863 solver2 = process.preProcessNonDefault(*solver, false, 864 numberPasses); 865 if (!solver2) { 865 866 if (logLevel > 1) 866 867 printf("Preprocessing says infeasible\n"); 867 868 returnCode = 2; // so will be infeasible 868 869 } else { 869 870 #ifdef COIN_DEVELOP_z 870 871 if (numberNodes < 0) { 871 872 solver2>writeMpsNative("after2.mps", NULL, NULL, 2, 1); 872 873 } 873 874 #endif … … 899 900 // normal 900 901 model.setSpecialOptions(saveModelOptions  2048); 901 if (logLevel <= 1 )902 if (logLevel <= 1 && feasibilityPumpOptions_ != 3) 902 903 model.setLogLevel(0); 903 904 else … … 907 908 model.setCutoff(signedCutoff); 908 909 // Don't do if original fraction > 1.0 and too large 909 if (fractionSmall_>1.0 ) {910 if (fractionSmall_>1.0 && fractionSmall_ < 1000000.0) { 910 911 /* 1.4 means 1 nodes if >.4 911 912 2.4 means 1 nodes if >.5 and 0 otherwise … … 999 1000 #endif 1000 1001 model.setParentModel(*model_); 1001 model.setOriginalColumns(process.originalColumns()); 1002 model.setMaximumSolutions(model_>getMaximumSolutions()); 1003 model.setOriginalColumns(process.originalColumns()); 1002 1004 model.setSearchStrategy(1); 1003 1005 // If no feasibility pump then insert a lightweight one 1004 if (feasibilityPumpOptions_ >= 0 ) {1005 bool gotPump = false;1006 if (feasibilityPumpOptions_ >= 0  feasibilityPumpOptions_ == 2) { 1007 CbcHeuristicFPump * fpump = NULL; 1006 1008 for (int i = 0; i < model.numberHeuristics(); i++) { 1007 const CbcHeuristicFPump* pump = 1008 dynamic_cast<const CbcHeuristicFPump*>(model.heuristic(i)); 1009 if (pump) 1010 gotPump = true; 1009 CbcHeuristicFPump* pump = 1010 dynamic_cast<CbcHeuristicFPump*>(model.heuristic(i)); 1011 if (pump) { 1012 fpump = pump; 1013 break; 1014 } 1011 1015 } 1012 if (! gotPump) {1016 if (!fpump) { 1013 1017 CbcHeuristicFPump heuristic4; 1014 1018 // use any cutoff … … 1017 1021 heuristic4.setMaximumPasses(10); 1018 1022 int pumpTune = feasibilityPumpOptions_; 1023 if (pumpTune==2) 1024 pumpTune = 4; // proximity 1019 1025 if (pumpTune > 0) { 1020 1026 /* … … 1073 1079 } 1074 1080 model.addHeuristic(&heuristic4, "feasibility pump", 0); 1081 1075 1082 } 1076 } 1083 } else if (feasibilityPumpOptions_==3) { 1084 // add all (except this) 1085 for (int i = 0; i < model_>numberHeuristics(); i++) { 1086 if (strcmp(heuristicName(),model_>heuristic(i)>heuristicName())) 1087 model.addHeuristic(model_>heuristic(i)); 1088 } 1089 } 1077 1090 //printf("sol %x\n",inputSolution_); 1078 1091 if (inputSolution_) { … … 1169 1182 #define ALWAYS_DUAL 1170 1183 #ifdef ALWAYS_DUAL 1171 OsiSolverInterface * solver = model.solver();1184 OsiSolverInterface * solverD = model.solver(); 1172 1185 bool takeHint; 1173 1186 OsiHintStrength strength; 1174 solver >getHintParam(OsiDoDualInResolve, takeHint, strength);1175 solver >setHintParam(OsiDoDualInResolve, true, OsiHintDo);1187 solverD>getHintParam(OsiDoDualInResolve, takeHint, strength); 1188 solverD>setHintParam(OsiDoDualInResolve, true, OsiHintDo); 1176 1189 #endif 1177 1190 model.passInEventHandler(model_>getEventHandler()); … … 1182 1195 model_>setSpecialOptions(saveOptions); 1183 1196 #ifdef ALWAYS_DUAL 1184 solver = model.solver();1185 solver >setHintParam(OsiDoDualInResolve, takeHint, strength);1197 solverD = model.solver(); 1198 solverD>setHintParam(OsiDoDualInResolve, takeHint, strength); 1186 1199 #endif 1187 1200 #ifdef COIN_DEVELOP … … 1238 1251 } 1239 1252 #endif 1240 process.postProcess(*model.solver()); 1253 //if (fractionSmall_ < 1000000.0) 1254 process.postProcess(*model.solver()); 1241 1255 if (solver>isProvenOptimal() && solver>getObjValue()*solver>getObjSense() < cutoff) { 1242 1256 // Solution now back in solver … … 1256 1270 process.numberIterationsPre() + 1257 1271 process.numberIterationsPost(); 1258 if (totalNumberIterations > 100*(numberNodes + 10)) { 1272 if (totalNumberIterations > 100*(numberNodes + 10) 1273 && fractionSmall_ < 1000000.0) { 1259 1274 // only allow smaller problems 1260 1275 fractionSmall = fractionSmall_;
Note: See TracChangeset
for help on using the changeset viewer.