00001
00002
00003
00004 #ifndef CbcOrClpParam_H
00005 #define CbcOrClpParam_H
00006
00018 class OsiSolverInterface;
00019 class CbcModel;
00020 class ClpSimplex;
00038 enum CbcOrClpParameterType
00039
00040 { GENERALQUERY = -100,FULLGENERALQUERY,
00041
00042 PRIMALTOLERANCE = 1, DUALTOLERANCE, TIMELIMIT,
00043 DUALBOUND, PRIMALWEIGHT, OBJSCALE, RHSSCALE,
00044
00045 INFEASIBILITYWEIGHT = 51, CUTOFF, INTEGERTOLERANCE,INCREMENT,ALLOWABLEGAP,
00046 TIMELIMIT_BAB,
00047
00048 DJFIX = 81, GAPRATIO,TIGHTENFACTOR,PRESOLVETOLERANCE,OBJSCALE2,
00049
00050 SOLVERLOGLEVEL=101,
00051 #ifndef COIN_USE_CBC
00052 LOGLEVEL = 101,
00053 #endif
00054 MAXFACTOR,PERTVALUE,MAXITERATION,PRESOLVEPASS,IDIOT,SPRINT,
00055 OUTPUTFORMAT,SLPVALUE,PRESOLVEOPTIONS,PRINTOPTIONS,SPECIALOPTIONS,
00056 SUBSTITUTION,DUALIZE,VERBOSE,THREADS,CPP,
00057
00058 STRONGBRANCHING=151,CUTDEPTH, MAXNODES,NUMBERBEFORE,NUMBERANALYZE,
00059 NUMBERMINI,MIPOPTIONS,MOREMIPOPTIONS,MAXHOTITS,FPUMPITS,CUTPASS,
00060 #ifdef COIN_USE_CBC
00061 LOGLEVEL ,
00062 #endif
00063
00064 DIRECTION=201,DUALPIVOT,SCALING,ERRORSALLOWED,KEEPNAMES,SPARSEFACTOR,
00065 PRIMALPIVOT,PRESOLVE,CRASH,BIASLU,PERTURBATION,MESSAGES,AUTOSCALE,
00066 CHOLESKY,KKT,BARRIERSCALE,GAMMA,CROSSOVER,PFI,INTPRINT,
00067
00068 NODESTRATEGY = 251,BRANCHSTRATEGY,CUTSSTRATEGY,HEURISTICSTRATEGY,
00069 GOMORYCUTS,PROBINGCUTS,KNAPSACKCUTS,REDSPLITCUTS,
00070 ROUNDING,SOLVER,CLIQUECUTS,COSTSTRATEGY,FLOWCUTS,MIXEDCUTS,
00071 TWOMIRCUTS,PREPROCESS,FPUMP,GREEDY,COMBINE,LOCALTREE,USESOLUTION,SOS,
00072
00073 DIRECTORY=301,IMPORT,EXPORT,RESTORE,SAVE,DUALSIMPLEX,PRIMALSIMPLEX,EITHERSIMPLEX,
00074 MAXIMIZE,MINIMIZE,EXIT,STDIN,UNITTEST,NETLIB_EITHER,NETLIB_DUAL,NETLIB_PRIMAL,SOLUTION,SAVESOL,
00075 TIGHTEN,FAKEBOUND,HELP,PLUSMINUS,NETWORK,ALLSLACK,REVERSE,BARRIER,NETLIB_BARRIER,NETLIB_TUNE,
00076 REALLY_SCALE,BASISIN,BASISOUT,SOLVECONTINUOUS,CLEARCUTS,VERSION,STATISTICS,DEBUG,DUMMY,PRINTMASK,
00077 OUTDUPROWS,USERCLP,
00078
00079 BAB=351,MIPLIB,STRENGTHEN,PRIORITYIN,USERCBC,
00080
00081 OSLSTUFF = 401,CBCSTUFF,
00082
00083 INVALID = 1000 } ;
00084 #include <vector>
00085 #include <string>
00086
00088
00089 class CbcOrClpParam
00090 {
00091 public:
00094
00095 CbcOrClpParam ( );
00096 CbcOrClpParam (std::string name, std::string help,
00097 double lower, double upper, CbcOrClpParameterType type,bool display=true);
00098 CbcOrClpParam (std::string name, std::string help,
00099 int lower, int upper, CbcOrClpParameterType type,bool display=true);
00100
00101 CbcOrClpParam (std::string name, std::string help, std::string firstValue,
00102 CbcOrClpParameterType type,int whereUsed=7,bool display=true);
00103
00104 CbcOrClpParam (std::string name, std::string help,
00105 CbcOrClpParameterType type,int whereUsed=7,bool display=true);
00107 CbcOrClpParam(const CbcOrClpParam &);
00109 CbcOrClpParam & operator=(const CbcOrClpParam & rhs);
00111 ~CbcOrClpParam ( );
00113
00116
00117 void append(std::string keyWord);
00119 void addHelp(std::string keyWord);
00121 inline std::string name( ) const {
00122 return name_;
00123 };
00125 inline std::string shortHelp( ) const {
00126 return shortHelp_;
00127 };
00129 int setDoubleParameter(CbcModel & model, double value) ;
00131 double doubleParameter(CbcModel & model) const;
00133 int setIntParameter(CbcModel & model, int value) ;
00135 int intParameter(CbcModel & model) const;
00137 int setDoubleParameter(ClpSimplex * model, double value) ;
00139 double doubleParameter(ClpSimplex * model) const;
00141 int setIntParameter(ClpSimplex * model, int value) ;
00143 int intParameter(ClpSimplex * model) const;
00145 int setDoubleParameter(OsiSolverInterface * model, double value) ;
00147 double doubleParameter(OsiSolverInterface * model) const;
00149 int setIntParameter(OsiSolverInterface * model, int value) ;
00151 int intParameter(OsiSolverInterface * model) const;
00153 int checkDoubleParameter(double value) const;
00155 std::string matchName ( ) const;
00157 int parameterOption ( std::string check ) const;
00159 void printOptions ( ) const;
00161 inline std::string currentOption ( ) const
00162 { return definedKeyWords_[currentKeyWord_]; };
00164 void setCurrentOption ( int value , bool printIt=false);
00166 void setCurrentOption (const std::string value );
00168 void setIntValue ( int value );
00169 inline int intValue () const
00170 { return intValue_; };
00172 void setDoubleValue ( double value );
00173 inline double doubleValue () const
00174 { return doubleValue_; };
00176 void setStringValue ( std::string value );
00177 inline std::string stringValue () const
00178 { return stringValue_; };
00180 int matches (std::string input) const;
00182 inline CbcOrClpParameterType type() const
00183 { return type_;};
00185 inline bool displayThis() const
00186 { return display_;};
00188 inline void setLonghelp(const std::string help)
00189 {longHelp_=help;};
00191 void printLongHelp() const;
00193 void printString() const;
00199 inline int whereUsed() const
00200 { return whereUsed_;};
00201
00202 private:
00204 void gutsOfConstructor();
00206
00207 private:
00208
00213
00214 CbcOrClpParameterType type_;
00216 double lowerDoubleValue_;
00217 double upperDoubleValue_;
00219 int lowerIntValue_;
00220 int upperIntValue_;
00221
00222 unsigned int lengthName_;
00223
00224 unsigned int lengthMatch_;
00226 std::vector<std::string> definedKeyWords_;
00228 std::string name_;
00230 std::string shortHelp_;
00232 std::string longHelp_;
00234 CbcOrClpParameterType action_;
00236 int currentKeyWord_;
00238 bool display_;
00240 int intValue_;
00242 double doubleValue_;
00244 std::string stringValue_;
00250 int whereUsed_;
00252 };
00254 std::string CoinReadNextField();
00255
00256 std::string CoinReadGetCommand(int argc, const char *argv[]);
00257 std::string CoinReadGetString(int argc, const char *argv[]);
00258
00259 int CoinReadGetIntField(int argc, const char *argv[],int * valid);
00260 double CoinReadGetDoubleField(int argc, const char *argv[],int * valid);
00261 void CoinReadPrintit(const char * input);
00262 void setCbcOrClpPrinting(bool yesNo);
00263 #define CBCMAXPARAMETERS 200
00264
00265
00266
00267
00268 void establishParams (int &numberParameters, CbcOrClpParam *const parameters);
00269
00270 int whichParam (CbcOrClpParameterType name,
00271 int numberParameters, CbcOrClpParam *const parameters);
00272
00273 void saveSolution(const ClpSimplex * lpSolver,std::string fileName);
00274 #endif