- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

# /home/coin/svn-release/Blis-0.93.10/Bcps/examples/Blis/BlisParams.h

Go to the documentation of this file.

    00001 /*===========================================================================*
    00002  * This file is part of the Bcps Linear 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
    00031 //#############################################################################
    00032 //#############################################################################
    00033
    00034 //** Parameters used in Blis. */
    00035 class BlisParams : public AlpsParameterSet {
    00036  public:
    00039   enum boolParams{
    00041     useCons,
    00043     useHeuristics,
    00045     cutDuringRampup,
    00046     //
    00047     endOfBoolParams
    00048   };
    00049
    00051   enum intParams{
    00053       strongCandSize,
    00054
    00057
    00064       branchStrategy,
    00065
    00072       heurRound,
    00073
    00080       cutClique,
    00081       cutGomory,
    00082       cutFlowCover,
    00083       cutKnapsack,
    00084       cutMir,
    00085       cutOddHole,
    00086       cutProbing,
    00087       cutTwoMir,
    00089       pseudoRelibility,
    00091       lookAhead,
    00092       //
    00093       endOfIntParams
    00094   };
    00095
    00097   enum dblParams{
    00099     integerTol,
    00100
    00103     cutoffInc,
    00104
    00107     optimalRelGap,
    00108
    00111     optimalAbsGap,
    00112
    00114     pseudoWeight,
    00115
    00118     cutFactor,
    00119
    00121     denseConFactor,
    00122
    00124     scaleConFactor,
    00125     //
    00126     endOfDblParams
    00127   };
    00128
    00130   enum strParams{
    00131     strDummy,
    00132     //
    00133     endOfStrParams
    00134   };
    00135
    00137   enum strArrayParams{
    00138     strArrayDummy,
    00139     //
    00140     endOfStrArrayParams
    00141   };
    00142
    00143  public:
    00149   BlisParams() :
    00150     AlpsParameterSet(
    00151                      static_cast<int>(endOfBoolParams),
    00152                      static_cast<int>(endOfIntParams),
    00153                      static_cast<int>(endOfDblParams),
    00154                      static_cast<int>(endOfStrParams),
    00155                      static_cast<int>(endOfStrArrayParams)
    00156                      )
    00157     {
    00158       createKeywordList();
    00159       setDefaultEntries();
    00160     }
    00165   virtual void createKeywordList();
    00167   virtual void setDefaultEntries();
    00171  public:
    00172   //===========================================================================
    00180   //===========================================================================
    00181
    00182
    00191
    00192   inline bool entry(const boolParams key) const { return bpar_[key]; }
    00194   inline int entry(const intParams key) const { return ipar_[key]; }
    00196   inline double  entry(const dblParams key) const { return dpar_[key]; }
    00198   inline const std::string&
    00199     entry(const strParams key) const { return spar_[key]; }
    00201   inline const std::vector<std::string>&
    00202     entry(const strArrayParams key) const { return sapar_[key]; }
    00205   //---------------------------------------------------------------------------
    00207   void setEntry(const boolParams key, const char * val) {
    00208           bpar_[key] = atoi(val) ? true : false; }
    00210   void setEntry(const boolParams key, const char val) {
    00211           bpar_[key] = val ? true : false; }
    00213   void setEntry(const boolParams key, const bool val) {
    00214     bpar_[key] = val; }
    00216   void setEntry(const intParams key, const char * val) {
    00217     ipar_[key] = atoi(val); }
    00219   void setEntry(const intParams key, const int val) {
    00220     ipar_[key] = val; }
    00222   void setEntry(const dblParams key, const char * val) {
    00223     dpar_[key] = atof(val); }
    00225   void setEntry(const dblParams key, const double val) {
    00226     dpar_[key] = val; }
    00228   void setEntry(const strParams key, const char * val) {
    00229     spar_[key] = val; }
    00231   void setEntry(const strArrayParams key, const char *val) {
    00232     sapar_[key].push_back(val); }
    00233
    00234   //---------------------------------------------------------------------------
    00235
    00240   void pack(AlpsEncoded& buf) {
    00241     buf.writeRep(bpar_, endOfBoolParams)
    00242       .writeRep(ipar_, endOfIntParams)
    00243       .writeRep(dpar_, endOfDblParams);
    00244     for (int i = 0; i < endOfStrParams; ++i)
    00245       buf.writeRep(spar_[i]);
    00246     for (int i = 0; i < endOfStrArrayParams; ++i) {
    00247       buf.writeRep(sapar_[i].size());
    00248       for (size_t j = 0; j < sapar_[i].size(); ++j)
    00249         buf.writeRep(sapar_[i][j]);
    00250     }
    00251   }
    00253   void unpack(AlpsEncoded& buf) {
    00254     int dummy;
    00255     // No need to allocate the arrays, they are of fixed length
    00256     dummy = static_cast<int>(endOfBoolParams);
    00257     buf.readRep(bpar_, dummy, false);
    00258     dummy = static_cast<int>(endOfIntParams);
    00259     buf.readRep(ipar_, dummy, false);
    00260     dummy = static_cast<int>(endOfDblParams);
    00261     buf.readRep(dpar_, dummy, false);
    00262     for (int i = 0; i < endOfStrParams; ++i)
    00263       buf.readRep(spar_[i]);
    00264     for (int i = 0; i < endOfStrArrayParams; ++i) {
    00265       size_t str_size;
    00266       buf.readRep(str_size);
    00267       sapar_[i].reserve(str_size);
    00268       for (size_t j = 0; j < str_size; ++j){
    00269         //      sapar_[i].unchecked_push_back(std::string());
    00270         sapar_[i].push_back(std::string());
    00271         buf.readRep(sapar_[i].back());
    00272       }
    00273     }
    00274   }
    00277 };
    00278
    00279 #endif