Changeset 975
 Timestamp:
 Jun 10, 2008 5:53:54 PM (12 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

branches/dynamicbranching/dynamicbranching.cpp
r974 r975 1052 1052 // solve LP 1053 1053 model.initialSolve(); 1054 int funnyBranching=FUNNY_BRANCHING;1055 1054 1056 1055 if (model.isProvenOptimal()&&!model.isDualObjectiveLimitReached()) { … … 1200 1199 abort(); 1201 1200 } 1201 if (model.isIterationLimitReached()) { 1202 // maximum iterations  exit 1203 std::cout<<"Exiting on maximum iterations\n"; 1204 break; 1205 } 1206 1202 1207 while (node.canSwitchParentWithGrandparent(which, model, 1203 1208 originalLower, … … 1206 1211 branchingTree.moveNodeUp(which, model, node); 1207 1212 } 1208 if (!model.isIterationLimitReached()) { 1209 if (model.isProvenOptimal()&&!model.isDualObjectiveLimitReached()) { 1210 if ((numberNodes%1000)==0) 1211 printf("%d nodes, tree size %d\n", 1212 numberNodes,branchingTree.size()); 1213 if (CoinCpuTime()time1>3600.0) { 1214 printf("stopping after 3600 seconds\n"); 1215 exit(77); 1216 } 1217 DBNodeSimple newNode(model,numberIntegers,which,ws); 1218 // something extra may have been fixed by strong branching 1219 // if so go round again 1220 while (newNode.variable_==numberIntegers) { 1221 model.resolve(); 1222 newNode = DBNodeSimple(model,numberIntegers,which,model.getWarmStart()); 1223 newNode.strong_branching_fixed_vars_ = true; 1224 } 1225 newNode.reduced_cost_fixed_vars_ = did_reduced_cost_fixing_for_child; 1226 if (newNode.objectiveValue_<1.0e100) { 1227 if (newNode.variable_>=0) 1228 assert (fabs(newNode.value_floor(newNode.value_+0.5))>1.0e6); 1229 newNode.parent_ = kNode; 1230 // push on stack 1231 branchingTree.push_back(newNode); 1232 if(branchingTree.nodes_[kNode].child_down_ < 0) 1233 branchingTree.nodes_[kNode].child_down_ = branchingTree.last_; 1234 else 1235 branchingTree.nodes_[kNode].child_up_ = branchingTree.last_; 1213 if ((numberNodes%1000)==0) 1214 printf("%d nodes, tree size %d\n", 1215 numberNodes,branchingTree.size()); 1216 if (CoinCpuTime()time1>3600.0) { 1217 printf("stopping after 3600 seconds\n"); 1218 exit(77); 1219 } 1220 DBNodeSimple newNode(model,numberIntegers,which,ws); 1221 // something extra may have been fixed by strong branching 1222 // if so go round again 1223 while (newNode.variable_==numberIntegers) { 1224 model.resolve(); 1225 newNode = DBNodeSimple(model,numberIntegers,which,model.getWarmStart()); 1226 newNode.strong_branching_fixed_vars_ = true; 1227 } 1228 newNode.reduced_cost_fixed_vars_ = did_reduced_cost_fixing_for_child; 1229 if (newNode.objectiveValue_<1.0e100) { 1230 newNode.parent_ = kNode; 1231 // push on stack 1232 branchingTree.push_back(newNode); 1233 if(branchingTree.nodes_[kNode].child_down_ < 0) 1234 branchingTree.nodes_[kNode].child_down_ = branchingTree.last_; 1235 else 1236 branchingTree.nodes_[kNode].child_up_ = branchingTree.last_; 1237 if (newNode.variable_>=0) { 1238 assert (fabs(newNode.value_floor(newNode.value_+0.5))>1.0e6); 1239 } 1236 1240 #if 0 1237 }else {1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1241 else { 1242 // integer solution  save 1243 bestNode = node; 1244 // set cutoff (hard coded tolerance) 1245 model.setDblParam(OsiDualObjectiveLimit,(bestNode.objectiveValue_1.0e5)*direction); 1246 std::cout<<"Integer solution of " 1247 <<bestNode.objectiveValue_ 1248 <<" found after "<<numberIterations 1249 <<" iterations and "<<numberNodes<<" nodes" 1250 <<std::endl; 1251 } 1248 1252 #endif 1249 } 1250 } 1251 } else { 1252 // maximum iterations  exit 1253 std::cout<<"Exiting on maximum iterations" 1254 <<std::endl; 1255 break; 1256 } 1253 } 1254 } 1257 1255 } else { 1258 // integer solution  save1256 // Integer solution  save 1259 1257 bestNode = node; 1260 1258 // set cutoff (hard coded tolerance)
Note: See TracChangeset
for help on using the changeset viewer.