00001
00002
00003
00004 #ifndef SbbParam_H
00005 #define SbbParam_H
00006
00007 #include "OsiSolverInterface.hpp"
00008 #include "SbbModel.hpp"
00009
00028 enum SbbParameterType
00029
00030 { GENERALQUERY = -100,
00031
00032 PRIMALTOLERANCE = 1, DUALTOLERANCE,CUTOFF,TIMELIMIT,
00033
00034 INFEASIBILITYWEIGHT = 51, INTEGERTOLERANCE,INCREMENT,ALLOWABLEGAP,
00035
00036 DJFIX = 81, GAPRATIO,TIGHTENFACTOR,
00037
00038 LOGLEVEL = 151, SOLVERLOGLEVEL, MAXNODES,STRONGBRANCHING,
00039
00040 DIRECTION = 201,ERRORSALLOWED,KEEPNAMES,SCALING,
00041
00042 NODESTRATEGY = 251,BRANCHSTRATEGY,ADDCUTSSTRATEGY,
00043 GOMORYCUTS,PROBINGCUTS,KNAPSACKCUTS,ODDHOLECUTS,PRESOLVE,
00044 ROUNDING,SOLVER,
00045
00046 DIRECTORY = 301,IMPORT,EXPORT,RESTORE,SAVE,SOLVECONTINUOUS,BAB,
00047 MAXIMIZE,MINIMIZE,EXIT,STDIN,UNITTEST,MIPLIB,SOLUTION,CLEARCUTS,
00048 VERSION,
00049
00050 OSLSTUFF = 401,SBBSTUFF,
00051
00052 INVALID = 1000 } ;
00053
00054
00056
00057 class SbbParam
00058
00059 { public:
00060
00063
00064 SbbParam ( );
00065 SbbParam (std::string name, std::string help,
00066 double lower, double upper, SbbParameterType type);
00067 SbbParam (std::string name, std::string help,
00068 int lower, int upper, SbbParameterType type);
00069
00070 SbbParam (std::string name, std::string help, std::string defaultValue,
00071 SbbParameterType type);
00072
00073 SbbParam (std::string name, std::string help,
00074 SbbParameterType type);
00076 SbbParam(const SbbParam &);
00078 SbbParam & operator = (const SbbParam & rhs);
00080 ~SbbParam ( );
00082
00085
00086 void append(std::string keyWord);
00088 void addHelp(std::string keyWord);
00090 inline std::string name( ) const {
00091 return name_;
00092 };
00094 inline std::string shortHelp( ) const {
00095 return shortHelp_;
00096 };
00098 int setDoubleParameter(OsiSolverInterface * model, double value) const;
00100 double doubleParameter(OsiSolverInterface * model) const;
00102 int setIntParameter(OsiSolverInterface * model, int value) const;
00104 int intParameter(OsiSolverInterface * model) const;
00106 int setDoubleParameter(SbbModel &model, double value) const;
00108 double doubleParameter(SbbModel &model) const;
00110 int checkDoubleParameter(double value) const;
00112 int setIntParameter(SbbModel &model, int value) const;
00114 int intParameter(SbbModel &model) const;
00116 std::string matchName ( ) const;
00118 int parameterOption ( std::string check ) const;
00120 void printOptions ( ) const;
00122 inline std::string currentOption ( ) const
00123 { return definedKeyWords_[currentKeyWord_]; };
00125 inline void setCurrentOption ( int value )
00126 { currentKeyWord_ = value; };
00128 int matches (std::string input) const;
00130 inline SbbParameterType type() const
00131 { return type_;};
00132 private:
00134 void gutsOfConstructor();
00136
00137 private:
00138
00143
00144 SbbParameterType type_;
00146 double lowerDoubleValue_;
00147 double upperDoubleValue_;
00149 int lowerIntValue_;
00150 int upperIntValue_;
00151
00152 unsigned int lengthName_;
00153
00154 unsigned int lengthMatch_;
00156 std::vector<std::string> definedKeyWords_;
00158 std::string name_;
00160 std::string shortHelp_;
00162 std::vector<std::string> longHelp_;
00164 SbbParameterType action_;
00166 int currentKeyWord_;
00168 };
00169
00170 #endif