Changeset 1982


Ignore:
Timestamp:
May 27, 2012 6:57:36 AM (7 years ago)
Author:
pbonami
Message:

Merge with trunk

Location:
stable/1.6/Bonmin/src
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • stable/1.6/Bonmin/src

  • stable/1.6/Bonmin/src/Algorithms/BonBabSetupBase.cpp

    r1928 r1982  
    373373    options->GetNumericValue("time_limit", doubleParam_[MaxTime],prefix_.c_str());
    374374
    375 
    376375    int ival;
     376    int seed = 0;
     377    ival = options->GetIntegerValue("random_generator_seed",seed,prefix_.c_str());
     378    if(seed == -1)
     379      CoinSeedRandom(CoinGetTimeOfDay());
     380    else if (ival != 0) CoinSeedRandom(seed);
     381
    377382    options->GetEnumValue("node_comparison",ival,prefix_.c_str());
    378383    nodeComparisonMethod_ = NodeComparison(ival);
     
    439444
    440445    roptions->SetRegisteringCategory("Branch-and-bound options", RegisteredOptions::BonminCategory);
     446
     447  roptions->AddLowerBoundedIntegerOption
     448  ("random_generator_seed",
     449   "Set seed for random number generator (a value of -1 sets seeds to time since Epoch).",
     450   -1,0,
     451   "");
     452  roptions->setOptionExtraInfo("random_generator_seed",127);
    441453
    442454    roptions->AddLowerBoundedNumberOption("time_limit",
  • stable/1.6/Bonmin/src/Algorithms/BonBonminSetup.cpp

    r1946 r1982  
    712712    options_->GetEnumValue("variable_selection",varSelection,prefix_.c_str());
    713713    if (varSelection > RELIABILITY_BRANCHING) {
    714       std::cout<<"Variable selection stragey not available with oa branch-and-cut."<<std::endl;
     714      switch (varSelection){
     715        case OSI_SIMPLE:
     716          continuousSolver_->findIntegersAndSOS(false);
     717          setPriorities();
     718          addSos();
     719          branchingMethod_ = new OsiChooseVariable(nonlinearSolver_);
     720   
     721          break;
     722        case OSI_STRONG:
     723          {
     724          continuousSolver_->findIntegersAndSOS(false);
     725          setPriorities();
     726          addSos();
     727          OsiChooseStrong * chooser = new OsiChooseStrong(nonlinearSolver_);
     728          branchingMethod_ = chooser;
     729          chooser->setNumberStrong(intParam_[NumberStrong]);
     730          chooser->setTrustStrongForSolution(false);
     731          chooser->setNumberBeforeTrusted(intParam_[MinReliability]);
     732          }
     733          break;
     734        default:
     735          std::cout<<"Variable selection stragey not available with oa branch-and-cut."<<std::endl;
     736          break;
     737     }
    715738    }
    716739    /* Populate cut generation and heuristic procedures.*/
  • stable/1.6/Bonmin/src/Algorithms/Branching/BonLpBranchingSolver.cpp

    r1858 r1982  
    118118    std::vector<double> diff_up_bnd_value;
    119119
    120 #if 0
    121     // deleteme
    122     for (int i=0; i<tminlp_interface->getNumCols(); i++) {
    123       printf("%3d ol = %e nl = %e   ou = %e nu = %e\n",i,tminlp_interface->getColLower()[i],lin_->getColLower()[i],tminlp_interface->getColUpper()[i],lin_->getColUpper()[i]);
    124     }
    125 #endif
    126120    // Get the bounds.  We assume that the bounds in the linear solver
    127121    // are always the original ones
     
    159153    }
    160154
    161 #if 0
    162     // deleteme
    163     for (int i=0; i<numCols; i++) {
    164       printf("%3d ol = %e nl = %e   ou = %e nu = %e\n",i,tminlp_interface->getColLower()[i],lin_->getColLower()[i],tminlp_interface->getColUpper()[i],lin_->getColUpper()[i]);
    165     }
    166 #endif
    167155    if(warm_start_mode_ == Basis){
    168156      lin->setWarmStart(warm_);
  • stable/1.6/Bonmin/src/Algorithms/OaGenerators/BonOaDecBase.cpp

    r1967 r1982  
    288288       if(savedCuts_.rowCut(i).violated(colsol) > 0.){
    289289#ifdef OA_DEBUG
    290          printf("A violated cut has been found\n");
     290         printf("A violated saved cut has been found\n");
    291291#endif
    292292         savedCuts_.rowCut(i).setEffectiveness(9.99e99);
  • stable/1.6/Bonmin/src/Algorithms/OaGenerators/BonOaFeasChecker.cpp

    r1865 r1982  
    6666        //nlp solved and feasible
    6767        // Update the cutoff
    68         cutoff = nlp_->getObjValue() *(1 - parameters_.cbcCutoffIncrement_);
     68        double ub = nlp_->getObjValue();
     69        cutoff = ub > 0 ? ub *(1 - parameters_.cbcCutoffIncrement_) : ub*(1 + parameters_.cbcCutoffIncrement_);
    6970        // Update the lp solver cutoff
    7071        lp->setDblParam(OsiDualObjectiveLimit, cutoff);
     
    107108      if (changed) {
    108109       branch_info.solution_ = lp->getColSolution();
    109         isInteger = integerFeasible(*lp,branch_info, parameters_.cbcIntegerTolerance_,
     110       isInteger = integerFeasible(*lp,branch_info, parameters_.cbcIntegerTolerance_,
    110111                                     objects_, nObjects_);
    111112      }
  • stable/1.6/Bonmin/src/Interfaces/BonOsiTMINLPInterface.cpp

    r1967 r1982  
    18761876    double infty)
    18771877{
     1878  //return 1;
    18781879  if(fabs(value)>= tiny) return 1;
    18791880
     
    18861887  bool rowNotUpBounded = rowUpper >= infty;
    18871888  bool pos =  value > 0;
    1888 
    1889   if(colLoBounded && pos && rowNotUpBounded) {
    1890     lb += value * (colsol - colLower);
     1889  if(colUpBounded && pos && rowNotUpBounded) {
     1890    lb += value * (colsol - colUpper);
    18911891    return 0;
    18921892  }
    18931893  else
    1894     if(colLoBounded && !pos && rowNotLoBounded) {
    1895       ub += value * (colsol - colLower);
     1894    if(colUpBounded && !pos && rowNotLoBounded) {
     1895      ub += value * (colsol - colUpper);
    18961896      return 0;
    18971897    }
    18981898    else
    1899       if(colUpBounded && !pos && rowNotUpBounded) {
    1900         lb += value * (colsol - colUpper);
     1899      if(colLoBounded && !pos && rowNotUpBounded) {
     1900        lb += value * (colsol - colLower);
    19011901        return 0;
    19021902      }
    19031903      else
    1904         if(colUpBounded && pos && rowNotLoBounded) {
    1905           ub += value * (colsol - colUpper);
     1904        if(colLoBounded && pos && rowNotLoBounded) {
     1905          ub += value * (colsol - colLower);
    19061906          return 0;
    19071907        }
    1908   //can not remove coefficient increase it to smallest non zero
    1909   if(pos) value = tiny;
    1910   else
    1911     value = - tiny;
     1908  //can not remove coefficient
    19121909  return 1;
    19131910}
     
    20352032      newCut.setGloballyValidAsInteger(1);
    20362033    }
    2037     if(fabs(lb[cutIdx]) < tiny_) lb[cutIdx] = 0;
    2038     if(fabs(ub[cutIdx]) < tiny_) ub[cutIdx] = 0;
     2034    //if(fabs(lb[cutIdx]) < tiny_) lb[cutIdx] = 0;
     2035    //if(fabs(ub[cutIdx]) < tiny_) ub[cutIdx] = 0;
    20392036    newCut.setLb(lb[cutIdx]);
    20402037    newCut.setUb(ub[cutIdx]);
  • stable/1.6/Bonmin/src/Interfaces/Makefile.am

    r1978 r1982  
    7979     BonTNLP2FPNLP.hpp \
    8080     BonCutStrengthener.hpp \
    81      BonStrongBranchingSolver.hpp \
    8281     BonTNLPSolver.hpp \
    8382     BonBranchingTQP.hpp \
     83     BonStrongBranchingSolver.hpp \
     84     BonTMINLP2OsiLP.hpp \
    8485     BonTypes.hpp \
    85      BonTMINLP2OsiLP.hpp \
    8686     BonRegisteredOptions.hpp
    8787
  • stable/1.6/Bonmin/src/Interfaces/Makefile.in

    r1978 r1982  
    378378     BonTNLPSolver.hpp \
    379379     BonBranchingTQP.hpp \
     380     BonStrongBranchingSolver.hpp \
     381     BonTMINLP2OsiLP.hpp \
    380382     BonTypes.hpp \
    381383     BonTMINLP2OsiLP.hpp \
Note: See TracChangeset for help on using the changeset viewer.