# CbcParam.hpp

Go to the documentation of this file.

    00001 /* $Id: CbcParam.hpp 1573 2011-01-05 01:12:36Z lou $ */
    00002 // Copyright (C) 2002, International Business Machines
    00003 // Corporation and others.  All Rights Reserved.
    00004 // This code is licensed under the terms of the Eclipse Public License (EPL).
    00005
    00006 #ifndef CbcParam_H
    00007 #define CbcParam_H
    00008
    00009 #include "OsiSolverInterface.hpp"
    00010 #include "CbcModel.hpp"
    00011 class ClpSimplex;
    00035 enum CbcParameterType
    00036
    00037 { CBC_PARAM_GENERALQUERY = -100,
    00038   CBC_PARAM_FULLGENERALQUERY,
    00039
    00040   CLP_PARAM_DBL_PRIMALTOLERANCE = 1,
    00041   CLP_PARAM_DBL_DUALTOLERANCE,
    00042   CBC_PARAM_DBL_CUTOFF,
    00043   CLP_PARAM_DBL_TIMELIMIT,
    00044   CLP_PARAM_DBL_DUALBOUND,
    00045   CLP_PARAM_DBL_PRIMALWEIGHT,
    00046   CLP_PARAM_DBL_OBJSCALE,
    00047   CLP_PARAM_DBL_RHSSCALE,
    00048
    00049   CBC_PARAM_DBL_INFEASIBILITYWEIGHT = 51,
    00050   CBC_PARAM_DBL_INTEGERTOLERANCE,
    00051   CBC_PARAM_DBL_INCREMENT,
    00052   CBC_PARAM_DBL_ALLOWABLEGAP,
    00053
    00054   CBC_PARAM_DBL_DJFIX = 81,
    00055   CBC_PARAM_DBL_GAPRATIO,
    00056   CBC_PARAM_DBL_TIGHTENFACTOR,
    00057
    00058   CLP_PARAM_INT_LOGLEVEL = 101,
    00059   CLP_PARAM_INT_SOLVERLOGLEVEL,
    00060   CBC_PARAM_INT_MAXNODES,
    00061   CBC_PARAM_INT_STRONGBRANCHING,
    00062   CLP_PARAM_INT_MAXFACTOR,
    00063   CLP_PARAM_INT_PERTVALUE,
    00064   CLP_PARAM_INT_MAXITERATION,
    00065   CLP_PARAM_INT_PRESOLVEPASS,
    00066   CLP_PARAM_INT_IDIOT,
    00067   CLP_PARAM_INT_SPRINT,
    00068   CLP_PARAM_INT_OUTPUTFORMAT,
    00069   CLP_PARAM_INT_SLPVALUE,
    00070   CLP_PARAM_INT_PRESOLVEOPTIONS,
    00071   CLP_PARAM_INT_PRINTOPTIONS,
    00072   CLP_PARAM_INT_SPECIALOPTIONS,
    00073
    00074   CLP_PARAM_STR_DIRECTION = 201,
    00075   CLP_PARAM_STR_DUALPIVOT,
    00076   CLP_PARAM_STR_SCALING,
    00077   CLP_PARAM_STR_ERRORSALLOWED,
    00078   CLP_PARAM_STR_KEEPNAMES,
    00079   CLP_PARAM_STR_SPARSEFACTOR,
    00080   CLP_PARAM_STR_PRIMALPIVOT,
    00081   CLP_PARAM_STR_PRESOLVE,
    00082   CLP_PARAM_STR_CRASH,
    00083   CLP_PARAM_STR_BIASLU,
    00084   CLP_PARAM_STR_PERTURBATION,
    00085   CLP_PARAM_STR_MESSAGES,
    00086   CLP_PARAM_STR_AUTOSCALE,
    00087   CLP_PARAM_STR_CHOLESKY,
    00088   CLP_PARAM_STR_KKT,
    00089   CLP_PARAM_STR_BARRIERSCALE,
    00090   CLP_PARAM_STR_GAMMA,
    00091   CLP_PARAM_STR_CROSSOVER,
    00092   CLP_PARAM_STR_PFI,
    00093   CLP_PARAM_NOTUSED_ALGORITHM,
    00094
    00095   CBC_PARAM_STR_NODESTRATEGY = 251,
    00096   CBC_PARAM_STR_BRANCHSTRATEGY,
    00097   CBC_PARAM_NOTUSED_ADDCUTSSTRATEGY,
    00098   CBC_PARAM_STR_GOMORYCUTS,
    00099   CBC_PARAM_STR_PROBINGCUTS,
    00100   CBC_PARAM_STR_KNAPSACKCUTS,
    00101   CBC_PARAM_NOTUSED_ODDHOLECUTS,
    00102   CBC_PARAM_STR_ROUNDING,
    00103   CBC_PARAM_STR_SOLVER,
    00104   CBC_PARAM_STR_CLIQUECUTS,
    00105   CBC_PARAM_STR_COSTSTRATEGY,
    00106   CBC_PARAM_STR_FLOWCUTS,
    00107   CBC_PARAM_STR_MIXEDCUTS,
    00108   CBC_PARAM_STR_TWOMIRCUTS,
    00109   CBC_PARAM_STR_PREPROCESS,
    00110
    00111   CLP_PARAM_ACTION_DIRECTORY = 301,
    00112   CLP_PARAM_ACTION_IMPORT,
    00113   CLP_PARAM_ACTION_EXPORT,
    00114   CLP_PARAM_ACTION_RESTORE,
    00115   CLP_PARAM_ACTION_SAVE,
    00116   CLP_PARAM_ACTION_DUALSIMPLEX,
    00117   CLP_PARAM_ACTION_PRIMALSIMPLEX,
    00118   CLP_PARAM_ACTION_MAXIMIZE,
    00119   CLP_PARAM_ACTION_MINIMIZE,
    00120   CLP_PARAM_ACTION_EXIT,
    00121   CLP_PARAM_ACTION_STDIN,
    00122   CLP_PARAM_ACTION_UNITTEST,
    00123   CLP_PARAM_ACTION_NETLIB_DUAL,
    00124   CLP_PARAM_ACTION_NETLIB_PRIMAL,
    00125   CLP_PARAM_ACTION_SOLUTION,
    00126   CLP_PARAM_ACTION_TIGHTEN,
    00127   CLP_PARAM_ACTION_FAKEBOUND,
    00128   CLP_PARAM_ACTION_HELP,
    00129   CLP_PARAM_ACTION_PLUSMINUS,
    00130   CLP_PARAM_ACTION_NETWORK,
    00131   CLP_PARAM_ACTION_ALLSLACK,
    00132   CLP_PARAM_ACTION_REVERSE,
    00133   CLP_PARAM_ACTION_BARRIER,
    00134   CLP_PARAM_ACTION_NETLIB_BARRIER,
    00135   CLP_PARAM_ACTION_REALLY_SCALE,
    00136   CLP_PARAM_ACTION_BASISIN,
    00137   CLP_PARAM_ACTION_BASISOUT,
    00138   CLP_PARAM_ACTION_SOLVECONTINUOUS,
    00139   CBC_PARAM_ACTION_BAB,
    00140   CBC_PARAM_ACTION_MIPLIB,
    00141   CLP_PARAM_ACTION_CLEARCUTS,
    00142   CLP_VERSION_NOTUSED_PRINTVERSION,
    00143
    00144   CBC_PARAM_NOTUSED_OSLSTUFF = 401,
    00145   CBC_PARAM_NOTUSED_CBCSTUFF,
    00146
    00147   CBC_PARAM_NOTUSED_INVALID = 1000
    00148 };
    00149
    00150
    00152
    00153 class CbcParam {
    00154
    00155 public:
    00156
    00159
    00160     CbcParam (  );
    00161     CbcParam (std::string name, std::string help,
    00162               double lower, double upper, CbcParameterType type, bool display = true);
    00163     CbcParam (std::string name, std::string help,
    00164               int lower, int upper, CbcParameterType type, bool display = true);
    00165     // Other strings will be added by insert
    00166     CbcParam (std::string name, std::string help, std::string firstValue,
    00167               CbcParameterType type, int defaultIndex = 0, bool display = true);
    00168     // Action
    00169     CbcParam (std::string name, std::string help,
    00170               CbcParameterType type, int indexNumber = -1, bool display = true);
    00172     CbcParam(const CbcParam &);
    00174     CbcParam & operator=(const CbcParam & rhs);
    00176     ~CbcParam (  );
    00178
    00181
    00182     void append(std::string keyWord);
    00184     void addHelp(std::string keyWord);
    00186     inline std::string  name(  ) const {
    00187         return name_;
    00188     };
    00190     inline std::string  shortHelp(  ) const {
    00191         return shortHelp_;
    00192     };
    00194     int setDoubleParameter(CbcModel & model, double value) const;
    00196     double doubleParameter(CbcModel & model) const;
    00198     int setIntParameter(CbcModel & model, int value) const;
    00200     int intParameter(CbcModel & model) const;
    00202     int setDoubleParameter(ClpSimplex * model, double value) const;
    00204     double doubleParameter(ClpSimplex * model) const;
    00206     int setIntParameter(ClpSimplex * model, int value) const;
    00208     int intParameter(ClpSimplex * model) const;
    00210     int setDoubleParameter(OsiSolverInterface * model, double value) const;
    00212     double doubleParameter(OsiSolverInterface * model) const;
    00214     int setIntParameter(OsiSolverInterface * model, int value) const;
    00216     int intParameter(OsiSolverInterface * model) const;
    00218     int checkDoubleParameter(double value) const;
    00220     std::string matchName (  ) const;
    00222     int parameterOption ( std::string check ) const;
    00224     void printOptions (  ) const;
    00226     inline std::string currentOption (  ) const {
    00227         return definedKeyWords_[currentKeyWord_];
    00228     }
    00230     inline void setCurrentOption ( int value ) {
    00231         currentKeyWord_ = value;
    00232     }
    00234     inline void setIntValue ( int value ) {
    00235         intValue_ = value;
    00236     }
    00237     inline int intValue () const {
    00238         return intValue_;
    00239     }
    00241     inline void setDoubleValue ( double value ) {
    00242         doubleValue_ = value;
    00243     }
    00244     inline double doubleValue () const {
    00245         return doubleValue_;
    00246     }
    00248     inline void setStringValue ( std::string value ) {
    00249         stringValue_ = value;
    00250     }
    00251     inline std::string stringValue () const {
    00252         return stringValue_;
    00253     }
    00255     int matches (std::string input) const;
    00257     inline CbcParameterType type() const {
    00258         return type_;
    00259     }
    00261     inline bool displayThis() const {
    00262         return display_;
    00263     }
    00265     inline void setLonghelp(const std::string help) {
    00266         longHelp_ = help;
    00267     }
    00269     void printLongHelp() const;
    00271     void printString() const;
    00273     inline int indexNumber() const {
    00274         return indexNumber_;
    00275     }
    00276 private:
    00278     void gutsOfConstructor();
    00280
    00281 private:
    00282
    00287     // Type see CbcParameterType
    00288     CbcParameterType type_;
    00290     double lowerDoubleValue_;
    00291     double upperDoubleValue_;
    00293     int lowerIntValue_;
    00294     int upperIntValue_;
    00295     // Length of name
    00296     unsigned int lengthName_;
    00297     // Minimum match
    00298     unsigned int lengthMatch_;
    00300     std::vector<std::string> definedKeyWords_;
    00302     std::string name_;
    00304     std::string shortHelp_;
    00306     std::string longHelp_;
    00308     CbcParameterType action_;
    00310     int currentKeyWord_;
    00312     bool display_;
    00314     int intValue_;
    00316     double doubleValue_;
    00318     std::string stringValue_;
    00320     int indexNumber_;
    00322 };
    00323 #endif  /* CbcParam_H */
    00324

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines