- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- File List
- File Members

# /home/coin/SVN-release/Alps-1.2.1/Clp/src/CbcOrClpParam.hpp

Go to the documentation of this file.

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