source: branches/devel/Cbc/src/CbcGenCbcParam.hpp @ 602

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

Initial commit of cbc-generic source.

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