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