# CbcOrClpParam.hpp

Go to the documentation of this file.

    00001
    00002 /* $Id: CbcOrClpParam.hpp 1928 2013-04-06 12:54:16Z 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      CLP_PARAM_INT_RANDOMSEED,
    00104      CLP_PARAM_INT_MORESPECIALOPTIONS,
    00105
    00106      CBC_PARAM_INT_STRONGBRANCHING = 151,
    00107      CBC_PARAM_INT_CUTDEPTH,
    00108      CBC_PARAM_INT_MAXNODES,
    00109      CBC_PARAM_INT_NUMBERBEFORE,
    00110      CBC_PARAM_INT_NUMBERANALYZE,
    00111      CBC_PARAM_INT_MIPOPTIONS,
    00112      CBC_PARAM_INT_MOREMIPOPTIONS,
    00113      CBC_PARAM_INT_MAXHOTITS,
    00114      CBC_PARAM_INT_FPUMPITS,
    00115      CBC_PARAM_INT_MAXSOLS,
    00116      CBC_PARAM_INT_FPUMPTUNE,
    00117      CBC_PARAM_INT_TESTOSI,
    00118      CBC_PARAM_INT_EXTRA1,
    00119      CBC_PARAM_INT_EXTRA2,
    00120      CBC_PARAM_INT_EXTRA3,
    00121      CBC_PARAM_INT_EXTRA4,
    00122      CBC_PARAM_INT_DEPTHMINIBAB,
    00123      CBC_PARAM_INT_CUTPASSINTREE,
    00124      CBC_PARAM_INT_THREADS,
    00125      CBC_PARAM_INT_CUTPASS,
    00126      CBC_PARAM_INT_VUBTRY,
    00127      CBC_PARAM_INT_DENSE,
    00128      CBC_PARAM_INT_EXPERIMENT,
    00129      CBC_PARAM_INT_DIVEOPT,
    00130      CBC_PARAM_INT_STRATEGY,
    00131      CBC_PARAM_INT_SMALLFACT,
    00132      CBC_PARAM_INT_HOPTIONS,
    00133      CBC_PARAM_INT_CUTLENGTH,
    00134      CBC_PARAM_INT_FPUMPTUNE2,
    00135 #ifdef COIN_HAS_CBC
    00136      CLP_PARAM_INT_LOGLEVEL ,
    00137 #endif
    00138      CBC_PARAM_INT_MAXSAVEDSOLS,
    00139      CBC_PARAM_INT_RANDOMSEED,
    00140      CBC_PARAM_INT_MULTIPLEROOTS,
    00141      CBC_PARAM_INT_STRONG_STRATEGY,
    00142      CBC_PARAM_INT_EXTRA_VARIABLES,
    00143      CBC_PARAM_INT_MAX_SLOW_CUTS,
    00144
    00145      CLP_PARAM_STR_DIRECTION = 201,
    00146      CLP_PARAM_STR_DUALPIVOT,
    00147      CLP_PARAM_STR_SCALING,
    00148      CLP_PARAM_STR_ERRORSALLOWED,
    00149      CLP_PARAM_STR_KEEPNAMES,
    00150      CLP_PARAM_STR_SPARSEFACTOR,
    00151      CLP_PARAM_STR_PRIMALPIVOT,
    00152      CLP_PARAM_STR_PRESOLVE,
    00153      CLP_PARAM_STR_CRASH,
    00154      CLP_PARAM_STR_BIASLU,
    00155      CLP_PARAM_STR_PERTURBATION,
    00156      CLP_PARAM_STR_MESSAGES,
    00157      CLP_PARAM_STR_AUTOSCALE,
    00158      CLP_PARAM_STR_CHOLESKY,
    00159      CLP_PARAM_STR_KKT,
    00160      CLP_PARAM_STR_BARRIERSCALE,
    00161      CLP_PARAM_STR_GAMMA,
    00162      CLP_PARAM_STR_CROSSOVER,
    00163      CLP_PARAM_STR_PFI,
    00164      CLP_PARAM_STR_INTPRINT,
    00165      CLP_PARAM_STR_VECTOR,
    00166      CLP_PARAM_STR_FACTORIZATION,
    00167      CLP_PARAM_STR_ALLCOMMANDS,
    00168      CLP_PARAM_STR_TIME_MODE,
    00169      CLP_PARAM_STR_ABCWANTED,
    00170
    00171      CBC_PARAM_STR_NODESTRATEGY = 251,
    00172      CBC_PARAM_STR_BRANCHSTRATEGY,
    00173      CBC_PARAM_STR_CUTSSTRATEGY,
    00174      CBC_PARAM_STR_HEURISTICSTRATEGY,
    00175      CBC_PARAM_STR_GOMORYCUTS,
    00176      CBC_PARAM_STR_PROBINGCUTS,
    00177      CBC_PARAM_STR_KNAPSACKCUTS,
    00178      CBC_PARAM_STR_REDSPLITCUTS,
    00179      CBC_PARAM_STR_ROUNDING,
    00180      CBC_PARAM_STR_SOLVER,
    00181      CBC_PARAM_STR_CLIQUECUTS,
    00182      CBC_PARAM_STR_COSTSTRATEGY,
    00183      CBC_PARAM_STR_FLOWCUTS,
    00184      CBC_PARAM_STR_MIXEDCUTS,
    00185      CBC_PARAM_STR_TWOMIRCUTS,
    00186      CBC_PARAM_STR_PREPROCESS,
    00187      CBC_PARAM_STR_FPUMP,
    00188      CBC_PARAM_STR_GREEDY,
    00189      CBC_PARAM_STR_COMBINE,
    00190      CBC_PARAM_STR_PROXIMITY,
    00191      CBC_PARAM_STR_LOCALTREE,
    00192      CBC_PARAM_STR_SOS,
    00193      CBC_PARAM_STR_LANDPCUTS,
    00194      CBC_PARAM_STR_RINS,
    00195      CBC_PARAM_STR_RESIDCUTS,
    00196      CBC_PARAM_STR_RENS,
    00197      CBC_PARAM_STR_DIVINGS,
    00198      CBC_PARAM_STR_DIVINGC,
    00199      CBC_PARAM_STR_DIVINGF,
    00200      CBC_PARAM_STR_DIVINGG,
    00201      CBC_PARAM_STR_DIVINGL,
    00202      CBC_PARAM_STR_DIVINGP,
    00203      CBC_PARAM_STR_DIVINGV,
    00204      CBC_PARAM_STR_DINS,
    00205      CBC_PARAM_STR_PIVOTANDFIX,
    00206      CBC_PARAM_STR_RANDROUND,
    00207      CBC_PARAM_STR_NAIVE,
    00208      CBC_PARAM_STR_ZEROHALFCUTS,
    00209      CBC_PARAM_STR_CPX,
    00210      CBC_PARAM_STR_CROSSOVER2,
    00211      CBC_PARAM_STR_PIVOTANDCOMPLEMENT,
    00212      CBC_PARAM_STR_VND,
    00213      CBC_PARAM_STR_LAGOMORYCUTS,
    00214      CBC_PARAM_STR_LATWOMIRCUTS,
    00215      CBC_PARAM_STR_REDSPLIT2CUTS,
    00216      CBC_PARAM_STR_GMICUTS,
    00217      CBC_PARAM_STR_CUTOFF_CONSTRAINT,
    00218
    00219      CLP_PARAM_ACTION_DIRECTORY = 301,
    00220      CLP_PARAM_ACTION_DIRSAMPLE,
    00221      CLP_PARAM_ACTION_DIRNETLIB,
    00222      CBC_PARAM_ACTION_DIRMIPLIB,
    00223      CLP_PARAM_ACTION_IMPORT,
    00224      CLP_PARAM_ACTION_EXPORT,
    00225      CLP_PARAM_ACTION_RESTORE,
    00226      CLP_PARAM_ACTION_SAVE,
    00227      CLP_PARAM_ACTION_DUALSIMPLEX,
    00228      CLP_PARAM_ACTION_PRIMALSIMPLEX,
    00229      CLP_PARAM_ACTION_EITHERSIMPLEX,
    00230      CLP_PARAM_ACTION_MAXIMIZE,
    00231      CLP_PARAM_ACTION_MINIMIZE,
    00232      CLP_PARAM_ACTION_EXIT,
    00233      CLP_PARAM_ACTION_STDIN,
    00234      CLP_PARAM_ACTION_UNITTEST,
    00235      CLP_PARAM_ACTION_NETLIB_EITHER,
    00236      CLP_PARAM_ACTION_NETLIB_DUAL,
    00237      CLP_PARAM_ACTION_NETLIB_PRIMAL,
    00238      CLP_PARAM_ACTION_SOLUTION,
    00239      CLP_PARAM_ACTION_SAVESOL,
    00240      CLP_PARAM_ACTION_TIGHTEN,
    00241      CLP_PARAM_ACTION_FAKEBOUND,
    00242      CLP_PARAM_ACTION_HELP,
    00243      CLP_PARAM_ACTION_PLUSMINUS,
    00244      CLP_PARAM_ACTION_NETWORK,
    00245      CLP_PARAM_ACTION_ALLSLACK,
    00246      CLP_PARAM_ACTION_REVERSE,
    00247      CLP_PARAM_ACTION_BARRIER,
    00248      CLP_PARAM_ACTION_NETLIB_BARRIER,
    00249      CLP_PARAM_ACTION_NETLIB_TUNE,
    00250      CLP_PARAM_ACTION_REALLY_SCALE,
    00251      CLP_PARAM_ACTION_BASISIN,
    00252      CLP_PARAM_ACTION_BASISOUT,
    00253      CLP_PARAM_ACTION_SOLVECONTINUOUS,
    00254      CLP_PARAM_ACTION_CLEARCUTS,
    00255      CLP_PARAM_ACTION_VERSION,
    00256      CLP_PARAM_ACTION_STATISTICS,
    00257      CLP_PARAM_ACTION_DEBUG,
    00258      CLP_PARAM_ACTION_DUMMY,
    00259      CLP_PARAM_ACTION_PRINTMASK,
    00260      CLP_PARAM_ACTION_OUTDUPROWS,
    00261      CLP_PARAM_ACTION_USERCLP,
    00262      CLP_PARAM_ACTION_MODELIN,
    00263      CLP_PARAM_ACTION_CSVSTATISTICS,
    00264      CLP_PARAM_ACTION_STOREDFILE,
    00265      CLP_PARAM_ACTION_ENVIRONMENT,
    00266      CLP_PARAM_ACTION_PARAMETRICS,
    00267      CLP_PARAM_ACTION_GMPL_SOLUTION,
    00268
    00269      CBC_PARAM_ACTION_BAB = 351,
    00270      CBC_PARAM_ACTION_MIPLIB,
    00271      CBC_PARAM_ACTION_STRENGTHEN,
    00272      CBC_PARAM_ACTION_PRIORITYIN,
    00273      CBC_PARAM_ACTION_MIPSTART,
    00274      CBC_PARAM_ACTION_USERCBC,
    00275      CBC_PARAM_ACTION_DOHEURISTIC,
    00276      CLP_PARAM_ACTION_NEXTBESTSOLUTION,
    00277
    00278      CBC_PARAM_NOTUSED_OSLSTUFF = 401,
    00279      CBC_PARAM_NOTUSED_CBCSTUFF,
    00280
    00281      CBC_PARAM_NOTUSED_INVALID = 1000
    00282 } ;
    00283 #include <vector>
    00284 #include <string>
    00285
    00287
    00288 class CbcOrClpParam {
    00289 public:
    00292
    00293      CbcOrClpParam (  );
    00294      CbcOrClpParam (std::string name, std::string help,
    00295                     double lower, double upper, CbcOrClpParameterType type, int display = 2);
    00296      CbcOrClpParam (std::string name, std::string help,
    00297                     int lower, int upper, CbcOrClpParameterType type, int display = 2);
    00298      // Other strings will be added by insert
    00299      CbcOrClpParam (std::string name, std::string help, std::string firstValue,
    00300                     CbcOrClpParameterType type, int whereUsed = 7, int display = 2);
    00301      // Action
    00302      CbcOrClpParam (std::string name, std::string help,
    00303                     CbcOrClpParameterType type, int whereUsed = 7, int display = 2);
    00305      CbcOrClpParam(const CbcOrClpParam &);
    00307      CbcOrClpParam & operator=(const CbcOrClpParam & rhs);
    00309      ~CbcOrClpParam (  );
    00311
    00314
    00315      void append(std::string keyWord);
    00317      void addHelp(std::string keyWord);
    00319      inline std::string  name(  ) const {
    00320           return name_;
    00321      }
    00323      inline std::string  shortHelp(  ) const {
    00324           return shortHelp_;
    00325      }
    00327      int setDoubleParameter(CbcModel & model, double value) ;
    00329      const char * setDoubleParameterWithMessage ( CbcModel & model, double  value , int & returnCode);
    00331      double doubleParameter(CbcModel & model) const;
    00333      int setIntParameter(CbcModel & model, int value) ;
    00335      const char * setIntParameterWithMessage ( CbcModel & model, int value , int & returnCode);
    00337      int intParameter(CbcModel & model) const;
    00339      int setDoubleParameter(ClpSimplex * model, double value) ;
    00341      double doubleParameter(ClpSimplex * model) const;
    00343      const char * setDoubleParameterWithMessage ( ClpSimplex * model, double  value , int & returnCode);
    00345      int setIntParameter(ClpSimplex * model, int value) ;
    00347      const char * setIntParameterWithMessage ( ClpSimplex * model, int  value , int & returnCode);
    00349      int intParameter(ClpSimplex * model) const;
    00351      int setDoubleParameter(OsiSolverInterface * model, double value) ;
    00353      const char * setDoubleParameterWithMessage ( OsiSolverInterface * model, double  value , int & returnCode);
    00355      double doubleParameter(OsiSolverInterface * model) const;
    00357      int setIntParameter(OsiSolverInterface * model, int value) ;
    00359      const char * setIntParameterWithMessage ( OsiSolverInterface * model, int  value , int & returnCode);
    00361      int intParameter(OsiSolverInterface * model) const;
    00363      int checkDoubleParameter(double value) const;
    00365      std::string matchName (  ) const;
    00367      int lengthMatchName (  ) const;
    00369      int parameterOption ( std::string check ) const;
    00371      void printOptions (  ) const;
    00373      inline std::string currentOption (  ) const {
    00374           return definedKeyWords_[currentKeyWord_];
    00375      }
    00377      void setCurrentOption ( int value , bool printIt = false);
    00379      const char * setCurrentOptionWithMessage ( int value );
    00381      void setCurrentOption (const std::string value );
    00383      inline int currentOptionAsInteger (  ) const {
    00384           return currentKeyWord_;
    00385      }
    00387      void setIntValue ( int value );
    00388      inline int intValue () const {
    00389           return intValue_;
    00390      }
    00392      void setDoubleValue ( double value );
    00393      inline double doubleValue () const {
    00394           return doubleValue_;
    00395      }
    00397      void setStringValue ( std::string value );
    00398      inline std::string stringValue () const {
    00399           return stringValue_;
    00400      }
    00402      int matches (std::string input) const;
    00404      inline CbcOrClpParameterType type() const {
    00405           return type_;
    00406      }
    00408      inline int displayThis() const {
    00409           return display_;
    00410      }
    00412      inline void setLonghelp(const std::string help) {
    00413           longHelp_ = help;
    00414      }
    00416      void printLongHelp() const;
    00418      void printString() const;
    00424      inline int whereUsed() const {
    00425           return whereUsed_;
    00426      }
    00427
    00428 private:
    00430      void gutsOfConstructor();
    00432
    00433 private:
    00434
    00439      // Type see CbcOrClpParameterType
    00440      CbcOrClpParameterType type_;
    00442      double lowerDoubleValue_;
    00443      double upperDoubleValue_;
    00445      int lowerIntValue_;
    00446      int upperIntValue_;
    00447      // Length of name
    00448      unsigned int lengthName_;
    00449      // Minimum match
    00450      unsigned int lengthMatch_;
    00452      std::vector<std::string> definedKeyWords_;
    00454      std::string name_;
    00456      std::string shortHelp_;
    00458      std::string longHelp_;
    00460      CbcOrClpParameterType action_;
    00462      int currentKeyWord_;
    00464      int display_;
    00466      int intValue_;
    00468      double doubleValue_;
    00470      std::string stringValue_;
    00476      int whereUsed_;
    00478 };
    00480 std::string CoinReadNextField();
    00481
    00482 std::string CoinReadGetCommand(int argc, const char *argv[]);
    00483 std::string CoinReadGetString(int argc, const char *argv[]);
    00484 // valid 0 - okay, 1 bad, 2 not there
    00485 int CoinReadGetIntField(int argc, const char *argv[], int * valid);
    00486 double CoinReadGetDoubleField(int argc, const char *argv[], int * valid);
    00487 void CoinReadPrintit(const char * input);
    00488 void setCbcOrClpPrinting(bool yesNo);
    00489 #define CBCMAXPARAMETERS 250
    00490 /*
    00491   Subroutine to establish the cbc parameter array. See the description of
    00492   class CbcOrClpParam for details. Pulled from C..Main() for clarity.
    00493 */
    00494 void establishParams (int &numberParameters, CbcOrClpParam *const parameters);
    00495 // Given a parameter type - returns its number in list
    00496 int whichParam (CbcOrClpParameterType name,
    00497                 int numberParameters, CbcOrClpParam *const parameters);
    00498 // Dump a solution to file
    00499 void saveSolution(const ClpSimplex * lpSolver, std::string fileName);
    00500 #endif  /* CbcOrClpParam_H */

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines