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

- File List
- File Members

# /home/coin/SVN-release/Bcps-0.91.0/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, GAPRATIO,
    00053
    00054     DJFIX = 81, TIGHTENFACTOR,PRESOLVETOLERANCE,OBJSCALE2,
    00055     DEXTRA1, DEXTRA2, DEXTRA3, DEXTRA4, DEXTRA5,
    00056
    00057     SOLVERLOGLEVEL=101,
    00058 #ifndef COIN_HAS_CBC
    00059     LOGLEVEL = 101,
    00060 #endif
    00061     MAXFACTOR,PERTVALUE,MAXITERATION,PRESOLVEPASS,IDIOT,SPRINT,
    00062     OUTPUTFORMAT,SLPVALUE,PRESOLVEOPTIONS,PRINTOPTIONS,SPECIALOPTIONS,
    00063     SUBSTITUTION,DUALIZE,VERBOSE,CPP,PROCESSTUNE,USESOLUTION,
    00064
    00065     STRONGBRANCHING=151,CUTDEPTH, MAXNODES,NUMBERBEFORE,NUMBERANALYZE,
    00066     NUMBERMINI,MIPOPTIONS,MOREMIPOPTIONS,MAXHOTITS,FPUMPITS,MAXSOLS,
    00067     FPUMPTUNE,TESTOSI,EXTRA1,EXTRA2,EXTRA3,EXTRA4,CUTPASSINTREE,
    00068     THREADS,CUTPASS,VUBTRY,DENSE,EXPERIMENT,DIVEOPT,STRATEGY,SMALLFACT,
    00069     HOPTIONS,
    00070 #ifdef COIN_HAS_CBC
    00071     LOGLEVEL ,
    00072 #endif
    00073
    00074     DIRECTION=201,DUALPIVOT,SCALING,ERRORSALLOWED,KEEPNAMES,SPARSEFACTOR,
    00075     PRIMALPIVOT,PRESOLVE,CRASH,BIASLU,PERTURBATION,MESSAGES,AUTOSCALE,
    00076     CHOLESKY,KKT,BARRIERSCALE,GAMMA,CROSSOVER,PFI,INTPRINT,VECTOR,
    00077
    00078     NODESTRATEGY = 251,BRANCHSTRATEGY,CUTSSTRATEGY,HEURISTICSTRATEGY,
    00079     GOMORYCUTS,PROBINGCUTS,KNAPSACKCUTS,REDSPLITCUTS,
    00080     ROUNDING,SOLVER,CLIQUECUTS,COSTSTRATEGY,FLOWCUTS,MIXEDCUTS,
    00081     TWOMIRCUTS,PREPROCESS,FPUMP,GREEDY,COMBINE,LOCALTREE,SOS,
    00082     LANDPCUTS,RINS,RESIDCUTS,RENS,DIVINGS,DIVINGC,DIVINGF,DIVINGG,DIVINGL,
    00083     DIVINGP,DIVINGV,DINS,PIVOTANDFIX,RANDROUND,NAIVE,ZEROHALFCUTS,CPX,
    00084
    00085     DIRECTORY=301,DIRSAMPLE,DIRNETLIB,DIRMIPLIB,IMPORT,EXPORT,RESTORE,SAVE,DUALSIMPLEX,PRIMALSIMPLEX,EITHERSIMPLEX,
    00086     MAXIMIZE,MINIMIZE,EXIT,STDIN,UNITTEST,NETLIB_EITHER,NETLIB_DUAL,NETLIB_PRIMAL,SOLUTION,SAVESOL,
    00087     TIGHTEN,FAKEBOUND,HELP,PLUSMINUS,NETWORK,ALLSLACK,REVERSE,BARRIER,NETLIB_BARRIER,NETLIB_TUNE,
    00088     REALLY_SCALE,BASISIN,BASISOUT,SOLVECONTINUOUS,CLEARCUTS,VERSION,STATISTICS,DEBUG,DUMMY,PRINTMASK,
    00089     OUTDUPROWS,USERCLP,MODELIN,CSVSTATISTICS,STOREDFILE,
    00090
    00091     BAB=351,MIPLIB,STRENGTHEN,PRIORITYIN,USERCBC,DOHEURISTIC,
    00092
    00093     OSLSTUFF = 401,CBCSTUFF,
    00094
    00095     INVALID = 1000 } ;
    00096 #include <vector>
    00097 #include <string>
    00098
    00100
    00101 class CbcOrClpParam
    00102 {
    00103 public:
    00106
    00107   CbcOrClpParam (  );
    00108   CbcOrClpParam (std::string name, std::string help,
    00109            double lower, double upper, CbcOrClpParameterType type,bool display=true);
    00110   CbcOrClpParam (std::string name, std::string help,
    00111            int lower, int upper, CbcOrClpParameterType type,bool display=true);
    00112   // Other strings will be added by insert
    00113   CbcOrClpParam (std::string name, std::string help, std::string firstValue,
    00114            CbcOrClpParameterType type,int whereUsed=7,bool display=true);
    00115   // Action
    00116   CbcOrClpParam (std::string name, std::string help,
    00117            CbcOrClpParameterType type,int whereUsed=7,bool display=true);
    00119   CbcOrClpParam(const CbcOrClpParam &);
    00121     CbcOrClpParam & operator=(const CbcOrClpParam & rhs);
    00123   ~CbcOrClpParam (  );
    00125
    00128
    00129   void append(std::string keyWord);
    00131   void addHelp(std::string keyWord);
    00133   inline std::string  name(  ) const {
    00134     return name_;
    00135   }
    00137   inline std::string  shortHelp(  ) const {
    00138     return shortHelp_;
    00139   }
    00141   int setDoubleParameter(CbcModel & model, double value) ;
    00143   const char * setDoubleParameterWithMessage ( CbcModel & model, double  value ,int & returnCode);
    00145   double doubleParameter(CbcModel & model) const;
    00147   int setIntParameter(CbcModel & model, int value) ;
    00149   const char * setIntParameterWithMessage ( CbcModel & model, int value ,int & returnCode);
    00151   int intParameter(CbcModel & model) const;
    00153   int setDoubleParameter(ClpSimplex * model, double value) ;
    00155   double doubleParameter(ClpSimplex * model) const;
    00157   const char * setDoubleParameterWithMessage ( ClpSimplex * model, double  value ,int & returnCode);
    00159   int setIntParameter(ClpSimplex * model, int value) ;
    00161   const char * setIntParameterWithMessage ( ClpSimplex * model, int  value ,int & returnCode);
    00163   int intParameter(ClpSimplex * model) const;
    00165   int setDoubleParameter(OsiSolverInterface * model, double value) ;
    00167   const char * setDoubleParameterWithMessage ( OsiSolverInterface * model, double  value ,int & returnCode);
    00169   double doubleParameter(OsiSolverInterface * model) const;
    00171   int setIntParameter(OsiSolverInterface * model, int value) ;
    00173   const char * setIntParameterWithMessage ( OsiSolverInterface * model, int  value ,int & returnCode);
    00175   int intParameter(OsiSolverInterface * model) const;
    00177   int checkDoubleParameter(double value) const;
    00179   std::string matchName (  ) const;
    00181   int parameterOption ( std::string check ) const;
    00183   void printOptions (  ) const;
    00185   inline std::string currentOption (  ) const
    00186   { return definedKeyWords_[currentKeyWord_]; }
    00188   void setCurrentOption ( int value , bool printIt=false);
    00190   const char * setCurrentOptionWithMessage ( int value );
    00192   void setCurrentOption (const std::string value );
    00194   inline int currentOptionAsInteger (  ) const
    00195   { return currentKeyWord_; }
    00197   void setIntValue ( int value );
    00198     inline int intValue () const
    00199   { return intValue_; }
    00201   void setDoubleValue ( double value );
    00202   inline double doubleValue () const
    00203   { return doubleValue_; }
    00205   void setStringValue ( std::string value );
    00206   inline std::string stringValue () const
    00207   { return stringValue_; }
    00209   int matches (std::string input) const;
    00211   inline CbcOrClpParameterType type() const
    00212   { return type_;}
    00214   inline bool displayThis() const
    00215   { return display_;}
    00217   inline void setLonghelp(const std::string help)
    00218   {longHelp_=help;}
    00220   void printLongHelp() const;
    00222   void printString() const;
    00228   inline int whereUsed() const
    00229   { return whereUsed_;}
    00230
    00231 private:
    00233   void gutsOfConstructor();
    00235
    00236 private:
    00237
    00242   // Type see CbcOrClpParameterType
    00243   CbcOrClpParameterType type_;
    00245   double lowerDoubleValue_;
    00246   double upperDoubleValue_;
    00248   int lowerIntValue_;
    00249   int upperIntValue_;
    00250   // Length of name
    00251   unsigned int lengthName_;
    00252   // Minimum match
    00253   unsigned int lengthMatch_;
    00255   std::vector<std::string> definedKeyWords_;
    00257   std::string name_;
    00259   std::string shortHelp_;
    00261   std::string longHelp_;
    00263   CbcOrClpParameterType action_;
    00265   int currentKeyWord_;
    00267   bool display_;
    00269   int intValue_;
    00271   double doubleValue_;
    00273   std::string stringValue_;
    00279   int whereUsed_;
    00281 };
    00283 std::string CoinReadNextField();
    00284
    00285 std::string CoinReadGetCommand(int argc, const char *argv[]);
    00286 std::string CoinReadGetString(int argc, const char *argv[]);
    00287 // valid 0 - okay, 1 bad, 2 not there
    00288 int CoinReadGetIntField(int argc, const char *argv[],int * valid);
    00289 double CoinReadGetDoubleField(int argc, const char *argv[],int * valid);
    00290 void CoinReadPrintit(const char * input);
    00291 void setCbcOrClpPrinting(bool yesNo);
    00292 #define CBCMAXPARAMETERS 200
    00293 /*
    00294   Subroutine to establish the cbc parameter array. See the description of
    00295   class CbcOrClpParam for details. Pulled from C..Main() for clarity.
    00296 */
    00297 void establishParams (int &numberParameters, CbcOrClpParam *const parameters);
    00298 // Given a parameter type - returns its number in list
    00299 int whichParam (CbcOrClpParameterType name,
    00300                 int numberParameters, CbcOrClpParam *const parameters);
    00301 // Dump a solution to file
    00302 void saveSolution(const ClpSimplex * lpSolver,std::string fileName);
    00303 #endif  /* CbcOrClpParam_H */