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

- File List
- File Members

# /home/coin/SVN-release/Cgl-0.52.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,
    00053
    00054     DJFIX = 81, GAPRATIO,TIGHTENFACTOR,PRESOLVETOLERANCE,OBJSCALE2,
    00055     DEXTRA1, DEXTRA2, DEXTRA3, DEXTRA4,
    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,
    00069 #ifdef COIN_HAS_CBC
    00070     LOGLEVEL ,
    00071 #endif
    00072
    00073     DIRECTION=201,DUALPIVOT,SCALING,ERRORSALLOWED,KEEPNAMES,SPARSEFACTOR,
    00074     PRIMALPIVOT,PRESOLVE,CRASH,BIASLU,PERTURBATION,MESSAGES,AUTOSCALE,
    00075     CHOLESKY,KKT,BARRIERSCALE,GAMMA,CROSSOVER,PFI,INTPRINT,VECTOR,
    00076
    00077     NODESTRATEGY = 251,BRANCHSTRATEGY,CUTSSTRATEGY,HEURISTICSTRATEGY,
    00078     GOMORYCUTS,PROBINGCUTS,KNAPSACKCUTS,REDSPLITCUTS,
    00079     ROUNDING,SOLVER,CLIQUECUTS,COSTSTRATEGY,FLOWCUTS,MIXEDCUTS,
    00080     TWOMIRCUTS,PREPROCESS,FPUMP,GREEDY,COMBINE,LOCALTREE,SOS,
    00081     LANDPCUTS,RINS,RESIDCUTS,RENS,DIVING,
    00082
    00083     DIRECTORY=301,DIRSAMPLE,DIRNETLIB,DIRMIPLIB,IMPORT,EXPORT,RESTORE,SAVE,DUALSIMPLEX,PRIMALSIMPLEX,EITHERSIMPLEX,
    00084     MAXIMIZE,MINIMIZE,EXIT,STDIN,UNITTEST,NETLIB_EITHER,NETLIB_DUAL,NETLIB_PRIMAL,SOLUTION,SAVESOL,
    00085     TIGHTEN,FAKEBOUND,HELP,PLUSMINUS,NETWORK,ALLSLACK,REVERSE,BARRIER,NETLIB_BARRIER,NETLIB_TUNE,
    00086     REALLY_SCALE,BASISIN,BASISOUT,SOLVECONTINUOUS,CLEARCUTS,VERSION,STATISTICS,DEBUG,DUMMY,PRINTMASK,
    00087     OUTDUPROWS,USERCLP,MODELIN,CSVSTATISTICS,
    00088
    00089     BAB=351,MIPLIB,STRENGTHEN,PRIORITYIN,USERCBC,DOHEURISTIC,
    00090
    00091     OSLSTUFF = 401,CBCSTUFF,
    00092
    00093     INVALID = 1000 } ;
    00094 #include <vector>
    00095 #include <string>
    00096
    00098
    00099 class CbcOrClpParam
    00100 {
    00101 public:
    00104
    00105   CbcOrClpParam (  );
    00106   CbcOrClpParam (std::string name, std::string help,
    00107            double lower, double upper, CbcOrClpParameterType type,bool display=true);
    00108   CbcOrClpParam (std::string name, std::string help,
    00109            int lower, int upper, CbcOrClpParameterType type,bool display=true);
    00110   // Other strings will be added by insert
    00111   CbcOrClpParam (std::string name, std::string help, std::string firstValue,
    00112            CbcOrClpParameterType type,int whereUsed=7,bool display=true);
    00113   // Action
    00114   CbcOrClpParam (std::string name, std::string help,
    00115            CbcOrClpParameterType type,int whereUsed=7,bool display=true);
    00117   CbcOrClpParam(const CbcOrClpParam &);
    00119     CbcOrClpParam & operator=(const CbcOrClpParam & rhs);
    00121   ~CbcOrClpParam (  );
    00123
    00126
    00127   void append(std::string keyWord);
    00129   void addHelp(std::string keyWord);
    00131   inline std::string  name(  ) const {
    00132     return name_;
    00133   }
    00135   inline std::string  shortHelp(  ) const {
    00136     return shortHelp_;
    00137   }
    00139   int setDoubleParameter(CbcModel & model, double value) ;
    00141   const char * setDoubleParameterWithMessage ( CbcModel & model, double  value ,int & returnCode);
    00143   double doubleParameter(CbcModel & model) const;
    00145   int setIntParameter(CbcModel & model, int value) ;
    00147   const char * setIntParameterWithMessage ( CbcModel & model, int value ,int & returnCode);
    00149   int intParameter(CbcModel & model) const;
    00151   int setDoubleParameter(ClpSimplex * model, double value) ;
    00153   double doubleParameter(ClpSimplex * model) const;
    00155   const char * setDoubleParameterWithMessage ( ClpSimplex * model, double  value ,int & returnCode);
    00157   int setIntParameter(ClpSimplex * model, int value) ;
    00159   const char * setIntParameterWithMessage ( ClpSimplex * model, int  value ,int & returnCode);
    00161   int intParameter(ClpSimplex * model) const;
    00163   int setDoubleParameter(OsiSolverInterface * model, double value) ;
    00165   const char * setDoubleParameterWithMessage ( OsiSolverInterface * model, double  value ,int & returnCode);
    00167   double doubleParameter(OsiSolverInterface * model) const;
    00169   int setIntParameter(OsiSolverInterface * model, int value) ;
    00171   const char * setIntParameterWithMessage ( OsiSolverInterface * model, int  value ,int & returnCode);
    00173   int intParameter(OsiSolverInterface * model) const;
    00175   int checkDoubleParameter(double value) const;
    00177   std::string matchName (  ) const;
    00179   int parameterOption ( std::string check ) const;
    00181   void printOptions (  ) const;
    00183   inline std::string currentOption (  ) const
    00184   { return definedKeyWords_[currentKeyWord_]; }
    00186   void setCurrentOption ( int value , bool printIt=false);
    00188   const char * setCurrentOptionWithMessage ( int value );
    00190   void setCurrentOption (const std::string value );
    00192   inline int currentOptionAsInteger (  ) const
    00193   { return currentKeyWord_; }
    00195   void setIntValue ( int value );
    00196     inline int intValue () const
    00197   { return intValue_; }
    00199   void setDoubleValue ( double value );
    00200   inline double doubleValue () const
    00201   { return doubleValue_; }
    00203   void setStringValue ( std::string value );
    00204   inline std::string stringValue () const
    00205   { return stringValue_; }
    00207   int matches (std::string input) const;
    00209   inline CbcOrClpParameterType type() const
    00210   { return type_;}
    00212   inline bool displayThis() const
    00213   { return display_;}
    00215   inline void setLonghelp(const std::string help)
    00216   {longHelp_=help;}
    00218   void printLongHelp() const;
    00220   void printString() const;
    00226   inline int whereUsed() const
    00227   { return whereUsed_;}
    00228
    00229 private:
    00231   void gutsOfConstructor();
    00233
    00234 private:
    00235
    00240   // Type see CbcOrClpParameterType
    00241   CbcOrClpParameterType type_;
    00243   double lowerDoubleValue_;
    00244   double upperDoubleValue_;
    00246   int lowerIntValue_;
    00247   int upperIntValue_;
    00248   // Length of name
    00249   unsigned int lengthName_;
    00250   // Minimum match
    00251   unsigned int lengthMatch_;
    00253   std::vector<std::string> definedKeyWords_;
    00255   std::string name_;
    00257   std::string shortHelp_;
    00259   std::string longHelp_;
    00261   CbcOrClpParameterType action_;
    00263   int currentKeyWord_;
    00265   bool display_;
    00267   int intValue_;
    00269   double doubleValue_;
    00271   std::string stringValue_;
    00277   int whereUsed_;
    00279 };
    00281 std::string CoinReadNextField();
    00282
    00283 std::string CoinReadGetCommand(int argc, const char *argv[]);
    00284 std::string CoinReadGetString(int argc, const char *argv[]);
    00285 // valid 0 - okay, 1 bad, 2 not there
    00286 int CoinReadGetIntField(int argc, const char *argv[],int * valid);
    00287 double CoinReadGetDoubleField(int argc, const char *argv[],int * valid);
    00288 void CoinReadPrintit(const char * input);
    00289 void setCbcOrClpPrinting(bool yesNo);
    00290 #define CBCMAXPARAMETERS 200
    00291 /*
    00292   Subroutine to establish the cbc parameter array. See the description of
    00293   class CbcOrClpParam for details. Pulled from C..Main() for clarity.
    00294 */
    00295 void establishParams (int &numberParameters, CbcOrClpParam *const parameters);
    00296 // Given a parameter type - returns its number in list
    00297 int whichParam (CbcOrClpParameterType name,
    00298                 int numberParameters, CbcOrClpParam *const parameters);
    00299 // Dump a solution to file
    00300 void saveSolution(const ClpSimplex * lpSolver,std::string fileName);
    00301 #endif  /* CbcOrClpParam_H */