source: stable/2.8/Cbc/src/CbcGenOsiParam.hpp @ 1902

Last change on this file since 1902 was 1902, checked in by stefan, 5 years ago

sync with trunk rev 1901

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