00001
00002
00003
00004
00005 #ifndef CbcParam_H
00006 #define CbcParam_H
00007
00008 #include "OsiSolverInterface.hpp"
00009 #include "CbcModel.hpp"
00010 class ClpSimplex;
00030 enum CbcParameterType
00031
00032 { GENERALQUERY = -100,FULLGENERALQUERY,
00033
00034 PRIMALTOLERANCE = 1, DUALTOLERANCE,CUTOFF,TIMELIMIT,
00035 DUALBOUND, PRIMALWEIGHT, OBJSCALE, RHSSCALE,
00036
00037 INFEASIBILITYWEIGHT = 51, INTEGERTOLERANCE,INCREMENT,ALLOWABLEGAP,
00038
00039 DJFIX = 81, GAPRATIO,TIGHTENFACTOR,
00040
00041 LOGLEVEL = 101, SOLVERLOGLEVEL, MAXNODES,STRONGBRANCHING,
00042 MAXFACTOR,PERTVALUE,MAXITERATION,PRESOLVEPASS,IDIOT,SPRINT,
00043 OUTPUTFORMAT,SLPVALUE,PRESOLVEOPTIONS,PRINTOPTIONS,SPECIALOPTIONS,
00044
00045 DIRECTION=201,DUALPIVOT,SCALING,ERRORSALLOWED,KEEPNAMES,SPARSEFACTOR,
00046 PRIMALPIVOT,PRESOLVE,CRASH,BIASLU,PERTURBATION,MESSAGES,AUTOSCALE,
00047 CHOLESKY,KKT,BARRIERSCALE,GAMMA,CROSSOVER,PFI,ALGORITHM,
00048
00049 NODESTRATEGY = 251,BRANCHSTRATEGY,ADDCUTSSTRATEGY,
00050 GOMORYCUTS,PROBINGCUTS,KNAPSACKCUTS,ODDHOLECUTS,
00051 ROUNDING,SOLVER,CLIQUECUTS,COSTSTRATEGY,FLOWCUTS,MIXEDCUTS,
00052 TWOMIRCUTS,PREPROCESS,
00053
00054 DIRECTORY=301,IMPORT,EXPORT,RESTORE,SAVE,DUALSIMPLEX,PRIMALSIMPLEX,
00055 MAXIMIZE,MINIMIZE,EXIT,STDIN,UNITTEST,NETLIB_DUAL,NETLIB_PRIMAL,SOLUTION,
00056 TIGHTEN,FAKEBOUND,HELP,PLUSMINUS,NETWORK,ALLSLACK,REVERSE,BARRIER,NETLIB_BARRIER,
00057 REALLY_SCALE,BASISIN,BASISOUT,SOLVECONTINUOUS,BAB,MIPLIB,CLEARCUTS,PRINTVERSION,
00058
00059 OSLSTUFF = 401,CBCSTUFF,
00060
00061 INVALID = 1000 };
00062
00063
00065
00066 class CbcParam {
00067
00068 public:
00069
00072
00073 CbcParam ( );
00074 CbcParam (std::string name, std::string help,
00075 double lower, double upper, CbcParameterType type,bool display=true);
00076 CbcParam (std::string name, std::string help,
00077 int lower, int upper, CbcParameterType type,bool display=true);
00078
00079 CbcParam (std::string name, std::string help, std::string firstValue,
00080 CbcParameterType type,int defaultIndex=0,bool display=true);
00081
00082 CbcParam (std::string name, std::string help,
00083 CbcParameterType type,int indexNumber=-1,bool display=true);
00085 CbcParam(const CbcParam &);
00087 CbcParam & operator=(const CbcParam & rhs);
00089 ~CbcParam ( );
00091
00094
00095 void append(std::string keyWord);
00097 void addHelp(std::string keyWord);
00099 inline std::string name( ) const {
00100 return name_;
00101 };
00103 inline std::string shortHelp( ) const {
00104 return shortHelp_;
00105 };
00107 int setDoubleParameter(CbcModel & model, double value) const;
00109 double doubleParameter(CbcModel & model) const;
00111 int setIntParameter(CbcModel & model, int value) const;
00113 int intParameter(CbcModel & model) const;
00115 int setDoubleParameter(ClpSimplex * model, double value) const;
00117 double doubleParameter(ClpSimplex * model) const;
00119 int setIntParameter(ClpSimplex * model, int value) const;
00121 int intParameter(ClpSimplex * model) const;
00123 int setDoubleParameter(OsiSolverInterface * model, double value) const;
00125 double doubleParameter(OsiSolverInterface * model) const;
00127 int setIntParameter(OsiSolverInterface * model, int value) const;
00129 int intParameter(OsiSolverInterface * model) const;
00131 int checkDoubleParameter(double value) const;
00133 std::string matchName ( ) const;
00135 int parameterOption ( std::string check ) const;
00137 void printOptions ( ) const;
00139 inline std::string currentOption ( ) const
00140 { return definedKeyWords_[currentKeyWord_]; }
00142 inline void setCurrentOption ( int value )
00143 { currentKeyWord_=value; }
00145 inline void setIntValue ( int value )
00146 { intValue_=value; }
00147 inline int intValue () const
00148 { return intValue_; }
00150 inline void setDoubleValue ( double value )
00151 { doubleValue_=value; }
00152 inline double doubleValue () const
00153 { return doubleValue_; }
00155 inline void setStringValue ( std::string value )
00156 { stringValue_=value; }
00157 inline std::string stringValue () const
00158 { return stringValue_; }
00160 int matches (std::string input) const;
00162 inline CbcParameterType type() const
00163 { return type_;}
00165 inline bool displayThis() const
00166 { return display_;}
00168 inline void setLonghelp(const std::string help)
00169 {longHelp_=help;}
00171 void printLongHelp() const;
00173 void printString() const;
00175 inline int indexNumber() const
00176 { return indexNumber_;}
00177 private:
00179 void gutsOfConstructor();
00181
00182 private:
00183
00188
00189 CbcParameterType type_;
00191 double lowerDoubleValue_;
00192 double upperDoubleValue_;
00194 int lowerIntValue_;
00195 int upperIntValue_;
00196
00197 unsigned int lengthName_;
00198
00199 unsigned int lengthMatch_;
00201 std::vector<std::string> definedKeyWords_;
00203 std::string name_;
00205 std::string shortHelp_;
00207 std::string longHelp_;
00209 CbcParameterType action_;
00211 int currentKeyWord_;
00213 bool display_;
00215 int intValue_;
00217 double doubleValue_;
00219 std::string stringValue_;
00221 int indexNumber_;
00223 };
00224 #endif