/home/coin/SVN-release/Bcp-1.2.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     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,EXPERIMENT,DIVEOPT,
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,DIVINGS,DIVINGC,DIVINGF,DIVINGG,DIVINGL,
00082     DIVINGP,DIVINGV,DINS,
00083     
00084     DIRECTORY=301,DIRSAMPLE,DIRNETLIB,DIRMIPLIB,IMPORT,EXPORT,RESTORE,SAVE,DUALSIMPLEX,PRIMALSIMPLEX,EITHERSIMPLEX,
00085     MAXIMIZE,MINIMIZE,EXIT,STDIN,UNITTEST,NETLIB_EITHER,NETLIB_DUAL,NETLIB_PRIMAL,SOLUTION,SAVESOL,
00086     TIGHTEN,FAKEBOUND,HELP,PLUSMINUS,NETWORK,ALLSLACK,REVERSE,BARRIER,NETLIB_BARRIER,NETLIB_TUNE,
00087     REALLY_SCALE,BASISIN,BASISOUT,SOLVECONTINUOUS,CLEARCUTS,VERSION,STATISTICS,DEBUG,DUMMY,PRINTMASK,
00088     OUTDUPROWS,USERCLP,MODELIN,CSVSTATISTICS,
00089 
00090     BAB=351,MIPLIB,STRENGTHEN,PRIORITYIN,USERCBC,DOHEURISTIC,
00091 
00092     OSLSTUFF = 401,CBCSTUFF,
00093 
00094     INVALID = 1000 } ;
00095 #include <vector>
00096 #include <string>
00097 
00099 
00100 class CbcOrClpParam
00101 {
00102 public:
00105 
00106   CbcOrClpParam (  );
00107   CbcOrClpParam (std::string name, std::string help,
00108            double lower, double upper, CbcOrClpParameterType type,bool display=true);
00109   CbcOrClpParam (std::string name, std::string help,
00110            int lower, int upper, CbcOrClpParameterType type,bool display=true);
00111   // Other strings will be added by insert
00112   CbcOrClpParam (std::string name, std::string help, std::string firstValue,
00113            CbcOrClpParameterType type,int whereUsed=7,bool display=true);
00114   // Action
00115   CbcOrClpParam (std::string name, std::string help,
00116            CbcOrClpParameterType type,int whereUsed=7,bool display=true);
00118   CbcOrClpParam(const CbcOrClpParam &);
00120     CbcOrClpParam & operator=(const CbcOrClpParam & rhs);
00122   ~CbcOrClpParam (  );
00124 
00127 
00128   void append(std::string keyWord);
00130   void addHelp(std::string keyWord);
00132   inline std::string  name(  ) const {
00133     return name_;
00134   }
00136   inline std::string  shortHelp(  ) const {
00137     return shortHelp_;
00138   }
00140   int setDoubleParameter(CbcModel & model, double value) ;
00142   const char * setDoubleParameterWithMessage ( CbcModel & model, double  value ,int & returnCode);
00144   double doubleParameter(CbcModel & model) const;
00146   int setIntParameter(CbcModel & model, int value) ;
00148   const char * setIntParameterWithMessage ( CbcModel & model, int value ,int & returnCode);
00150   int intParameter(CbcModel & model) const;
00152   int setDoubleParameter(ClpSimplex * model, double value) ;
00154   double doubleParameter(ClpSimplex * model) const;
00156   const char * setDoubleParameterWithMessage ( ClpSimplex * model, double  value ,int & returnCode);
00158   int setIntParameter(ClpSimplex * model, int value) ;
00160   const char * setIntParameterWithMessage ( ClpSimplex * model, int  value ,int & returnCode);
00162   int intParameter(ClpSimplex * model) const;
00164   int setDoubleParameter(OsiSolverInterface * model, double value) ;
00166   const char * setDoubleParameterWithMessage ( OsiSolverInterface * model, double  value ,int & returnCode);
00168   double doubleParameter(OsiSolverInterface * model) const;
00170   int setIntParameter(OsiSolverInterface * model, int value) ;
00172   const char * setIntParameterWithMessage ( OsiSolverInterface * model, int  value ,int & returnCode);
00174   int intParameter(OsiSolverInterface * model) const;
00176   int checkDoubleParameter(double value) const;
00178   std::string matchName (  ) const;
00180   int parameterOption ( std::string check ) const;
00182   void printOptions (  ) const;
00184   inline std::string currentOption (  ) const
00185   { return definedKeyWords_[currentKeyWord_]; }
00187   void setCurrentOption ( int value , bool printIt=false);
00189   const char * setCurrentOptionWithMessage ( int value );
00191   void setCurrentOption (const std::string value );
00193   inline int currentOptionAsInteger (  ) const
00194   { return currentKeyWord_; }
00196   void setIntValue ( int value );
00197     inline int intValue () const
00198   { return intValue_; }
00200   void setDoubleValue ( double value );
00201   inline double doubleValue () const
00202   { return doubleValue_; }
00204   void setStringValue ( std::string value );
00205   inline std::string stringValue () const
00206   { return stringValue_; }
00208   int matches (std::string input) const;
00210   inline CbcOrClpParameterType type() const
00211   { return type_;}
00213   inline bool displayThis() const
00214   { return display_;}
00216   inline void setLonghelp(const std::string help) 
00217   {longHelp_=help;}
00219   void printLongHelp() const;
00221   void printString() const;
00227   inline int whereUsed() const
00228   { return whereUsed_;}
00229   
00230 private:
00232   void gutsOfConstructor();
00234 
00235 private:
00236 
00241   // Type see CbcOrClpParameterType
00242   CbcOrClpParameterType type_;
00244   double lowerDoubleValue_;
00245   double upperDoubleValue_;
00247   int lowerIntValue_;
00248   int upperIntValue_;
00249   // Length of name
00250   unsigned int lengthName_;
00251   // Minimum match
00252   unsigned int lengthMatch_;
00254   std::vector<std::string> definedKeyWords_;
00256   std::string name_;
00258   std::string shortHelp_;
00260   std::string longHelp_;
00262   CbcOrClpParameterType action_;
00264   int currentKeyWord_;
00266   bool display_;
00268   int intValue_;
00270   double doubleValue_;
00272   std::string stringValue_;
00278   int whereUsed_;
00280 };
00282 std::string CoinReadNextField();
00283 
00284 std::string CoinReadGetCommand(int argc, const char *argv[]);
00285 std::string CoinReadGetString(int argc, const char *argv[]);
00286 // valid 0 - okay, 1 bad, 2 not there
00287 int CoinReadGetIntField(int argc, const char *argv[],int * valid);
00288 double CoinReadGetDoubleField(int argc, const char *argv[],int * valid);
00289 void CoinReadPrintit(const char * input);
00290 void setCbcOrClpPrinting(bool yesNo);
00291 #define CBCMAXPARAMETERS 200
00292 /*
00293   Subroutine to establish the cbc parameter array. See the description of
00294   class CbcOrClpParam for details. Pulled from C..Main() for clarity. 
00295 */
00296 void establishParams (int &numberParameters, CbcOrClpParam *const parameters);
00297 // Given a parameter type - returns its number in list
00298 int whichParam (CbcOrClpParameterType name, 
00299                 int numberParameters, CbcOrClpParam *const parameters);
00300 // Dump a solution to file
00301 void saveSolution(const ClpSimplex * lpSolver,std::string fileName);
00302 #endif  /* CbcOrClpParam_H */

Generated on Thu Jan 15 03:01:00 2009 for coin-Bcp by  doxygen 1.4.7