- Main Page
- Namespaces
- Classes
- Files
- Directories

- Search for |

- File List
- File Members

# CbcOrClpParam.hpp

Go to the documentation of this file.

    00001
    00002 /* $Id: CbcOrClpParam.hpp 1753 2011-06-19 16:27:26Z stefan $ */
    00003 // Copyright (C) 2002, International Business Machines
    00004 // Corporation and others.  All Rights Reserved.
    00005 // This code is licensed under the terms of the Eclipse Public License (EPL).
    00006
    00007 #ifdef USE_CBCCONFIG
    00008 # include "CbcConfig.h"
    00009 #else
    00010 # include "ClpConfig.h"
    00011 #endif
    00012
    00013 #ifndef CbcOrClpParam_H
    00014 #define CbcOrClpParam_H
    00015
    00027 class OsiSolverInterface;
    00028 class CbcModel;
    00029 class ClpSimplex;
    00047 enum CbcOrClpParameterType
    00048
    00049 {
    00050      CBC_PARAM_GENERALQUERY = -100,
    00051      CBC_PARAM_FULLGENERALQUERY,
    00052
    00053      CLP_PARAM_DBL_PRIMALTOLERANCE = 1,
    00054      CLP_PARAM_DBL_DUALTOLERANCE,
    00055      CLP_PARAM_DBL_TIMELIMIT,
    00056      CLP_PARAM_DBL_DUALBOUND,
    00057      CLP_PARAM_DBL_PRIMALWEIGHT,
    00058      CLP_PARAM_DBL_OBJSCALE,
    00059      CLP_PARAM_DBL_RHSSCALE,
    00060      CLP_PARAM_DBL_ZEROTOLERANCE,
    00061
    00062      CBC_PARAM_DBL_INFEASIBILITYWEIGHT = 51,
    00063      CBC_PARAM_DBL_CUTOFF,
    00064      CBC_PARAM_DBL_INTEGERTOLERANCE,
    00065      CBC_PARAM_DBL_INCREMENT,
    00066      CBC_PARAM_DBL_ALLOWABLEGAP,
    00067      CBC_PARAM_DBL_TIMELIMIT_BAB,
    00068      CBC_PARAM_DBL_GAPRATIO,
    00069
    00070      CBC_PARAM_DBL_DJFIX = 81,
    00071      CBC_PARAM_DBL_TIGHTENFACTOR,
    00072      CLP_PARAM_DBL_PRESOLVETOLERANCE,
    00073      CLP_PARAM_DBL_OBJSCALE2,
    00074      CBC_PARAM_DBL_FAKEINCREMENT,
    00075      CBC_PARAM_DBL_FAKECUTOFF,
    00076      CBC_PARAM_DBL_ARTIFICIALCOST,
    00077      CBC_PARAM_DBL_DEXTRA3,
    00078      CBC_PARAM_DBL_SMALLBAB,
    00079      CBC_PARAM_DBL_DEXTRA4,
    00080      CBC_PARAM_DBL_DEXTRA5,
    00081
    00082      CLP_PARAM_INT_SOLVERLOGLEVEL = 101,
    00083 #ifndef COIN_HAS_CBC
    00084      CLP_PARAM_INT_LOGLEVEL = 101,
    00085 #endif
    00086      CLP_PARAM_INT_MAXFACTOR,
    00087      CLP_PARAM_INT_PERTVALUE,
    00088      CLP_PARAM_INT_MAXITERATION,
    00089      CLP_PARAM_INT_PRESOLVEPASS,
    00090      CLP_PARAM_INT_IDIOT,
    00091      CLP_PARAM_INT_SPRINT,
    00092      CLP_PARAM_INT_OUTPUTFORMAT,
    00093      CLP_PARAM_INT_SLPVALUE,
    00094      CLP_PARAM_INT_PRESOLVEOPTIONS,
    00095      CLP_PARAM_INT_PRINTOPTIONS,
    00096      CLP_PARAM_INT_SPECIALOPTIONS,
    00097      CLP_PARAM_INT_SUBSTITUTION,
    00098      CLP_PARAM_INT_DUALIZE,
    00099      CLP_PARAM_INT_VERBOSE,
    00100      CLP_PARAM_INT_CPP,
    00101      CLP_PARAM_INT_PROCESSTUNE,
    00102      CLP_PARAM_INT_USESOLUTION,
    00103
    00104      CBC_PARAM_INT_STRONGBRANCHING = 151,
    00105      CBC_PARAM_INT_CUTDEPTH,
    00106      CBC_PARAM_INT_MAXNODES,
    00107      CBC_PARAM_INT_NUMBERBEFORE,
    00108      CBC_PARAM_INT_NUMBERANALYZE,
    00109      CBC_PARAM_INT_MIPOPTIONS,
    00110      CBC_PARAM_INT_MOREMIPOPTIONS,
    00111      CBC_PARAM_INT_MAXHOTITS,
    00112      CBC_PARAM_INT_FPUMPITS,
    00113      CBC_PARAM_INT_MAXSOLS,
    00114      CBC_PARAM_INT_FPUMPTUNE,
    00115      CBC_PARAM_INT_TESTOSI,
    00116      CBC_PARAM_INT_EXTRA1,
    00117      CBC_PARAM_INT_EXTRA2,
    00118      CBC_PARAM_INT_EXTRA3,
    00119      CBC_PARAM_INT_EXTRA4,
    00120      CBC_PARAM_INT_DEPTHMINIBAB,
    00121      CBC_PARAM_INT_CUTPASSINTREE,
    00122      CBC_PARAM_INT_THREADS,
    00123      CBC_PARAM_INT_CUTPASS,
    00124      CBC_PARAM_INT_VUBTRY,
    00125      CBC_PARAM_INT_DENSE,
    00126      CBC_PARAM_INT_EXPERIMENT,
    00127      CBC_PARAM_INT_DIVEOPT,
    00128      CBC_PARAM_INT_STRATEGY,
    00129      CBC_PARAM_INT_SMALLFACT,
    00130      CBC_PARAM_INT_HOPTIONS,
    00131      CBC_PARAM_INT_CUTLENGTH,
    00132      CBC_PARAM_INT_FPUMPTUNE2,
    00133 #ifdef COIN_HAS_CBC
    00134      CLP_PARAM_INT_LOGLEVEL ,
    00135 #endif
    00136
    00137      CLP_PARAM_STR_DIRECTION = 201,
    00138      CLP_PARAM_STR_DUALPIVOT,
    00139      CLP_PARAM_STR_SCALING,
    00140      CLP_PARAM_STR_ERRORSALLOWED,
    00141      CLP_PARAM_STR_KEEPNAMES,
    00142      CLP_PARAM_STR_SPARSEFACTOR,
    00143      CLP_PARAM_STR_PRIMALPIVOT,
    00144      CLP_PARAM_STR_PRESOLVE,
    00145      CLP_PARAM_STR_CRASH,
    00146      CLP_PARAM_STR_BIASLU,
    00147      CLP_PARAM_STR_PERTURBATION,
    00148      CLP_PARAM_STR_MESSAGES,
    00149      CLP_PARAM_STR_AUTOSCALE,
    00150      CLP_PARAM_STR_CHOLESKY,
    00151      CLP_PARAM_STR_KKT,
    00152      CLP_PARAM_STR_BARRIERSCALE,
    00153      CLP_PARAM_STR_GAMMA,
    00154      CLP_PARAM_STR_CROSSOVER,
    00155      CLP_PARAM_STR_PFI,
    00156      CLP_PARAM_STR_INTPRINT,
    00157      CLP_PARAM_STR_VECTOR,
    00158      CLP_PARAM_STR_FACTORIZATION,
    00159      CLP_PARAM_STR_ALLCOMMANDS,
    00160      CLP_PARAM_STR_TIME_MODE,
    00161
    00162      CBC_PARAM_STR_NODESTRATEGY = 251,
    00163      CBC_PARAM_STR_BRANCHSTRATEGY,
    00164      CBC_PARAM_STR_CUTSSTRATEGY,
    00165      CBC_PARAM_STR_HEURISTICSTRATEGY,
    00166      CBC_PARAM_STR_GOMORYCUTS,
    00167      CBC_PARAM_STR_PROBINGCUTS,
    00168      CBC_PARAM_STR_KNAPSACKCUTS,
    00169      CBC_PARAM_STR_REDSPLITCUTS,
    00170      CBC_PARAM_STR_ROUNDING,
    00171      CBC_PARAM_STR_SOLVER,
    00172      CBC_PARAM_STR_CLIQUECUTS,
    00173      CBC_PARAM_STR_COSTSTRATEGY,
    00174      CBC_PARAM_STR_FLOWCUTS,
    00175      CBC_PARAM_STR_MIXEDCUTS,
    00176      CBC_PARAM_STR_TWOMIRCUTS,
    00177      CBC_PARAM_STR_PREPROCESS,
    00178      CBC_PARAM_STR_FPUMP,
    00179      CBC_PARAM_STR_GREEDY,
    00180      CBC_PARAM_STR_COMBINE,
    00181      CBC_PARAM_STR_LOCALTREE,
    00182      CBC_PARAM_STR_SOS,
    00183      CBC_PARAM_STR_LANDPCUTS,
    00184      CBC_PARAM_STR_RINS,
    00185      CBC_PARAM_STR_RESIDCUTS,
    00186      CBC_PARAM_STR_RENS,
    00187      CBC_PARAM_STR_DIVINGS,
    00188      CBC_PARAM_STR_DIVINGC,
    00189      CBC_PARAM_STR_DIVINGF,
    00190      CBC_PARAM_STR_DIVINGG,
    00191      CBC_PARAM_STR_DIVINGL,
    00192      CBC_PARAM_STR_DIVINGP,
    00193      CBC_PARAM_STR_DIVINGV,
    00194      CBC_PARAM_STR_DINS,
    00195      CBC_PARAM_STR_PIVOTANDFIX,
    00196      CBC_PARAM_STR_RANDROUND,
    00197      CBC_PARAM_STR_NAIVE,
    00198      CBC_PARAM_STR_ZEROHALFCUTS,
    00199      CBC_PARAM_STR_CPX,
    00200      CBC_PARAM_STR_CROSSOVER2,
    00201      CBC_PARAM_STR_PIVOTANDCOMPLEMENT,
    00202      CBC_PARAM_STR_VND,
    00203      CBC_PARAM_STR_LAGOMORYCUTS,
    00204
    00205      CLP_PARAM_ACTION_DIRECTORY = 301,
    00206      CLP_PARAM_ACTION_DIRSAMPLE,
    00207      CLP_PARAM_ACTION_DIRNETLIB,
    00208      CBC_PARAM_ACTION_DIRMIPLIB,
    00209      CLP_PARAM_ACTION_IMPORT,
    00210      CLP_PARAM_ACTION_EXPORT,
    00211      CLP_PARAM_ACTION_RESTORE,
    00212      CLP_PARAM_ACTION_SAVE,
    00213      CLP_PARAM_ACTION_DUALSIMPLEX,
    00214      CLP_PARAM_ACTION_PRIMALSIMPLEX,
    00215      CLP_PARAM_ACTION_EITHERSIMPLEX,
    00216      CLP_PARAM_ACTION_MAXIMIZE,
    00217      CLP_PARAM_ACTION_MINIMIZE,
    00218      CLP_PARAM_ACTION_EXIT,
    00219      CLP_PARAM_ACTION_STDIN,
    00220      CLP_PARAM_ACTION_UNITTEST,
    00221      CLP_PARAM_ACTION_NETLIB_EITHER,
    00222      CLP_PARAM_ACTION_NETLIB_DUAL,
    00223      CLP_PARAM_ACTION_NETLIB_PRIMAL,
    00224      CLP_PARAM_ACTION_SOLUTION,
    00225      CLP_PARAM_ACTION_SAVESOL,
    00226      CLP_PARAM_ACTION_TIGHTEN,
    00227      CLP_PARAM_ACTION_FAKEBOUND,
    00228      CLP_PARAM_ACTION_HELP,
    00229      CLP_PARAM_ACTION_PLUSMINUS,
    00230      CLP_PARAM_ACTION_NETWORK,
    00231      CLP_PARAM_ACTION_ALLSLACK,
    00232      CLP_PARAM_ACTION_REVERSE,
    00233      CLP_PARAM_ACTION_BARRIER,
    00234      CLP_PARAM_ACTION_NETLIB_BARRIER,
    00235      CLP_PARAM_ACTION_NETLIB_TUNE,
    00236      CLP_PARAM_ACTION_REALLY_SCALE,
    00237      CLP_PARAM_ACTION_BASISIN,
    00238      CLP_PARAM_ACTION_BASISOUT,
    00239      CLP_PARAM_ACTION_SOLVECONTINUOUS,
    00240      CLP_PARAM_ACTION_CLEARCUTS,
    00241      CLP_PARAM_ACTION_VERSION,
    00242      CLP_PARAM_ACTION_STATISTICS,
    00243      CLP_PARAM_ACTION_DEBUG,
    00244      CLP_PARAM_ACTION_DUMMY,
    00245      CLP_PARAM_ACTION_PRINTMASK,
    00246      CLP_PARAM_ACTION_OUTDUPROWS,
    00247      CLP_PARAM_ACTION_USERCLP,
    00248      CLP_PARAM_ACTION_MODELIN,
    00249      CLP_PARAM_ACTION_CSVSTATISTICS,
    00250      CLP_PARAM_ACTION_STOREDFILE,
    00251      CLP_PARAM_ACTION_ENVIRONMENT,
    00252      CLP_PARAM_ACTION_PARAMETRICS,
    00253      CLP_PARAM_ACTION_GMPL_SOLUTION,
    00254
    00255      CBC_PARAM_ACTION_BAB = 351,
    00256      CBC_PARAM_ACTION_MIPLIB,
    00257      CBC_PARAM_ACTION_STRENGTHEN,
    00258      CBC_PARAM_ACTION_PRIORITYIN,
    00259      CBC_PARAM_ACTION_USERCBC,
    00260      CBC_PARAM_ACTION_DOHEURISTIC,
    00261
    00262      CBC_PARAM_NOTUSED_OSLSTUFF = 401,
    00263      CBC_PARAM_NOTUSED_CBCSTUFF,
    00264
    00265      CBC_PARAM_NOTUSED_INVALID = 1000
    00266 } ;
    00267 #include <vector>
    00268 #include <string>
    00269
    00271
    00272 class CbcOrClpParam {
    00273 public:
    00276
    00277      CbcOrClpParam (  );
    00278      CbcOrClpParam (std::string name, std::string help,
    00279                     double lower, double upper, CbcOrClpParameterType type, int display = 2);
    00280      CbcOrClpParam (std::string name, std::string help,
    00281                     int lower, int upper, CbcOrClpParameterType type, int display = 2);
    00282      // Other strings will be added by insert
    00283      CbcOrClpParam (std::string name, std::string help, std::string firstValue,
    00284                     CbcOrClpParameterType type, int whereUsed = 7, int display = 2);
    00285      // Action
    00286      CbcOrClpParam (std::string name, std::string help,
    00287                     CbcOrClpParameterType type, int whereUsed = 7, int display = 2);
    00289      CbcOrClpParam(const CbcOrClpParam &);
    00291      CbcOrClpParam & operator=(const CbcOrClpParam & rhs);
    00293      ~CbcOrClpParam (  );
    00295
    00298
    00299      void append(std::string keyWord);
    00301      void addHelp(std::string keyWord);
    00303      inline std::string  name(  ) const {
    00304           return name_;
    00305      }
    00307      inline std::string  shortHelp(  ) const {
    00308           return shortHelp_;
    00309      }
    00311      int setDoubleParameter(CbcModel & model, double value) ;
    00313      const char * setDoubleParameterWithMessage ( CbcModel & model, double  value , int & returnCode);
    00315      double doubleParameter(CbcModel & model) const;
    00317      int setIntParameter(CbcModel & model, int value) ;
    00319      const char * setIntParameterWithMessage ( CbcModel & model, int value , int & returnCode);
    00321      int intParameter(CbcModel & model) const;
    00323      int setDoubleParameter(ClpSimplex * model, double value) ;
    00325      double doubleParameter(ClpSimplex * model) const;
    00327      const char * setDoubleParameterWithMessage ( ClpSimplex * model, double  value , int & returnCode);
    00329      int setIntParameter(ClpSimplex * model, int value) ;
    00331      const char * setIntParameterWithMessage ( ClpSimplex * model, int  value , int & returnCode);
    00333      int intParameter(ClpSimplex * model) const;
    00335      int setDoubleParameter(OsiSolverInterface * model, double value) ;
    00337      const char * setDoubleParameterWithMessage ( OsiSolverInterface * model, double  value , int & returnCode);
    00339      double doubleParameter(OsiSolverInterface * model) const;
    00341      int setIntParameter(OsiSolverInterface * model, int value) ;
    00343      const char * setIntParameterWithMessage ( OsiSolverInterface * model, int  value , int & returnCode);
    00345      int intParameter(OsiSolverInterface * model) const;
    00347      int checkDoubleParameter(double value) const;
    00349      std::string matchName (  ) const;
    00351      int lengthMatchName (  ) const;
    00353      int parameterOption ( std::string check ) const;
    00355      void printOptions (  ) const;
    00357      inline std::string currentOption (  ) const {
    00358           return definedKeyWords_[currentKeyWord_];
    00359      }
    00361      void setCurrentOption ( int value , bool printIt = false);
    00363      const char * setCurrentOptionWithMessage ( int value );
    00365      void setCurrentOption (const std::string value );
    00367      inline int currentOptionAsInteger (  ) const {
    00368           return currentKeyWord_;
    00369      }
    00371      void setIntValue ( int value );
    00372      inline int intValue () const {
    00373           return intValue_;
    00374      }
    00376      void setDoubleValue ( double value );
    00377      inline double doubleValue () const {
    00378           return doubleValue_;
    00379      }
    00381      void setStringValue ( std::string value );
    00382      inline std::string stringValue () const {
    00383           return stringValue_;
    00384      }
    00386      int matches (std::string input) const;
    00388      inline CbcOrClpParameterType type() const {
    00389           return type_;
    00390      }
    00392      inline int displayThis() const {
    00393           return display_;
    00394      }
    00396      inline void setLonghelp(const std::string help) {
    00397           longHelp_ = help;
    00398      }
    00400      void printLongHelp() const;
    00402      void printString() const;
    00408      inline int whereUsed() const {
    00409           return whereUsed_;
    00410      }
    00411
    00412 private:
    00414      void gutsOfConstructor();
    00416
    00417 private:
    00418
    00423      // Type see CbcOrClpParameterType
    00424      CbcOrClpParameterType type_;
    00426      double lowerDoubleValue_;
    00427      double upperDoubleValue_;
    00429      int lowerIntValue_;
    00430      int upperIntValue_;
    00431      // Length of name
    00432      unsigned int lengthName_;
    00433      // Minimum match
    00434      unsigned int lengthMatch_;
    00436      std::vector<std::string> definedKeyWords_;
    00438      std::string name_;
    00440      std::string shortHelp_;
    00442      std::string longHelp_;
    00444      CbcOrClpParameterType action_;
    00446      int currentKeyWord_;
    00448      int display_;
    00450      int intValue_;
    00452      double doubleValue_;
    00454      std::string stringValue_;
    00460      int whereUsed_;
    00462 };
    00464 std::string CoinReadNextField();
    00465
    00466 std::string CoinReadGetCommand(int argc, const char *argv[]);
    00467 std::string CoinReadGetString(int argc, const char *argv[]);
    00468 // valid 0 - okay, 1 bad, 2 not there
    00469 int CoinReadGetIntField(int argc, const char *argv[], int * valid);
    00470 double CoinReadGetDoubleField(int argc, const char *argv[], int * valid);
    00471 void CoinReadPrintit(const char * input);
    00472 void setCbcOrClpPrinting(bool yesNo);
    00473 #define CBCMAXPARAMETERS 200
    00474 /*
    00475   Subroutine to establish the cbc parameter array. See the description of
    00476   class CbcOrClpParam for details. Pulled from C..Main() for clarity.
    00477 */
    00478 void establishParams (int &numberParameters, CbcOrClpParam *const parameters);
    00479 // Given a parameter type - returns its number in list
    00480 int whichParam (CbcOrClpParameterType name,
    00481                 int numberParameters, CbcOrClpParam *const parameters);
    00482 // Dump a solution to file
    00483 void saveSolution(const ClpSimplex * lpSolver, std::string fileName);
    00484 #endif  /* CbcOrClpParam_H */