source: branches/devel/Cbc/src/CbcGenParam.hpp @ 606

Last change on this file since 606 was 591, checked in by lou, 13 years ago

Initial commit of cbc-generic source.

  • Property svn:eol-style set to native
File size: 5.6 KB
RevLine 
[591]1/*
2  Copyright (C) 2007, Lou Hafer, International Business Machines Corporation
3  and others.  All Rights Reserved.
4
5  This file is part of cbc-generic.
6*/
7
8#ifndef CbcGenParam_H
9#define CbcGenParam_H
10
11/* \file CbcGenParam.hpp
12   \brief Declarations for parameters that control the cbc-generic main
13          program.
14*/
15
16class CbcGenCtlBlk ;
17
18/*! \class CbcGenParam
19    \brief Class for cbc-generic control parameters
20
21    Adds parameter type codes and push/pull functions to the generic parameter
22    object.
23*/
24
25class CbcGenParam : public CoinParam
26{
27
28public:
29
30/*! \name Subtypes */
31//@{
32
33  /*! \enum CbcGenParamCode
34      \brief Enumeration for cbc-generic parameters
35
36    These are parameters that control the operation of the cbc-generic main
37    program by operating on a CbcGenCtlBlk object. CBCGEN_FIRSTPARAM and
38    CBCGEN_LASTPARM are markers to allow convenient separation of parameter
39    groups.
40  */
41  typedef enum
42  { CBCGEN_FIRSTPARAM = 0,
43 
44    GENERALQUERY, FULLGENERALQUERY, HELP,
45    BAB, CLEARCUTS, CLIQUECUTS, COMBINE, COSTSTRATEGY,
46    CPP, CUTDEPTH, CUTSTRATEGY,
47    DEBUG, DIRECTORY, DJFIX, DUMMY,
48    ERRORSALLOWED, EXIT, EXPORT,
49    FLOWCUTS, FPUMP, FPUMPITS, GOMORYCUTS, GREEDY, HEURISTICSTRATEGY,
50    IMPORT, INTPRINT, KNAPSACKCUTS, LOCALTREE,
51    MESSAGES, MIPLIB, MIXEDCUTS, ODDHOLECUTS, OUTDUPROWS, OUTPUTFORMAT,
52    PREPROCESS, PRINTMASK, PRINTOPTIONS, PRINTVERSION, PRIORITYIN, PROBINGCUTS,
53    REDSPLITCUTS, ROUNDING,
54    SOLUTION, SOLVECONTINUOUS, SOLVER, SOS, STDIN, STRENGTHEN,
55    TIGHTENFACTOR, TWOMIRCUTS,
56    UNITTEST, USERCBC, USESOLUTION, VERBOSE, SHOWUNIMP,
57
58    CBCGEN_LASTPARAM
59
60  } CbcGenParamCode ;
61
62//@}
63
64/*! \name Constructors and Destructors
65
66  Be careful how you specify parameters for the constructors! There's great
67  potential for confusion.
68*/
69//@{
70  /*! \brief Default constructor */
71
72  CbcGenParam() ;
73
74  /*! \brief Constructor for a parameter with a double value
75 
76    The default value is 0.0. Be careful to clearly indicate that \p lower and
77    \p upper are real (double) values to distinguish this constructor from the
78    constructor for an integer parameter.
79  */
80  CbcGenParam(CbcGenParamCode code, std::string name, std::string help,
81               double lower, double upper, double dflt = 0.0,
82               bool display = true) ;
83
84  /*! \brief Constructor for a parameter with an integer value
85 
86    The default value is 0.
87  */
88  CbcGenParam(CbcGenParamCode code, std::string name, std::string help,
89               int lower, int upper, int dflt = 0,
90               bool display = true) ;
91
92  /*! \brief Constructor for a parameter with keyword values
93 
94    The string supplied as \p firstValue becomes the first keyword.
95    Additional keywords can be added using appendKwd(). Keywords are numbered
96    from zero. It's necessary to specify both the first keyword (\p
97    firstValue) and the default keyword index (\p dflt) in order to
98    distinguish this constructor from the string and action parameter
99    constructors.
100  */
101  CbcGenParam(CbcGenParamCode code, std::string name, std::string help,
102               std::string firstValue, int dflt, bool display = true) ;
103
104  /*! \brief Constructor for a string parameter
105 
106    The default string value must be specified explicitly to distinguish
107    a string constructor from an action parameter constructor.
108  */
109
110  CbcGenParam(CbcGenParamCode code, std::string name, std::string help,
111               std::string dflt, bool display = true) ;
112
113  /*! \brief Constructor for an action parameter */
114
115  CbcGenParam(CbcGenParamCode code, std::string name, std::string help,
116               bool display = true) ;
117
118  /*! \brief Copy constructor */
119
120  CbcGenParam(const CbcGenParam &orig) ;
121
122  /*! \brief Clone */
123
124  CbcGenParam *clone() ;
125
126  /*! \brief Assignment */
127 
128  CbcGenParam &operator=(const CbcGenParam &rhs) ;
129
130  /*! \brief  Destructor */
131
132  ~CbcGenParam() ;
133
134//@}
135
136/*! \name Methods to query and manipulate a parameter object */
137//@{
138
139  /*! \brief Get the parameter code  */
140
141  inline CbcGenParamCode paramCode() const { return (paramCode_) ; } ;
142
143  /*! \brief Set the parameter code */
144
145  inline void setParamCode(CbcGenParamCode code) { paramCode_ = code ; } ;
146
147  /*! \brief Get the underlying cbc-generic control object */
148
149  inline CbcGenCtlBlk *obj() const { return (obj_) ; } ;
150
151  /*! \brief Set the underlying cbc-generic control object */
152
153  inline void setObj(CbcGenCtlBlk *obj) { obj_ = obj ; } ;
154
155//@}
156
157
158private:
159
160/*! \name Data */
161//@{
162
163  /// Parameter code
164  CbcGenParamCode paramCode_ ;
165
166  /// cbc-generic control object
167  CbcGenCtlBlk *obj_ ;
168
169//@}
170
171} ;
172
173/*
174  Declare the utility functions.
175*/
176
177namespace CbcGenParamUtils
178{ void addCbcGenParams(int &numParams, CoinParamVec &paramVec,
179                       CbcGenCtlBlk *ctlBlk) ;
180  void loadGenParamObj(const CoinParamVec paramVec, int first, int last,
181                       CbcGenCtlBlk *ctlBlk) ;
182 
183  void saveSolution(const OsiSolverInterface *osi, std::string fileName) ;
184  bool readSolution(std::string fileName,
185                    int &numRows, int &numCols, double &objVal,
186                    double **rowActivity, double **dualVars,
187                    double **primalVars, double **reducedCosts) ;
188
189  int doBaCParam(CoinParam *param) ;
190  int doDebugParam(CoinParam *param) ;
191  int doExitParam(CoinParam *param) ;
192  int doHelpParam(CoinParam *param) ;
193  int doImportParam(CoinParam *param) ;
194  int doPrintMaskParam(CoinParam *param) ;
195  int doNothingParam(CoinParam *param) ;
196  int doSolutionParam(CoinParam *param) ;
197  int doUnimplementedParam(CoinParam *param) ;
198  int doVersionParam(CoinParam *param) ;
199
200  int pushCbcGenDblParam(CoinParam *param) ;
201  int pushCbcGenIntParam(CoinParam *param) ;
202  int pushCbcGenKwdParam(CoinParam *param) ;
203  int pushCbcGenStrParam(CoinParam *param) ;
204
205  int pushCbcGenCutParam(CoinParam *param) ;
206}
207
208
209#endif
Note: See TracBrowser for help on using the repository browser.