00001
00002
00003
00004 #ifndef CbcParam_H
00005 #define CbcParam_H
00006
00007 #include "OsiSolverInterface.hpp"
00008 #include "CbcModel.hpp"
00009 class ClpSimplex;
00029 enum CbcParameterType
00030
00031 { GENERALQUERY = -100,FULLGENERALQUERY,
00032
00033 PRIMALTOLERANCE = 1, DUALTOLERANCE,CUTOFF,TIMELIMIT,
00034 DUALBOUND, PRIMALWEIGHT, OBJSCALE, RHSSCALE,
00035
00036 INFEASIBILITYWEIGHT = 51, INTEGERTOLERANCE,INCREMENT,ALLOWABLEGAP,
00037
00038 DJFIX = 81, GAPRATIO,TIGHTENFACTOR,
00039
00040 LOGLEVEL = 101, SOLVERLOGLEVEL, MAXNODES,STRONGBRANCHING,
00041 MAXFACTOR,PERTVALUE,MAXITERATION,PRESOLVEPASS,IDIOT,SPRINT,
00042 OUTPUTFORMAT,SLPVALUE,PRESOLVEOPTIONS,PRINTOPTIONS,SPECIALOPTIONS,
00043
00044 DIRECTION=201,DUALPIVOT,SCALING,ERRORSALLOWED,KEEPNAMES,SPARSEFACTOR,
00045 PRIMALPIVOT,PRESOLVE,CRASH,BIASLU,PERTURBATION,MESSAGES,AUTOSCALE,
00046 CHOLESKY,KKT,BARRIERSCALE,GAMMA,CROSSOVER,PFI,ALGORITHM,
00047
00048 NODESTRATEGY = 251,BRANCHSTRATEGY,ADDCUTSSTRATEGY,
00049 GOMORYCUTS,PROBINGCUTS,KNAPSACKCUTS,ODDHOLECUTS,
00050 ROUNDING,SOLVER,CLIQUECUTS,COSTSTRATEGY,FLOWCUTS,MIXEDCUTS,
00051 TWOMIRCUTS,PREPROCESS,
00052
00053 DIRECTORY=301,IMPORT,EXPORT,RESTORE,SAVE,DUALSIMPLEX,PRIMALSIMPLEX,
00054 MAXIMIZE,MINIMIZE,EXIT,STDIN,UNITTEST,NETLIB_DUAL,NETLIB_PRIMAL,SOLUTION,
00055 TIGHTEN,FAKEBOUND,HELP,PLUSMINUS,NETWORK,ALLSLACK,REVERSE,BARRIER,NETLIB_BARRIER,
00056 REALLY_SCALE,BASISIN,BASISOUT,SOLVECONTINUOUS,BAB,MIPLIB,CLEARCUTS,PRINTVERSION,
00057
00058 OSLSTUFF = 401,CBCSTUFF,
00059
00060 INVALID = 1000 };
00061
00062
00064
00065 class CbcParam {
00066
00067 public:
00068
00071
00072 CbcParam ( );
00073 CbcParam (std::string name, std::string help,
00074 double lower, double upper, CbcParameterType type,bool display=true);
00075 CbcParam (std::string name, std::string help,
00076 int lower, int upper, CbcParameterType type,bool display=true);
00077
00078 CbcParam (std::string name, std::string help, std::string firstValue,
00079 CbcParameterType type,int defaultIndex=0,bool display=true);
00080
00081 CbcParam (std::string name, std::string help,
00082 CbcParameterType type,int indexNumber=-1,bool display=true);
00084 CbcParam(const CbcParam &);
00086 CbcParam & operator=(const CbcParam & rhs);
00088 ~CbcParam ( );
00090
00093
00094 void append(std::string keyWord);
00096 void addHelp(std::string keyWord);
00098 inline std::string name( ) const {
00099 return name_;
00100 };
00102 inline std::string shortHelp( ) const {
00103 return shortHelp_;
00104 };
00106 int setDoubleParameter(CbcModel & model, double value) const;
00108 double doubleParameter(CbcModel & model) const;
00110 int setIntParameter(CbcModel & model, int value) const;
00112 int intParameter(CbcModel & model) const;
00114 int setDoubleParameter(ClpSimplex * model, double value) const;
00116 double doubleParameter(ClpSimplex * model) const;
00118 int setIntParameter(ClpSimplex * model, int value) const;
00120 int intParameter(ClpSimplex * model) const;
00122 int setDoubleParameter(OsiSolverInterface * model, double value) const;
00124 double doubleParameter(OsiSolverInterface * model) const;
00126 int setIntParameter(OsiSolverInterface * model, int value) const;
00128 int intParameter(OsiSolverInterface * model) const;
00130 int checkDoubleParameter(double value) const;
00132 std::string matchName ( ) const;
00134 int parameterOption ( std::string check ) const;
00136 void printOptions ( ) const;
00138 inline std::string currentOption ( ) const
00139 { return definedKeyWords_[currentKeyWord_]; }
00141 inline void setCurrentOption ( int value )
00142 { currentKeyWord_=value; }
00144 inline void setIntValue ( int value )
00145 { intValue_=value; }
00146 inline int intValue () const
00147 { return intValue_; }
00149 inline void setDoubleValue ( double value )
00150 { doubleValue_=value; }
00151 inline double doubleValue () const
00152 { return doubleValue_; }
00154 inline void setStringValue ( std::string value )
00155 { stringValue_=value; }
00156 inline std::string stringValue () const
00157 { return stringValue_; }
00159 int matches (std::string input) const;
00161 inline CbcParameterType type() const
00162 { return type_;}
00164 inline bool displayThis() const
00165 { return display_;}
00167 inline void setLonghelp(const std::string help)
00168 {longHelp_=help;}
00170 void printLongHelp() const;
00172 void printString() const;
00174 inline int indexNumber() const
00175 { return indexNumber_;}
00176 private:
00178 void gutsOfConstructor();
00180
00181 private:
00182
00187
00188 CbcParameterType type_;
00190 double lowerDoubleValue_;
00191 double upperDoubleValue_;
00193 int lowerIntValue_;
00194 int upperIntValue_;
00195
00196 unsigned int lengthName_;
00197
00198 unsigned int lengthMatch_;
00200 std::vector<std::string> definedKeyWords_;
00202 std::string name_;
00204 std::string shortHelp_;
00206 std::string longHelp_;
00208 CbcParameterType action_;
00210 int currentKeyWord_;
00212 bool display_;
00214 int intValue_;
00216 double doubleValue_;
00218 std::string stringValue_;
00220 int indexNumber_;
00222 };
00223 #endif