Changeset 1087 for branches


Ignore:
Timestamp:
Aug 19, 2007 5:23:26 PM (12 years ago)
Author:
ladanyi
Message:

committing merging w/ trunk of Clp, Osi, Cbc

Location:
branches/BSP/trunk/Clp/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/BSP/trunk/Clp/src/CbcOrClpParam.cpp

    r1086 r1087  
    10701070  //std::cout<<field<<std::endl;
    10711071  if (field!="EOL") {
    1072     // how do I check valid
    1073     value =  atoi(field.c_str());
    1074     *valid=0;
     1072    const char * start = field.c_str();
     1073    char * endPointer = NULL;
     1074    // check valid
     1075    value =  strtol(start,&endPointer,10);
     1076    if (*endPointer=='\0') {
     1077      *valid = 0;
     1078    } else {
     1079      *valid = 1;
     1080      std::cout<<"String of "<<field;
     1081    }
    10751082  } else {
    10761083    *valid=2;
     
    10981105  //std::cout<<field<<std::endl;
    10991106  if (field!="EOL") {
    1100     // how do I check valid
    1101     value = atof(field.c_str());
    1102     *valid=0;
     1107    const char * start = field.c_str();
     1108    char * endPointer = NULL;
     1109    // check valid
     1110    value =  strtod(start,&endPointer);
     1111    if (*endPointer=='\0') {
     1112      *valid = 0;
     1113    } else {
     1114      *valid = 1;
     1115      std::cout<<"String of "<<field;
     1116    }
    11031117  } else {
    11041118    *valid=2;
     
    12651279                  "off",COMBINE);
    12661280  parameters[numberParameters-1].append("on");
     1281  parameters[numberParameters-1].append("do");
    12671282  parameters[numberParameters-1].setLonghelp
    12681283    (
    12691284     "This switches on a heuristic which does branch and cut on the problem given by just \
    12701285using variables which have appeared in one or more solutions. \
    1271 It obviously only tries after two or more solutions."
     1286It obviously only tries after two or more solutions. \
     1287The Do option switches on before preprocessing."
    12721288     );
    12731289  parameters[numberParameters++]=
     
    14491465 It is initialized to '../../Data/miplib3'"
    14501466     );
     1467#ifdef COIN_HAS_CBC
     1468  parameters[numberParameters++]=
     1469    CbcOrClpParam("doH!euristic","Do heuristics before any preprocessing",
     1470                  DOHEURISTIC,3);
     1471  parameters[numberParameters-1].setLonghelp
     1472    (
     1473     "Normally heuristics are done in branch and bound.  It may be useful to do them outside. \
     1474Doing this may also set cutoff."
     1475     );
     1476#endif
    14511477#ifdef COIN_HAS_CLP
    14521478  parameters[numberParameters++]=
     
    15801606                    "off",FPUMP);
    15811607    parameters[numberParameters-1].append("on");
     1608    parameters[numberParameters-1].append("do");
    15821609  parameters[numberParameters-1].setLonghelp
    15831610    (
    15841611     "This switches on feasibility pump heuristic at root. This is due to Fischetti and Lodi \
    15851612and uses a sequence of Lps to try and get an integer feasible solution. \
    1586 Some fine tuning is available by passFeasibilityPump."
     1613Some fine tuning is available by passFeasibilityPump. Do options does heuristic before preprocessing"
    15871614     );
    15881615  parameters[numberParameters++]=
     
    16461673                  "off",GREEDY);
    16471674  parameters[numberParameters-1].append("on");
    1648   parameters[numberParameters-1].append("root");
     1675  parameters[numberParameters-1].append("do");
     1676  //parameters[numberParameters-1].append("root");
    16491677  parameters[numberParameters-1].setLonghelp
    16501678    (
    16511679     "Switches on a greedy heuristic which will try and obtain a solution.  It may just fix a \
    1652 percentage of variables and then try a small branch and cut run."
     1680percentage of variables and then try a small branch and cut run. \
     1681The Do option switches on before preprocessing."
    16531682     );
    16541683  parameters[numberParameters++]=
     
    23592388                  "off",ROUNDING);
    23602389  parameters[numberParameters-1].append("on");
    2361   parameters[numberParameters-1].setLonghelp
    2362     (
    2363      "This switches on a simple (but effective) rounding heuristic at each node of tree."
     2390  parameters[numberParameters-1].append("do");
     2391  parameters[numberParameters-1].setLonghelp
     2392    (
     2393     "This switches on a simple (but effective) rounding heuristic at each node of tree.  \
     2394The Do option switches on before preprocessing."
    23642395     );
    23652396#endif
     
    26592690     );
    26602691  parameters[numberParameters-1].setIntValue(0);
     2692#ifdef COIN_HAS_CBC
     2693  parameters[numberParameters++]=
     2694    CbcOrClpParam("vub!heuristic","Type of vub heuristic",
     2695                  -2,10,VUBTRY,false);
     2696  parameters[numberParameters-1].setLonghelp
     2697    (
     2698     "If set will try and fix some integer variables"
     2699     );
     2700  parameters[numberParameters-1].setIntValue(-1);
     2701#endif
    26612702  assert(numberParameters<CBCMAXPARAMETERS);
    26622703}
  • branches/BSP/trunk/Clp/src/CbcOrClpParam.hpp

    r1086 r1087  
    6666    NUMBERMINI,MIPOPTIONS,MOREMIPOPTIONS,MAXHOTITS,FPUMPITS,MAXSOLS,
    6767    FPUMPTUNE,TESTOSI,EXTRA1,EXTRA2,EXTRA3,EXTRA4,CUTPASSINTREE,
    68     THREADS,CUTPASS,
     68    THREADS,CUTPASS,VUBTRY,
    6969#ifdef COIN_HAS_CBC
    7070    LOGLEVEL ,
     
    8787    OUTDUPROWS,USERCLP,MODELIN,
    8888
    89     BAB=351,MIPLIB,STRENGTHEN,PRIORITYIN,USERCBC,
     89    BAB=351,MIPLIB,STRENGTHEN,PRIORITYIN,USERCBC,DOHEURISTIC,
    9090
    9191    OSLSTUFF = 401,CBCSTUFF,
     
    175175  /// Sets current parameter option using string
    176176  void setCurrentOption (const std::string value );
     177  /// Returns current parameter option position
     178  inline int currentOptionAsInteger (  ) const
     179  { return currentKeyWord_; }
    177180  /// Sets int value
    178181  void setIntValue ( int value );
  • branches/BSP/trunk/Clp/src/ClpMain.cpp

    r1086 r1087  
    349349            parameters[iParam].setDoubleParameter(models+iModel,value);
    350350          } else if (valid==1) {
    351             abort();
     351            std::cout<<" is illegal for double parameter "<<parameters[iParam].name()<<" value remains "<<
     352              parameters[iParam].doubleValue()<<std::endl;
    352353          } else {
    353354            std::cout<<parameters[iParam].name()<<" has value "<<
     
    382383            parameters[iParam].setIntParameter(models+iModel,value);
    383384          } else if (valid==1) {
    384             abort();
     385            std::cout<<" is illegal for integer parameter "<<parameters[iParam].name()<<" value remains "<<
     386              parameters[iParam].intValue()<<std::endl;
    385387          } else {
    386388            std::cout<<parameters[iParam].name()<<" has value "<<
  • branches/BSP/trunk/Clp/src/ClpSimplex.cpp

    r1060 r1087  
    4545  columnDualInfeasibility_(0.0),
    4646  rowDualInfeasibility_(0.0),
    47   columnDualSequence_(-2),
     47  moreSpecialOptions_(0),
    4848  rowDualSequence_(-2),
    4949  primalToleranceToGetOptimal_(-1.0),
     
    156156  columnDualInfeasibility_(0.0),
    157157  rowDualInfeasibility_(0.0),
    158   columnDualSequence_(-2),
     158  moreSpecialOptions_(0),
    159159  rowDualSequence_(-2),
    160160  primalToleranceToGetOptimal_(-1.0),
     
    16151615  columnDualInfeasibility_(0.0),
    16161616  rowDualInfeasibility_(0.0),
    1617   columnDualSequence_(-2),
     1617  moreSpecialOptions_(0),
    16181618  rowDualSequence_(-2),
    16191619  primalToleranceToGetOptimal_(-1.0),
     
    17191719  columnDualInfeasibility_(0.0),
    17201720  rowDualInfeasibility_(0.0),
    1721   columnDualSequence_(-2),
     1721  moreSpecialOptions_(0),
    17221722  rowDualSequence_(-2),
    17231723  primalToleranceToGetOptimal_(-1.0),
     
    19121912  rowPrimalSequence_ = rhs.rowPrimalSequence_;
    19131913  columnDualInfeasibility_ = rhs.columnDualInfeasibility_;
    1914   columnDualSequence_ = rhs.columnDualSequence_;
     1914  moreSpecialOptions_ = rhs.moreSpecialOptions_;
    19151915  rowDualInfeasibility_ = rhs.rowDualInfeasibility_;
    19161916  rowDualSequence_ = rhs.rowDualSequence_;
     
    40854085*/
    40864086int
    4087 ClpSimplex::tightenPrimalBounds(double factor,int doTight)
     4087ClpSimplex::tightenPrimalBounds(double factor,int doTight,bool tightIntegers)
    40884088{
    40894089 
     
    44994499      }
    45004500    }
     4501    if (tightIntegers&&integerType_) {
     4502      for (iColumn=0;iColumn<numberColumns_;iColumn++) {
     4503        if (integerType_[iColumn]) {
     4504          double value;
     4505          value = floor(columnLower_[iColumn]+0.5);
     4506          if (fabs(value-columnLower_[iColumn])>primalTolerance_)
     4507            value = ceil(columnLower_[iColumn]);
     4508          columnLower_[iColumn]=value;
     4509          value = floor(columnUpper_[iColumn]+0.5);
     4510          if (fabs(value-columnUpper_[iColumn])>primalTolerance_)
     4511            value = floor(columnUpper_[iColumn]);
     4512          columnUpper_[iColumn]=value;
     4513          if (columnLower_[iColumn]>columnUpper_[iColumn])
     4514            numberInfeasible++;
     4515        }
     4516      }
     4517      if (numberInfeasible) {
     4518        handler_->message(CLP_SIMPLEX_INFEASIBILITIES,messages_)
     4519          <<numberInfeasible
     4520          <<CoinMessageEol;
     4521        // restore column bounds
     4522        memcpy(columnLower_,saveLower,numberColumns_*sizeof(double));
     4523        memcpy(columnUpper_,saveUpper,numberColumns_*sizeof(double));
     4524      }
     4525    }
    45014526  } else {
    45024527    handler_->message(CLP_SIMPLEX_INFEASIBILITIES,messages_)
     
    51975222  perturbation_ = otherModel.perturbation_;
    51985223  specialOptions_ = otherModel.specialOptions_;
     5224  moreSpecialOptions_ = otherModel.moreSpecialOptions_;
    51995225  automaticScale_ = otherModel.automaticScale_;
    52005226}
     
    73357361  otherModel.rowPrimalSequence_ = rowPrimalSequence_;
    73367362  otherModel.columnDualInfeasibility_ = columnDualInfeasibility_;
    7337   otherModel.columnDualSequence_ = columnDualSequence_;
     7363  otherModel.moreSpecialOptions_ = moreSpecialOptions_;
    73387364  otherModel.rowDualInfeasibility_ = rowDualInfeasibility_;
    73397365  otherModel.rowDualSequence_ = rowDualSequence_;
  • branches/BSP/trunk/Clp/src/ClpSimplex.hpp

    r1075 r1087  
    362362      in branch and bound on infeasible branches (0.0 is off)
    363363  */
    364   int tightenPrimalBounds(double factor=0.0,int doTight=0);
     364  int tightenPrimalBounds(double factor=0.0,int doTight=0,bool tightIntegers=false);
    365365  /** Crash - at present just aimed at dual, returns
    366366      -2 if dual preferred and crash basis created
     
    863863  inline ClpNonLinearCost * nonLinearCost() const
    864864  { return nonLinearCost_;}
     865  /** Return more special options
     866      1 bit - if presolve says infeasible in ClpSolve return
     867      2 bit - if presolved problem infeasible return
     868  */
     869  inline int moreSpecialOptions() const
     870  { return moreSpecialOptions_;}
     871  /** Set more special options
     872      1 bit - if presolve says infeasible in ClpSolve return
     873      2 bit - if presolved problem infeasible return
     874  */
     875  inline void setMoreSpecialOptions(int value)
     876  { moreSpecialOptions_ = value;}
    865877  //@}
    866878  /**@name status methods */
     
    10811093  /// Worst row dual infeasibility
    10821094  double rowDualInfeasibility_;
    1083   /// Sequence of worst (-1 if feasible)
    1084   int columnDualSequence_;
     1095  /// More special options - see set for details
     1096  int moreSpecialOptions_;
    10851097  /// Sequence of worst (-1 if feasible)
    10861098  int rowDualSequence_;
  • branches/BSP/trunk/Clp/src/ClpSolve.cpp

    r1078 r1087  
    615615        <<CoinMessageEol;
    616616      model2 = this;
    617       if (options.infeasibleReturn()) {
     617      problemStatus_=1; // may be unbounded but who cares
     618      if (options.infeasibleReturn()||(moreSpecialOptions_&1)!=0) {
    618619        return -1;
    619620      }
     
    22472248    if (finalStatus!=3&&(finalStatus||status()==-1)) {
    22482249      int savePerturbation = perturbation();
    2249       setPerturbation(100);
    2250       if (finalStatus==2) {
    2251         // unbounded - get feasible first
    2252         double save = optimizationDirection_;
    2253         optimizationDirection_=0.0;
    2254         primal(1);
    2255         optimizationDirection_=save;
    2256       }
    2257       primal(1);
     2250      if (!finalStatus||(moreSpecialOptions_&2)==0) {
     2251        if (finalStatus==2) {
     2252          // unbounded - get feasible first
     2253          double save = optimizationDirection_;
     2254          optimizationDirection_=0.0;
     2255          primal(1);
     2256          optimizationDirection_=save;
     2257          primal(1);
     2258        } else if (finalStatus==1) {
     2259          dual();
     2260        } else {
     2261          setPerturbation(100);
     2262          primal(1);
     2263        }
     2264      } else {
     2265        // just set status
     2266        problemStatus_=finalStatus;
     2267      }
    22582268      setPerturbation(savePerturbation);
    22592269      numberIterations += numberIterations_;
Note: See TracChangeset for help on using the changeset viewer.