source: branches/devel/Cbc/src/CbcGenOsiParam.hpp @ 601

Last change on this file since 601 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.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 CbcOsiParam_H
9#define CbcOsiParam_H
10
11/* \file CbcGenOsiParam.hpp
12   \brief Declarations for parameters that act on a OsiSolverInterface object.
13*/
14
15/*! \class CbcOsiParam
16    \brief Class for control parameters that act on a OsiSolverInterface object.
17
18    Adds parameter type codes and push/pull functions to the generic parameter
19    object.
20*/
21
22class CbcOsiParam : public CoinParam
23{
24
25public:
26
27/*! \name Subtypes */
28//@{
29
30  /*! \enum CbcOsiParamCode
31      \brief Enumeration for parameters that control an OsiSolverInterface
32             object
33
34    These are parameters that control the operation of an OsiSolverInterface
35    object. CBCOSI_FIRSTPARAM and CBCOSI_LASTPARAM are markers to allow
36    convenient separation of parameter groups.
37  */
38  typedef enum
39  { CBCOSI_FIRSTPARAM = CbcCbcParam::CBCCBC_LASTPARAM+1,
40 
41    ALGORITHM, ALLSLACK, AUTOSCALE, BARRIER, BARRIERSCALE,
42    BASISIN, BASISOUT, BIASLU, CHOLESKY, CRASH, CROSSOVER,
43    DUALBOUND, DUALPIVOT, DUALSIMPLEX, DUALTOLERANCE, FAKEBOUND,
44    GAMMA, IDIOT, KEEPNAMES, KKT, MAXITERATION, MAXHOTITS, NETLIB_BARRIER,
45    NETLIB_DUAL, NETLIB_PRIMAL, NETWORK, OBJSCALE, PERTURBATION,
46    PERTVALUE, PFI, PLUSMINUS, PRESOLVE, PRESOLVEOPTIONS, PRESOLVEPASS,
47    PRIMALPIVOT, PRIMALSIMPLEX, PRIMALTOLERANCE, REALLY_SCALE,
48    RESTORE, REVERSE, RHSSCALE, SAVE, SCALING, SLPVALUE, SOLVERLOGLEVEL,
49    SPARSEFACTOR, SPECIALOPTIONS, SPRINT, TIGHTEN,
50
51    CBCOSI_LASTPARAM
52
53  } CbcOsiParamCode ;
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  CbcOsiParam() ;
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  CbcOsiParam(CbcOsiParamCode 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  CbcOsiParam(CbcOsiParamCode 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  CbcOsiParam(CbcOsiParamCode 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  CbcOsiParam(CbcOsiParamCode code, std::string name, std::string help,
104               std::string dflt, bool display = true) ;
105
106  /*! \brief Constructor for an action parameter */
107
108  CbcOsiParam(CbcOsiParamCode code, std::string name, std::string help,
109               bool display = true) ;
110
111  /*! \brief Copy constructor */
112
113  CbcOsiParam(const CbcOsiParam &orig) ;
114
115  /*! \brief Clone */
116
117  CbcOsiParam *clone() ;
118
119  /*! \brief Assignment */
120 
121  CbcOsiParam &operator=(const CbcOsiParam &rhs) ;
122
123  /*! \brief  Destructor */
124
125  ~CbcOsiParam() ;
126
127//@}
128
129/*! \name Methods to query and manipulate a parameter object */
130//@{
131
132  /*! \brief Get the parameter code  */
133
134  inline CbcOsiParamCode paramCode() const { return (paramCode_) ; } ;
135
136  /*! \brief Set the parameter code */
137
138  inline void setParamCode(CbcOsiParamCode code) { paramCode_ = code ; } ;
139
140  /*! \brief Get the underlying OsiSolverInterface object */
141
142  inline OsiSolverInterface *obj() const { return (obj_) ; } ;
143
144  /*! \brief Set the underlying OsiSolverInterace object */
145
146  inline void setObj(OsiSolverInterface *obj) { obj_ = obj ; } ;
147
148//@}
149
150
151private:
152
153/*! \name Data */
154//@{
155
156  /// Parameter code
157  CbcOsiParamCode paramCode_ ;
158
159  /// OsiSolverInterface object
160  OsiSolverInterface *obj_ ;
161
162//@}
163
164} ;
165
166
167
168/*
169  Declare the utility functions.
170*/
171
172namespace CbcOsiParamUtils
173{ void addCbcOsiParams(int &numParams, CoinParamVec &paramVec,
174                       OsiSolverInterface *osi) ;
175  void loadOsiParamObj(const CoinParamVec paramVec,
176                       CbcGenCtlBlk *ctlBlk) ;
177  void setOsiSolverInterfaceDefaults(OsiSolverInterface *osi) ;
178
179  int pushCbcOsiLogLevel(CoinParam *param) ;
180  int pushCbcOsiInt(CoinParam *param) ;
181  int pushCbcOsiDbl(CoinParam *param) ;
182  int pushCbcOsiKwd(CoinParam *param) ;
183  int pushCbcOsiHint(CoinParam *param) ;
184}
185
186
187#endif
Note: See TracBrowser for help on using the repository browser.