00001
00002
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,
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,
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,USESOLUTION,SOS,
00081 LANDPCUTS,RINS,RESIDCUTS,
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,
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
00111 CbcOrClpParam (std::string name, std::string help, std::string firstValue,
00112 CbcOrClpParameterType type,int whereUsed=7,bool display=true);
00113
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 double doubleParameter(CbcModel & model) const;
00143 int setIntParameter(CbcModel & model, int value) ;
00145 int intParameter(CbcModel & model) const;
00147 int setDoubleParameter(ClpSimplex * model, double value) ;
00149 double doubleParameter(ClpSimplex * model) const;
00151 int setIntParameter(ClpSimplex * model, int value) ;
00153 int intParameter(ClpSimplex * model) const;
00155 int setDoubleParameter(OsiSolverInterface * model, double value) ;
00157 double doubleParameter(OsiSolverInterface * model) const;
00159 int setIntParameter(OsiSolverInterface * model, int value) ;
00161 int intParameter(OsiSolverInterface * model) const;
00163 int checkDoubleParameter(double value) const;
00165 std::string matchName ( ) const;
00167 int parameterOption ( std::string check ) const;
00169 void printOptions ( ) const;
00171 inline std::string currentOption ( ) const
00172 { return definedKeyWords_[currentKeyWord_]; }
00174 void setCurrentOption ( int value , bool printIt=false);
00176 void setCurrentOption (const std::string value );
00178 inline int currentOptionAsInteger ( ) const
00179 { return currentKeyWord_; }
00181 void setIntValue ( int value );
00182 inline int intValue () const
00183 { return intValue_; }
00185 void setDoubleValue ( double value );
00186 inline double doubleValue () const
00187 { return doubleValue_; }
00189 void setStringValue ( std::string value );
00190 inline std::string stringValue () const
00191 { return stringValue_; }
00193 int matches (std::string input) const;
00195 inline CbcOrClpParameterType type() const
00196 { return type_;}
00198 inline bool displayThis() const
00199 { return display_;}
00201 inline void setLonghelp(const std::string help)
00202 {longHelp_=help;}
00204 void printLongHelp() const;
00206 void printString() const;
00212 inline int whereUsed() const
00213 { return whereUsed_;}
00214
00215 private:
00217 void gutsOfConstructor();
00219
00220 private:
00221
00226
00227 CbcOrClpParameterType type_;
00229 double lowerDoubleValue_;
00230 double upperDoubleValue_;
00232 int lowerIntValue_;
00233 int upperIntValue_;
00234
00235 unsigned int lengthName_;
00236
00237 unsigned int lengthMatch_;
00239 std::vector<std::string> definedKeyWords_;
00241 std::string name_;
00243 std::string shortHelp_;
00245 std::string longHelp_;
00247 CbcOrClpParameterType action_;
00249 int currentKeyWord_;
00251 bool display_;
00253 int intValue_;
00255 double doubleValue_;
00257 std::string stringValue_;
00263 int whereUsed_;
00265 };
00267 std::string CoinReadNextField();
00268
00269 std::string CoinReadGetCommand(int argc, const char *argv[]);
00270 std::string CoinReadGetString(int argc, const char *argv[]);
00271
00272 int CoinReadGetIntField(int argc, const char *argv[],int * valid);
00273 double CoinReadGetDoubleField(int argc, const char *argv[],int * valid);
00274 void CoinReadPrintit(const char * input);
00275 void setCbcOrClpPrinting(bool yesNo);
00276 #define CBCMAXPARAMETERS 200
00277
00278
00279
00280
00281 void establishParams (int &numberParameters, CbcOrClpParam *const parameters);
00282
00283 int whichParam (CbcOrClpParameterType name,
00284 int numberParameters, CbcOrClpParam *const parameters);
00285
00286 void saveSolution(const ClpSimplex * lpSolver,std::string fileName);
00287 #endif