source: stable/2.4/Cbc/src/CbcGenOsiParam.hpp @ 1271

Last change on this file since 1271 was 1271, checked in by forrest, 10 years ago

Creating new stable branch 2.4 from trunk (rev 1270)

File size: 5.0 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/*
16  $Id: CbcGenOsiParam.hpp 1173 2009-06-04 09:44:10Z forrest $
17*/
18
19/*! \class CbcOsiParam
20    \brief Class for control parameters that act on a OsiSolverInterface object.
21
22    Adds parameter type codes and push/pull functions to the generic parameter
23    object.
24*/
25
26class CbcOsiParam : public CoinParam
27{
28
29public:
30
31/*! \name Subtypes */
32//@{
33
34  /*! \enum CbcOsiParamCode
35      \brief Enumeration for parameters that control an OsiSolverInterface
36             object
37
38    These are parameters that control the operation of an OsiSolverInterface
39    object. CBCOSI_FIRSTPARAM and CBCOSI_LASTPARAM are markers to allow
40    convenient separation of parameter groups.
41  */
42  typedef enum
43  { CBCOSI_FIRSTPARAM = CbcCbcParam::CBCCBC_LASTPARAM+1,
44 
45    ALGORITHM, ALLSLACK, AUTOSCALE, BARRIER, BARRIERSCALE,
46    BASISIN, BASISOUT, BIASLU, CHOLESKY, CRASH, CROSSOVER,
47    DUALBOUND, DUALPIVOT, DUALSIMPLEX, DUALTOLERANCE, FAKEBOUND,
48    GAMMA, IDIOT, KEEPNAMES, KKT, MAXITERATION, MAXHOTITS, NETLIB_BARRIER,
49    NETLIB_DUAL, NETLIB_PRIMAL, NETWORK, OBJSCALE, PERTURBATION,
50    PERTVALUE, PFI, PLUSMINUS, PRESOLVE, PRESOLVEOPTIONS, PRESOLVEPASS,
51    PRIMALPIVOT, PRIMALSIMPLEX, PRIMALTOLERANCE, REALLY_SCALE,
52    RESTORE, REVERSE, RHSSCALE, SAVE, SCALING, SLPVALUE, SOLVERLOGLEVEL,
53    SPARSEFACTOR, SPECIALOPTIONS, SPRINT, TIGHTEN,
54
55    CBCOSI_LASTPARAM
56
57  } CbcOsiParamCode ;
58
59//@}
60
61/*! \name Constructors and Destructors
62
63  Be careful how you specify parameters for the constructors! There's great
64  potential for confusion.
65*/
66//@{
67  /*! \brief Default constructor */
68
69  CbcOsiParam() ;
70
71  /*! \brief Constructor for a parameter with a double value
72 
73    The default value is 0.0. Be careful to clearly indicate that \p lower and
74    \p upper are real (double) values to distinguish this constructor from the
75    constructor for an integer parameter.
76  */
77  CbcOsiParam(CbcOsiParamCode code, std::string name, std::string help,
78               double lower, double upper, double dflt = 0.0,
79               bool display = true) ;
80
81  /*! \brief Constructor for a parameter with an integer value
82 
83    The default value is 0.
84  */
85  CbcOsiParam(CbcOsiParamCode code, std::string name, std::string help,
86               int lower, int upper, int dflt = 0,
87               bool display = true) ;
88
89  /*! \brief Constructor for a parameter with keyword values
90 
91    The string supplied as \p firstValue becomes the first keyword.
92    Additional keywords can be added using appendKwd(). Keywords are numbered
93    from zero. It's necessary to specify both the first keyword (\p
94    firstValue) and the default keyword index (\p dflt) in order to
95    distinguish this constructor from the string and action parameter
96    constructors.
97  */
98  CbcOsiParam(CbcOsiParamCode code, std::string name, std::string help,
99               std::string firstValue, int dflt, bool display = true) ;
100
101  /*! \brief Constructor for a string parameter
102 
103    The default string value must be specified explicitly to distinguish
104    a string constructor from an action parameter constructor.
105  */
106
107  CbcOsiParam(CbcOsiParamCode code, std::string name, std::string help,
108               std::string dflt, bool display = true) ;
109
110  /*! \brief Constructor for an action parameter */
111
112  CbcOsiParam(CbcOsiParamCode code, std::string name, std::string help,
113               bool display = true) ;
114
115  /*! \brief Copy constructor */
116
117  CbcOsiParam(const CbcOsiParam &orig) ;
118
119  /*! \brief Clone */
120
121  CbcOsiParam *clone() ;
122
123  /*! \brief Assignment */
124 
125  CbcOsiParam &operator=(const CbcOsiParam &rhs) ;
126
127  /*! \brief  Destructor */
128
129  ~CbcOsiParam() ;
130
131//@}
132
133/*! \name Methods to query and manipulate a parameter object */
134//@{
135
136  /*! \brief Get the parameter code  */
137
138  inline CbcOsiParamCode paramCode() const { return (paramCode_) ; } 
139
140  /*! \brief Set the parameter code */
141
142  inline void setParamCode(CbcOsiParamCode code) { paramCode_ = code ; } 
143
144  /*! \brief Get the underlying OsiSolverInterface object */
145
146  inline OsiSolverInterface *obj() const { return (obj_) ; } 
147
148  /*! \brief Set the underlying OsiSolverInterace object */
149
150  inline void setObj(OsiSolverInterface *obj) { obj_ = obj ; } 
151
152//@}
153
154
155private:
156
157/*! \name Data */
158//@{
159
160  /// Parameter code
161  CbcOsiParamCode paramCode_ ;
162
163  /// OsiSolverInterface object
164  OsiSolverInterface *obj_ ;
165
166//@}
167
168} ;
169
170
171
172/*
173  Declare the utility functions.
174*/
175
176namespace CbcOsiParamUtils
177{ void addCbcOsiParams(int &numParams, CoinParamVec &paramVec,
178                       OsiSolverInterface *osi) ;
179  void loadOsiParamObj(const CoinParamVec paramVec,
180                       CbcGenCtlBlk *ctlBlk) ;
181  void setOsiSolverInterfaceDefaults(OsiSolverInterface *osi) ;
182
183  int pushCbcOsiLogLevel(CoinParam *param) ;
184  int pushCbcOsiInt(CoinParam *param) ;
185  int pushCbcOsiDbl(CoinParam *param) ;
186  int pushCbcOsiKwd(CoinParam *param) ;
187  int pushCbcOsiHint(CoinParam *param) ;
188}
189
190
191#endif
Note: See TracBrowser for help on using the repository browser.