# CbcOrClpParam.hpp

Go to the documentation of this file.

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

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines