source: stable/2.6/Cbc/src/CbcGenCbcParam.hpp @ 2122

Last change on this file since 2122 was 1464, checked in by stefan, 9 years ago

merge split branch into trunk; fix some examples

File size: 4.9 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 CbcCbcParam_H
9#define CbcCbcParam_H
10
11/* \file CbcGenCbcParam.hpp
12   \brief Declarations for parameters that act on a CbcModel object.
13*/
14
15/*
16  $Id: CbcGenCbcParam.hpp 1173 2009-06-04 09:44:10Z forrest $
17*/
18
19/*! \class CbcCbcParam
20    \brief Class for control parameters that act on a CbcModel object.
21
22    Adds parameter type codes and push/pull functions to the generic parameter
23    object.
24*/
25
26class CbcCbcParam : public CoinParam {
27
28public:
29
30    /*! \name Subtypes */
31//@{
32
33    /*! \enum CbcCbcParamCode
34        \brief Enumeration for parameters that control a CbcModel object
35
36      These are parameters that control the operation of a CbcModel object.
37      CBCCBC_FIRSTPARAM and CBCCBC_LASTPARAM are markers to allow convenient
38      separation of parameter groups.
39    */
40    typedef enum { CBCCBC_FIRSTPARAM = CbcGenParam::CBCGEN_LASTPARAM + 1,
41
42                   ALLOWABLEGAP, COSTSTRATEGY,
43                   CUTDEPTH, CUTOFF, CUTPASS, DIRECTION,
44                   GAPRATIO,
45                   INCREMENT, INFEASIBILITYWEIGHT, INTEGERTOLERANCE,
46                   LOGLEVEL, MAXIMIZE, MAXNODES, MINIMIZE,
47                   MIPOPTIONS, MOREMIPOPTIONS, NUMBERANALYZE,
48                   NUMBERBEFORE, NUMBERMINI,
49                   STRONGBRANCHING, TIMELIMIT_BAB,
50
51                   CBCCBC_LASTPARAM
52
53                 } CbcCbcParamCode ;
54
55//@}
56
57    /*! \name Constructors and Destructors
58
59      Be careful how you specify parameters for the constructors! There's great
60      potential for confusion.
61    */
62//@{
63    /*! \brief Default constructor */
64
65    CbcCbcParam() ;
66
67    /*! \brief Constructor for a parameter with a double value
68
69      The default value is 0.0. Be careful to clearly indicate that \p lower and
70      \p upper are real (double) values to distinguish this constructor from the
71      constructor for an integer parameter.
72    */
73    CbcCbcParam(CbcCbcParamCode code, std::string name, std::string help,
74                double lower, double upper, double dflt = 0.0,
75                bool display = true) ;
76
77    /*! \brief Constructor for a parameter with an integer value
78
79      The default value is 0.
80    */
81    CbcCbcParam(CbcCbcParamCode code, std::string name, std::string help,
82                int lower, int upper, int dflt = 0,
83                bool display = true) ;
84
85    /*! \brief Constructor for a parameter with keyword values
86
87      The string supplied as \p firstValue becomes the first keyword.
88      Additional keywords can be added using appendKwd(). Keywords are numbered
89      from zero. It's necessary to specify both the first keyword (\p
90      firstValue) and the default keyword index (\p dflt) in order to
91      distinguish this constructor from the string and action parameter
92      constructors.
93    */
94    CbcCbcParam(CbcCbcParamCode code, std::string name, std::string help,
95                std::string firstValue, int dflt, bool display = true) ;
96
97    /*! \brief Constructor for a string parameter
98
99      The default string value must be specified explicitly to distinguish
100      a string constructor from an action parameter constructor.
101    */
102
103    CbcCbcParam(CbcCbcParamCode code, std::string name, std::string help,
104                std::string dflt, bool display = true) ;
105
106    /*! \brief Constructor for an action parameter */
107
108    CbcCbcParam(CbcCbcParamCode code, std::string name, std::string help,
109                bool display = true) ;
110
111    /*! \brief Copy constructor */
112
113    CbcCbcParam(const CbcCbcParam &orig) ;
114
115    /*! \brief Clone */
116
117    CbcCbcParam *clone() ;
118
119    /*! \brief Assignment */
120
121    CbcCbcParam &operator=(const CbcCbcParam &rhs) ;
122
123    /*! \brief  Destructor */
124
125    ~CbcCbcParam() ;
126
127//@}
128
129    /*! \name Methods to query and manipulate a parameter object */
130//@{
131
132    /*! \brief Get the parameter code  */
133
134    inline CbcCbcParamCode paramCode() const {
135        return (paramCode_) ;
136    }
137
138    /*! \brief Set the parameter code */
139
140    inline void setParamCode(CbcCbcParamCode code) {
141        paramCode_ = code ;
142    }
143
144    /*! \brief Get the underlying CbcModel object */
145
146    inline CbcModel *obj() const {
147        return (obj_) ;
148    }
149
150    /*! \brief Set the underlying CbcModel object */
151
152    inline void setObj(CbcModel *obj) {
153        obj_ = obj ;
154    }
155
156//@}
157
158private:
159
160    /*! \name Data */
161//@{
162
163    /// Parameter code
164    CbcCbcParamCode paramCode_ ;
165
166    /// CbcModel object
167    CbcModel *obj_ ;
168
169//@}
170
171} ;
172
173
174/*
175  Declare the utility functions.
176*/
177
178namespace CbcCbcParamUtils {
179void addCbcCbcParams(int &numParams, CoinParamVec &paramVec,
180                     CbcModel *model) ;
181void loadCbcParamObj(const CoinParamVec paramVec, int first, int last,
182                     CbcModel *model) ;
183void setCbcModelDefaults (CbcModel *model) ;
184
185int pushCbcCbcDbl(CoinParam *param) ;
186int pushCbcCbcInt(CoinParam *param) ;
187}
188
189#endif
190
Note: See TracBrowser for help on using the repository browser.