source: trunk/Cbc/src/CbcGenParam.hpp @ 706

Last change on this file since 706 was 706, checked in by forrest, 12 years ago

take out };

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