source: branches/sandbox/Cbc/src/CbcGenParam.hpp @ 1374

Last change on this file since 1374 was 1374, checked in by bjarni, 10 years ago

Renamed all CbcGenXXXX.cpp_lou back to CbcGenXXXX.cpp (same for .hpp) after reorganizing the CbcParam? and CbcSolver? files

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