00001
00002
00003
00004
00005
00006 #ifdef USE_CBCCONFIG
00007 # include "CbcConfig.h"
00008 #else
00009 # include "ClpConfig.h"
00010 #endif
00011
00012 #ifndef CbcOrClpParam_H
00013 #define CbcOrClpParam_H
00014
00026 class OsiSolverInterface;
00027 class CbcModel;
00028 class ClpSimplex;
00046 enum CbcOrClpParameterType
00047
00048 { GENERALQUERY = -100,FULLGENERALQUERY,
00049
00050 PRIMALTOLERANCE = 1, DUALTOLERANCE, TIMELIMIT,
00051 DUALBOUND, PRIMALWEIGHT, OBJSCALE, RHSSCALE,
00052
00053 INFEASIBILITYWEIGHT = 51, CUTOFF, INTEGERTOLERANCE,INCREMENT,ALLOWABLEGAP,
00054 TIMELIMIT_BAB, GAPRATIO,
00055
00056 DJFIX = 81, TIGHTENFACTOR,PRESOLVETOLERANCE,OBJSCALE2,
00057 FAKEINCREMENT, FAKECUTOFF, ARTIFICIALCOST,DEXTRA3, SMALLBAB, DEXTRA4, DEXTRA5,
00058
00059 SOLVERLOGLEVEL=101,
00060 #ifndef COIN_HAS_CBC
00061 LOGLEVEL = 101,
00062 #endif
00063 MAXFACTOR,PERTVALUE,MAXITERATION,PRESOLVEPASS,IDIOT,SPRINT,
00064 OUTPUTFORMAT,SLPVALUE,PRESOLVEOPTIONS,PRINTOPTIONS,SPECIALOPTIONS,
00065 SUBSTITUTION,DUALIZE,VERBOSE,CPP,PROCESSTUNE,USESOLUTION,
00066
00067 STRONGBRANCHING=151,CUTDEPTH, MAXNODES,NUMBERBEFORE,NUMBERANALYZE,
00068 MIPOPTIONS,MOREMIPOPTIONS,MAXHOTITS,FPUMPITS,MAXSOLS,
00069 FPUMPTUNE,TESTOSI,EXTRA1,EXTRA2,EXTRA3,EXTRA4,DEPTHMINIBAB,CUTPASSINTREE,
00070 THREADS,CUTPASS,VUBTRY,DENSE,EXPERIMENT,DIVEOPT,STRATEGY,SMALLFACT,
00071 HOPTIONS,CUTLENGTH,FPUMPTUNE2,
00072 #ifdef COIN_HAS_CBC
00073 LOGLEVEL ,
00074 #endif
00075
00076 DIRECTION=201,DUALPIVOT,SCALING,ERRORSALLOWED,KEEPNAMES,SPARSEFACTOR,
00077 PRIMALPIVOT,PRESOLVE,CRASH,BIASLU,PERTURBATION,MESSAGES,AUTOSCALE,
00078 CHOLESKY,KKT,BARRIERSCALE,GAMMA,CROSSOVER,PFI,INTPRINT,VECTOR,
00079 FACTORIZATION,ALLCOMMANDS,
00080
00081 NODESTRATEGY = 251,BRANCHSTRATEGY,CUTSSTRATEGY,HEURISTICSTRATEGY,
00082 GOMORYCUTS,PROBINGCUTS,KNAPSACKCUTS,REDSPLITCUTS,
00083 ROUNDING,SOLVER,CLIQUECUTS,COSTSTRATEGY,FLOWCUTS,MIXEDCUTS,
00084 TWOMIRCUTS,PREPROCESS,FPUMP,GREEDY,COMBINE,LOCALTREE,SOS,
00085 LANDPCUTS,RINS,RESIDCUTS,RENS,DIVINGS,DIVINGC,DIVINGF,DIVINGG,DIVINGL,
00086 DIVINGP,DIVINGV,DINS,PIVOTANDFIX,RANDROUND,NAIVE,ZEROHALFCUTS,CPX,
00087 CROSSOVER2,PIVOTANDCOMPLEMENT,VND,
00088
00089 DIRECTORY=301,DIRSAMPLE,DIRNETLIB,DIRMIPLIB,IMPORT,EXPORT,RESTORE,SAVE,DUALSIMPLEX,PRIMALSIMPLEX,EITHERSIMPLEX,
00090 MAXIMIZE,MINIMIZE,EXIT,STDIN,UNITTEST,NETLIB_EITHER,NETLIB_DUAL,NETLIB_PRIMAL,SOLUTION,SAVESOL,
00091 TIGHTEN,FAKEBOUND,HELP,PLUSMINUS,NETWORK,ALLSLACK,REVERSE,BARRIER,NETLIB_BARRIER,NETLIB_TUNE,
00092 REALLY_SCALE,BASISIN,BASISOUT,SOLVECONTINUOUS,CLEARCUTS,VERSION,STATISTICS,DEBUG,DUMMY,PRINTMASK,
00093 OUTDUPROWS,USERCLP,MODELIN,CSVSTATISTICS,STOREDFILE,ENVIRONMENT,
00094
00095 BAB=351,MIPLIB,STRENGTHEN,PRIORITYIN,USERCBC,DOHEURISTIC,
00096
00097 OSLSTUFF = 401,CBCSTUFF,
00098
00099 INVALID = 1000 } ;
00100 #include <vector>
00101 #include <string>
00102
00104
00105 class CbcOrClpParam
00106 {
00107 public:
00110
00111 CbcOrClpParam ( );
00112 CbcOrClpParam (std::string name, std::string help,
00113 double lower, double upper, CbcOrClpParameterType type,int display=2);
00114 CbcOrClpParam (std::string name, std::string help,
00115 int lower, int upper, CbcOrClpParameterType type,int display=2);
00116
00117 CbcOrClpParam (std::string name, std::string help, std::string firstValue,
00118 CbcOrClpParameterType type,int whereUsed=7,int display=2);
00119
00120 CbcOrClpParam (std::string name, std::string help,
00121 CbcOrClpParameterType type,int whereUsed=7,int display=2);
00123 CbcOrClpParam(const CbcOrClpParam &);
00125 CbcOrClpParam & operator=(const CbcOrClpParam & rhs);
00127 ~CbcOrClpParam ( );
00129
00132
00133 void append(std::string keyWord);
00135 void addHelp(std::string keyWord);
00137 inline std::string name( ) const {
00138 return name_;
00139 }
00141 inline std::string shortHelp( ) const {
00142 return shortHelp_;
00143 }
00145 int setDoubleParameter(CbcModel & model, double value) ;
00147 const char * setDoubleParameterWithMessage ( CbcModel & model, double value ,int & returnCode);
00149 double doubleParameter(CbcModel & model) const;
00151 int setIntParameter(CbcModel & model, int value) ;
00153 const char * setIntParameterWithMessage ( CbcModel & model, int value ,int & returnCode);
00155 int intParameter(CbcModel & model) const;
00157 int setDoubleParameter(ClpSimplex * model, double value) ;
00159 double doubleParameter(ClpSimplex * model) const;
00161 const char * setDoubleParameterWithMessage ( ClpSimplex * model, double value ,int & returnCode);
00163 int setIntParameter(ClpSimplex * model, int value) ;
00165 const char * setIntParameterWithMessage ( ClpSimplex * model, int value ,int & returnCode);
00167 int intParameter(ClpSimplex * model) const;
00169 int setDoubleParameter(OsiSolverInterface * model, double value) ;
00171 const char * setDoubleParameterWithMessage ( OsiSolverInterface * model, double value ,int & returnCode);
00173 double doubleParameter(OsiSolverInterface * model) const;
00175 int setIntParameter(OsiSolverInterface * model, int value) ;
00177 const char * setIntParameterWithMessage ( OsiSolverInterface * model, int value ,int & returnCode);
00179 int intParameter(OsiSolverInterface * model) const;
00181 int checkDoubleParameter(double value) const;
00183 std::string matchName ( ) const;
00185 int lengthMatchName ( ) const;
00187 int parameterOption ( std::string check ) const;
00189 void printOptions ( ) const;
00191 inline std::string currentOption ( ) const
00192 { return definedKeyWords_[currentKeyWord_]; }
00194 void setCurrentOption ( int value , bool printIt=false);
00196 const char * setCurrentOptionWithMessage ( int value );
00198 void setCurrentOption (const std::string value );
00200 inline int currentOptionAsInteger ( ) const
00201 { return currentKeyWord_; }
00203 void setIntValue ( int value );
00204 inline int intValue () const
00205 { return intValue_; }
00207 void setDoubleValue ( double value );
00208 inline double doubleValue () const
00209 { return doubleValue_; }
00211 void setStringValue ( std::string value );
00212 inline std::string stringValue () const
00213 { return stringValue_; }
00215 int matches (std::string input) const;
00217 inline CbcOrClpParameterType type() const
00218 { return type_;}
00220 inline int displayThis() const
00221 { return display_;}
00223 inline void setLonghelp(const std::string help)
00224 {longHelp_=help;}
00226 void printLongHelp() const;
00228 void printString() const;
00234 inline int whereUsed() const
00235 { return whereUsed_;}
00236
00237 private:
00239 void gutsOfConstructor();
00241
00242 private:
00243
00248
00249 CbcOrClpParameterType type_;
00251 double lowerDoubleValue_;
00252 double upperDoubleValue_;
00254 int lowerIntValue_;
00255 int upperIntValue_;
00256
00257 unsigned int lengthName_;
00258
00259 unsigned int lengthMatch_;
00261 std::vector<std::string> definedKeyWords_;
00263 std::string name_;
00265 std::string shortHelp_;
00267 std::string longHelp_;
00269 CbcOrClpParameterType action_;
00271 int currentKeyWord_;
00273 int display_;
00275 int intValue_;
00277 double doubleValue_;
00279 std::string stringValue_;
00285 int whereUsed_;
00287 };
00289 std::string CoinReadNextField();
00290
00291 std::string CoinReadGetCommand(int argc, const char *argv[]);
00292 std::string CoinReadGetString(int argc, const char *argv[]);
00293
00294 int CoinReadGetIntField(int argc, const char *argv[],int * valid);
00295 double CoinReadGetDoubleField(int argc, const char *argv[],int * valid);
00296 void CoinReadPrintit(const char * input);
00297 void setCbcOrClpPrinting(bool yesNo);
00298 #define CBCMAXPARAMETERS 200
00299
00300
00301
00302
00303 void establishParams (int &numberParameters, CbcOrClpParam *const parameters);
00304
00305 int whichParam (CbcOrClpParameterType name,
00306 int numberParameters, CbcOrClpParam *const parameters);
00307
00308 void saveSolution(const ClpSimplex * lpSolver,std::string fileName);
00309 #endif