/usr/src/RPM/BUILD/CoinBlis-0.93.5/Blis/src/BlisParams.h
Go to the documentation of this file.
00001 /*===========================================================================*
00002  * This file is part of the BiCePS Linear Integer Solver (BLIS).             *
00003  *                                                                           *
00004  * BLIS is distributed under the Eclipse Public License as part of the       *
00005  * COIN-OR repository (http://www.coin-or.org).                              *
00006  *                                                                           *
00007  * Authors:                                                                  *
00008  *                                                                           *
00009  *          Yan Xu, Lehigh University                                        *
00010  *          Ted Ralphs, Lehigh University                                    *
00011  *                                                                           *
00012  * Conceptual Design:                                                        *
00013  *                                                                           *
00014  *          Yan Xu, Lehigh University                                        *
00015  *          Ted Ralphs, Lehigh University                                    *
00016  *          Laszlo Ladanyi, IBM T.J. Watson Research Center                  *
00017  *          Matthew Saltzman, Clemson University                             *
00018  *                                                                           * 
00019  *                                                                           *
00020  * Copyright (C) 2001-2013, Lehigh University, Yan Xu, and Ted Ralphs.       *
00021  * All Rights Reserved.                                                      *
00022  *===========================================================================*/
00023 
00024 #ifndef BlisParams_h
00025 #define BlisParams_h
00026 
00027 #include "AlpsKnowledge.h"
00028 #include "AlpsParameterBase.h"
00029 
00030 #include "Blis.h"
00031 
00032 //#############################################################################
00033 
00034 //** Parameters used in Blis. */
00035 class BlisParams : public AlpsParameterSet {
00036  public:
00039   enum chrParams{
00042       cutRampUp,
00044       presolve,
00047       shareConstraints,
00050       shareVariables,
00053       sharePseudocostRampUp,
00056       sharePseudocostSearch,
00057       //
00058       endOfChrParams
00059   };
00060   
00062   enum intParams{
00063 
00071       branchStrategy,
00072       branchStrategyRampUp,
00073 
00080       cutStrategy, 
00081       cutGenerationFrequency,
00082       
00083       cutPass,      
00084       quickCutPass, 
00086       cutCliqueStrategy,
00087       cutGomoryStrategy,
00088       cutFlowCoverStrategy,
00089       cutKnapsackStrategy,
00090       cutMirStrategy,
00091       cutOddHoleStrategy,
00092       cutProbingStrategy,
00093       cutTwoMirStrategy,
00094       cutCliqueFreq,
00095       cutGomoryFreq,
00096       cutFlowCoverFreq,
00097       cutKnapsackFreq,
00098       cutMirFreq,
00099       cutOddHoleFreq,
00100       cutProbingFreq,
00101       cutTwoMirFreq,
00102       
00104       difference,
00105       
00112       heurStrategy, 
00113       heurCallFrequency,
00114       heurRoundStrategy,
00115       heurRoundFreq,
00116       
00118       lookAhead,
00120       pseudoRelibility,
00121 
00123       sharePcostDepth,
00125       sharePcostFrequency,
00127       strongCandSize,
00129       endOfIntParams
00130   };
00131 
00133   enum dblParams{
00136       cutFactor,
00137       
00139       cutoff,
00142       cutoffInc,
00143 
00145       denseConFactor,
00146       
00148       integerTol,
00149 
00151       objSense,
00152 
00155       optimalRelGap,
00156       
00159       optimalAbsGap,
00160       
00162       pseudoWeight,
00163 
00165       scaleConFactor,
00166 
00168       tailOff,
00170       endOfDblParams
00171   };
00172 
00174   enum strParams{
00175       strDummy,
00176       //
00177       endOfStrParams
00178   };
00179 
00181   enum strArrayParams{
00182       strArrayDummy,
00184       endOfStrArrayParams
00185   };
00186 
00187  public:
00193   BlisParams() :
00194     AlpsParameterSet(
00195                      static_cast<int>(endOfChrParams),
00196                      static_cast<int>(endOfIntParams),
00197                      static_cast<int>(endOfDblParams),
00198                      static_cast<int>(endOfStrParams),
00199                      static_cast<int>(endOfStrArrayParams)
00200                      )
00201     {
00202       createKeywordList();
00203       setDefaultEntries();
00204     }
00209   virtual void createKeywordList();
00211   virtual void setDefaultEntries();
00215  public:
00216   //===========================================================================
00224   //===========================================================================
00225 
00226   
00235 
00236   inline bool entry(const chrParams key) const { return bpar_[key]; }
00238   inline int entry(const intParams key) const { return ipar_[key]; }
00240   inline double  entry(const dblParams key) const { return dpar_[key]; }
00242   inline const std::string&
00243     entry(const strParams key) const { return spar_[key]; }
00245   inline const std::vector<std::string>&
00246     entry(const strArrayParams key) const { return sapar_[key]; }
00249   //---------------------------------------------------------------------------
00251   void setEntry(const chrParams key, const char * val) {
00252           bpar_[key] = atoi(val) ? true : false; }
00254   void setEntry(const chrParams key, const char val) {
00255           bpar_[key] = val ? true : false; }
00257   void setEntry(const chrParams key, const bool val) {
00258     bpar_[key] = val; }
00260   void setEntry(const intParams key, const char * val) {
00261     ipar_[key] = atoi(val); }
00263   void setEntry(const intParams key, const int val) {
00264     ipar_[key] = val; }
00266   void setEntry(const dblParams key, const char * val) {
00267     dpar_[key] = atof(val); }
00269   void setEntry(const dblParams key, const double val) {
00270     dpar_[key] = val; }
00272   void setEntry(const strParams key, const char * val) {
00273     spar_[key] = val; }
00275   void setEntry(const strArrayParams key, const char *val) {
00276     sapar_[key].push_back(val); }
00277 
00278   //---------------------------------------------------------------------------
00279 
00284   void pack(AlpsEncoded& buf) {
00285     buf.writeRep(bpar_, endOfChrParams)
00286       .writeRep(ipar_, endOfIntParams)
00287       .writeRep(dpar_, endOfDblParams);
00288     for (int i = 0; i < endOfStrParams; ++i)
00289       buf.writeRep(spar_[i]);
00290     for (int i = 0; i < endOfStrArrayParams; ++i) {
00291       buf.writeRep(sapar_[i].size());
00292       for (size_t j = 0; j < sapar_[i].size(); ++j)
00293         buf.writeRep(sapar_[i][j]);
00294     }
00295   }
00297   void unpack(AlpsEncoded& buf) {
00298     int dummy;
00299     // No need to allocate the arrays, they are of fixed length
00300     dummy = static_cast<int>(endOfChrParams);
00301     buf.readRep(bpar_, dummy, false);
00302     dummy = static_cast<int>(endOfIntParams);
00303     buf.readRep(ipar_, dummy, false);
00304     dummy = static_cast<int>(endOfDblParams);
00305     buf.readRep(dpar_, dummy, false);
00306     for (int i = 0; i < endOfStrParams; ++i)
00307       buf.readRep(spar_[i]);
00308     for (int i = 0; i < endOfStrArrayParams; ++i) {
00309       size_t str_size;
00310       buf.readRep(str_size);
00311       sapar_[i].reserve(str_size);
00312       for (size_t j = 0; j < str_size; ++j){
00313         //      sapar_[i].unchecked_push_back(std::string());
00314         sapar_[i].push_back(std::string());
00315         buf.readRep(sapar_[i].back());
00316       }
00317     }
00318   }
00321 };
00322 
00323 #endif