/home/coin/SVN-release/CoinAll-1.1.0/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 Common 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-2005, International Business Machines                  *
00021  * Corporation, Lehigh University, Yan Xu, Ted Ralphs, Matthew Salzman and   *
00022  * others. All Rights Reserved.                                              *
00023  *===========================================================================*/
00024 
00025 #ifndef BlisParams_h
00026 #define BlisParams_h
00027 
00028 #include "AlpsKnowledge.h"
00029 #include "AlpsParameterBase.h"
00030 
00031 
00032 //#############################################################################
00033 //#############################################################################
00034 
00035 //** Parameters used in Blis. */
00036 class BlisParams : public AlpsParameterSet {
00037  public:
00040   enum boolParams{
00042     useCons,
00044     useHeuristics,
00046     cutDuringRampup,
00047     //
00048     endOfBoolParams
00049   };
00050   
00052   enum intParams{
00054       strongCandSize,
00055 
00058 
00065       branchStrategy,
00066 
00073       heurRound,
00074 
00081       cutClique,
00082       cutGomory,
00083       cutFlowCover,
00084       cutKnapsack,
00085       cutMir,
00086       cutOddHole,
00087       cutProbing,
00088       cutTwoMir,
00090       pseudoRelibility,
00092       lookAhead,
00093       //
00094       endOfIntParams
00095   };
00096 
00098   enum dblParams{
00100     integerTol,
00101 
00104     cutoffInc,
00105     
00108     optimalRelGap,
00109 
00112     optimalAbsGap,
00113 
00115     pseudoWeight,
00116 
00119     cutFactor,
00120 
00122     denseConFactor,
00123 
00125     scaleConFactor,
00126     //
00127     endOfDblParams
00128   };
00129 
00131   enum strParams{
00132     strDummy,
00133     //
00134     endOfStrParams
00135   };
00136 
00138   enum strArrayParams{
00139     strArrayDummy,
00140     //
00141     endOfStrArrayParams
00142   };
00143 
00144  public:
00150   BlisParams() :
00151     AlpsParameterSet(
00152                      static_cast<int>(endOfBoolParams),
00153                      static_cast<int>(endOfIntParams),
00154                      static_cast<int>(endOfDblParams),
00155                      static_cast<int>(endOfStrParams),
00156                      static_cast<int>(endOfStrArrayParams)
00157                      )
00158     {
00159       createKeywordList();
00160       setDefaultEntries();
00161     }
00166   virtual void createKeywordList();
00168   virtual void setDefaultEntries();
00172  public:
00173   //===========================================================================
00181   //===========================================================================
00182 
00183   
00192 
00193   inline bool entry(const boolParams key) const { return bpar_[key]; }
00195   inline int entry(const intParams key) const { return ipar_[key]; }
00197   inline double  entry(const dblParams key) const { return dpar_[key]; }
00199   inline const std::string&
00200     entry(const strParams key) const { return spar_[key]; }
00202   inline const std::vector<std::string>&
00203     entry(const strArrayParams key) const { return sapar_[key]; }
00206   //---------------------------------------------------------------------------
00208   void setEntry(const boolParams key, const char * val) {
00209           bpar_[key] = atoi(val) ? true : false; }
00211   void setEntry(const boolParams key, const char val) {
00212           bpar_[key] = val ? true : false; }
00214   void setEntry(const boolParams key, const bool val) {
00215     bpar_[key] = val; }
00217   void setEntry(const intParams key, const char * val) {
00218     ipar_[key] = atoi(val); }
00220   void setEntry(const intParams key, const int val) {
00221     ipar_[key] = val; }
00223   void setEntry(const dblParams key, const char * val) {
00224     dpar_[key] = atof(val); }
00226   void setEntry(const dblParams key, const double val) {
00227     dpar_[key] = val; }
00229   void setEntry(const strParams key, const char * val) {
00230     spar_[key] = val; }
00232   void setEntry(const strArrayParams key, const char *val) {
00233     sapar_[key].push_back(val); }
00234 
00235   //---------------------------------------------------------------------------
00236 
00241   void pack(AlpsEncoded& buf) {
00242     buf.writeRep(bpar_, endOfBoolParams)
00243       .writeRep(ipar_, endOfIntParams)
00244       .writeRep(dpar_, endOfDblParams);
00245     for (int i = 0; i < endOfStrParams; ++i)
00246       buf.writeRep(spar_[i]);
00247     for (int i = 0; i < endOfStrArrayParams; ++i) {
00248       buf.writeRep(sapar_[i].size());
00249       for (size_t j = 0; j < sapar_[i].size(); ++j)
00250         buf.writeRep(sapar_[i][j]);
00251     }
00252   }
00254   void unpack(AlpsEncoded& buf) {
00255     int dummy;
00256     // No need to allocate the arrays, they are of fixed length
00257     dummy = static_cast<int>(endOfBoolParams);
00258     buf.readRep(bpar_, dummy, false);
00259     dummy = static_cast<int>(endOfIntParams);
00260     buf.readRep(ipar_, dummy, false);
00261     dummy = static_cast<int>(endOfDblParams);
00262     buf.readRep(dpar_, dummy, false);
00263     for (int i = 0; i < endOfStrParams; ++i)
00264       buf.readRep(spar_[i]);
00265     for (int i = 0; i < endOfStrArrayParams; ++i) {
00266       size_t str_size;
00267       buf.readRep(str_size);
00268       sapar_[i].reserve(str_size);
00269       for (size_t j = 0; j < str_size; ++j){
00270         //      sapar_[i].unchecked_push_back(std::string());
00271         sapar_[i].push_back(std::string());
00272         buf.readRep(sapar_[i].back());
00273       }
00274     }
00275   }
00278 };
00279 
00280 #endif

Generated on Sun Nov 14 14:06:30 2010 for Coin-All by  doxygen 1.4.7