CbcParam.hpp
Go to the documentation of this file.
1 /* $Id: CbcParam.hpp 1432 2010-02-07 19:33:53Z bjarni $ */
2 // Copyright (C) 2002, International Business Machines
3 // Corporation and others. All Rights Reserved.
4 
5 #ifndef CbcParam_H
6 #define CbcParam_H
7 
8 #include "OsiSolverInterface.hpp"
9 #include "CbcModel.hpp"
10 class ClpSimplex;
35 
38 
47 
52 
56 
72 
93 
109 
142 
145 
147 };
148 
149 
151 
152 class CbcParam {
153 
154 public:
155 
158  CbcParam ( );
160  CbcParam (std::string name, std::string help,
161  double lower, double upper, CbcParameterType type, bool display = true);
162  CbcParam (std::string name, std::string help,
163  int lower, int upper, CbcParameterType type, bool display = true);
164  // Other strings will be added by insert
165  CbcParam (std::string name, std::string help, std::string firstValue,
166  CbcParameterType type, int defaultIndex = 0, bool display = true);
167  // Action
168  CbcParam (std::string name, std::string help,
169  CbcParameterType type, int indexNumber = -1, bool display = true);
171  CbcParam(const CbcParam &);
173  CbcParam & operator=(const CbcParam & rhs);
175  ~CbcParam ( );
177 
180  void append(std::string keyWord);
183  void addHelp(std::string keyWord);
185  inline std::string name( ) const {
186  return name_;
187  };
189  inline std::string shortHelp( ) const {
190  return shortHelp_;
191  };
193  int setDoubleParameter(CbcModel & model, double value) const;
195  double doubleParameter(CbcModel & model) const;
197  int setIntParameter(CbcModel & model, int value) const;
199  int intParameter(CbcModel & model) const;
201  int setDoubleParameter(ClpSimplex * model, double value) const;
203  double doubleParameter(ClpSimplex * model) const;
205  int setIntParameter(ClpSimplex * model, int value) const;
207  int intParameter(ClpSimplex * model) const;
209  int setDoubleParameter(OsiSolverInterface * model, double value) const;
211  double doubleParameter(OsiSolverInterface * model) const;
213  int setIntParameter(OsiSolverInterface * model, int value) const;
215  int intParameter(OsiSolverInterface * model) const;
217  int checkDoubleParameter(double value) const;
219  std::string matchName ( ) const;
221  int parameterOption ( std::string check ) const;
223  void printOptions ( ) const;
225  inline std::string currentOption ( ) const {
227  }
229  inline void setCurrentOption ( int value ) {
230  currentKeyWord_ = value;
231  }
233  inline void setIntValue ( int value ) {
234  intValue_ = value;
235  }
236  inline int intValue () const {
237  return intValue_;
238  }
240  inline void setDoubleValue ( double value ) {
241  doubleValue_ = value;
242  }
243  inline double doubleValue () const {
244  return doubleValue_;
245  }
247  inline void setStringValue ( std::string value ) {
248  stringValue_ = value;
249  }
250  inline std::string stringValue () const {
251  return stringValue_;
252  }
254  int matches (std::string input) const;
256  inline CbcParameterType type() const {
257  return type_;
258  }
260  inline bool displayThis() const {
261  return display_;
262  }
264  inline void setLonghelp(const std::string help) {
265  longHelp_ = help;
266  }
268  void printLongHelp() const;
270  void printString() const;
272  inline int indexNumber() const {
273  return indexNumber_;
274  }
275 private:
277  void gutsOfConstructor();
279 private:
281 
286  // Type see CbcParameterType
294  // Length of name
295  unsigned int lengthName_;
296  // Minimum match
297  unsigned int lengthMatch_;
299  std::vector<std::string> definedKeyWords_;
301  std::string name_;
303  std::string shortHelp_;
305  std::string longHelp_;
311  bool display_;
315  double doubleValue_;
317  std::string stringValue_;
321 };
322 #endif /* CbcParam_H */
323