/home/coin/SVN-release/Cbc-1.1.1/Clp/src/CbcOrClpParam.hpp

Go to the documentation of this file.
00001 // Copyright (C) 2002, International Business Machines
00002 // Corporation and others.  All Rights Reserved.
00003 
00004 #ifdef USE_CBCCONFIG
00005 # include "CbcConfig.h"
00006 #else
00007 # include "ClpConfig.h"
00008 #endif
00009 
00010 #ifndef CbcOrClpParam_H
00011 #define CbcOrClpParam_H
00012 
00024 class OsiSolverInterface;
00025 class CbcModel;
00026 class ClpSimplex;
00044 enum CbcOrClpParameterType
00045 
00046   { GENERALQUERY = -100,FULLGENERALQUERY,
00047     
00048     PRIMALTOLERANCE = 1, DUALTOLERANCE, TIMELIMIT,
00049     DUALBOUND, PRIMALWEIGHT,  OBJSCALE, RHSSCALE,
00050     
00051     INFEASIBILITYWEIGHT = 51, CUTOFF, INTEGERTOLERANCE,INCREMENT,ALLOWABLEGAP,
00052     TIMELIMIT_BAB,
00053     
00054     DJFIX = 81, GAPRATIO,TIGHTENFACTOR,PRESOLVETOLERANCE,OBJSCALE2,
00055 
00056     SOLVERLOGLEVEL=101,
00057 #ifndef COIN_HAS_CBC 
00058     LOGLEVEL = 101, 
00059 #endif
00060     MAXFACTOR,PERTVALUE,MAXITERATION,PRESOLVEPASS,IDIOT,SPRINT,
00061     OUTPUTFORMAT,SLPVALUE,PRESOLVEOPTIONS,PRINTOPTIONS,SPECIALOPTIONS,
00062     SUBSTITUTION,DUALIZE,VERBOSE,THREADS,CPP,
00063 
00064     STRONGBRANCHING=151,CUTDEPTH, MAXNODES,NUMBERBEFORE,NUMBERANALYZE,
00065     NUMBERMINI,MIPOPTIONS,MOREMIPOPTIONS,MAXHOTITS,FPUMPITS,CUTPASS,
00066 #ifdef COIN_HAS_CBC 
00067     LOGLEVEL , 
00068 #endif
00069   
00070     DIRECTION=201,DUALPIVOT,SCALING,ERRORSALLOWED,KEEPNAMES,SPARSEFACTOR,
00071     PRIMALPIVOT,PRESOLVE,CRASH,BIASLU,PERTURBATION,MESSAGES,AUTOSCALE,
00072     CHOLESKY,KKT,BARRIERSCALE,GAMMA,CROSSOVER,PFI,INTPRINT,
00073     
00074     NODESTRATEGY = 251,BRANCHSTRATEGY,CUTSSTRATEGY,HEURISTICSTRATEGY,
00075     GOMORYCUTS,PROBINGCUTS,KNAPSACKCUTS,REDSPLITCUTS,
00076     ROUNDING,SOLVER,CLIQUECUTS,COSTSTRATEGY,FLOWCUTS,MIXEDCUTS,
00077     TWOMIRCUTS,PREPROCESS,FPUMP,GREEDY,COMBINE,LOCALTREE,USESOLUTION,SOS,
00078     
00079     DIRECTORY=301,IMPORT,EXPORT,RESTORE,SAVE,DUALSIMPLEX,PRIMALSIMPLEX,EITHERSIMPLEX,
00080     MAXIMIZE,MINIMIZE,EXIT,STDIN,UNITTEST,NETLIB_EITHER,NETLIB_DUAL,NETLIB_PRIMAL,SOLUTION,SAVESOL,
00081     TIGHTEN,FAKEBOUND,HELP,PLUSMINUS,NETWORK,ALLSLACK,REVERSE,BARRIER,NETLIB_BARRIER,NETLIB_TUNE,
00082     REALLY_SCALE,BASISIN,BASISOUT,SOLVECONTINUOUS,CLEARCUTS,VERSION,STATISTICS,DEBUG,DUMMY,PRINTMASK,
00083     OUTDUPROWS,USERCLP,
00084 
00085     BAB=351,MIPLIB,STRENGTHEN,PRIORITYIN,USERCBC,
00086 
00087     OSLSTUFF = 401,CBCSTUFF,
00088 
00089     INVALID = 1000 } ;
00090 #include <vector>
00091 #include <string>
00092 
00094 
00095 class CbcOrClpParam
00096 {
00097 public:
00100 
00101   CbcOrClpParam (  );
00102   CbcOrClpParam (std::string name, std::string help,
00103            double lower, double upper, CbcOrClpParameterType type,bool display=true);
00104   CbcOrClpParam (std::string name, std::string help,
00105            int lower, int upper, CbcOrClpParameterType type,bool display=true);
00106   // Other strings will be added by insert
00107   CbcOrClpParam (std::string name, std::string help, std::string firstValue,
00108            CbcOrClpParameterType type,int whereUsed=7,bool display=true);
00109   // Action
00110   CbcOrClpParam (std::string name, std::string help,
00111            CbcOrClpParameterType type,int whereUsed=7,bool display=true);
00113   CbcOrClpParam(const CbcOrClpParam &);
00115     CbcOrClpParam & operator=(const CbcOrClpParam & rhs);
00117   ~CbcOrClpParam (  );
00119 
00122 
00123   void append(std::string keyWord);
00125   void addHelp(std::string keyWord);
00127   inline std::string  name(  ) const {
00128     return name_;
00129   };
00131   inline std::string  shortHelp(  ) const {
00132     return shortHelp_;
00133   };
00135   int setDoubleParameter(CbcModel & model, double value) ;
00137   double doubleParameter(CbcModel & model) const;
00139   int setIntParameter(CbcModel & model, int value) ;
00141   int intParameter(CbcModel & model) const;
00143   int setDoubleParameter(ClpSimplex * model, double value) ;
00145   double doubleParameter(ClpSimplex * model) const;
00147   int setIntParameter(ClpSimplex * model, int value) ;
00149   int intParameter(ClpSimplex * model) const;
00151   int setDoubleParameter(OsiSolverInterface * model, double value) ;
00153   double doubleParameter(OsiSolverInterface * model) const;
00155   int setIntParameter(OsiSolverInterface * model, int value) ;
00157   int intParameter(OsiSolverInterface * model) const;
00159   int checkDoubleParameter(double value) const;
00161   std::string matchName (  ) const;
00163   int parameterOption ( std::string check ) const;
00165   void printOptions (  ) const;
00167   inline std::string currentOption (  ) const
00168   { return definedKeyWords_[currentKeyWord_]; };
00170   void setCurrentOption ( int value , bool printIt=false);
00172   void setCurrentOption (const std::string value );
00174   void setIntValue ( int value );
00175     inline int intValue () const
00176   { return intValue_; };
00178   void setDoubleValue ( double value );
00179   inline double doubleValue () const
00180   { return doubleValue_; };
00182   void setStringValue ( std::string value );
00183   inline std::string stringValue () const
00184   { return stringValue_; };
00186   int matches (std::string input) const;
00188   inline CbcOrClpParameterType type() const
00189   { return type_;};
00191   inline bool displayThis() const
00192   { return display_;};
00194   inline void setLonghelp(const std::string help) 
00195   {longHelp_=help;};
00197   void printLongHelp() const;
00199   void printString() const;
00205   inline int whereUsed() const
00206   { return whereUsed_;};
00207   
00208 private:
00210   void gutsOfConstructor();
00212 
00213 private:
00214 
00219   // Type see CbcOrClpParameterType
00220   CbcOrClpParameterType type_;
00222   double lowerDoubleValue_;
00223   double upperDoubleValue_;
00225   int lowerIntValue_;
00226   int upperIntValue_;
00227   // Length of name
00228   unsigned int lengthName_;
00229   // Minimum match
00230   unsigned int lengthMatch_;
00232   std::vector<std::string> definedKeyWords_;
00234   std::string name_;
00236   std::string shortHelp_;
00238   std::string longHelp_;
00240   CbcOrClpParameterType action_;
00242   int currentKeyWord_;
00244   bool display_;
00246   int intValue_;
00248   double doubleValue_;
00250   std::string stringValue_;
00256   int whereUsed_;
00258 };
00260 std::string CoinReadNextField();
00261 
00262 std::string CoinReadGetCommand(int argc, const char *argv[]);
00263 std::string CoinReadGetString(int argc, const char *argv[]);
00264 // valid 0 - okay, 1 bad, 2 not there
00265 int CoinReadGetIntField(int argc, const char *argv[],int * valid);
00266 double CoinReadGetDoubleField(int argc, const char *argv[],int * valid);
00267 void CoinReadPrintit(const char * input);
00268 void setCbcOrClpPrinting(bool yesNo);
00269 #define CBCMAXPARAMETERS 200
00270 /*
00271   Subroutine to establish the cbc parameter array. See the description of
00272   class CbcOrClpParam for details. Pulled from C..Main() for clarity. 
00273 */
00274 void establishParams (int &numberParameters, CbcOrClpParam *const parameters);
00275 // Given a parameter type - returns its number in list
00276 int whichParam (CbcOrClpParameterType name, 
00277                 int numberParameters, CbcOrClpParam *const parameters);
00278 // Dump a solution to file
00279 void saveSolution(const ClpSimplex * lpSolver,std::string fileName);
00280 #endif  /* CbcOrClpParam_H */

Generated on Thu May 15 21:59:05 2008 by  doxygen 1.4.7