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 
CbcParameterType type_
If double == okay.
Definition: CbcParam.hpp:287
int currentKeyWord_
Current keyWord (if a keyword parameter)
Definition: CbcParam.hpp:309
~CbcParam()
Destructor.
int lowerIntValue_
If int == okay.
Definition: CbcParam.hpp:292
void setLonghelp(const std::string help)
Set Long help.
Definition: CbcParam.hpp:264
void setDoubleValue(double value)
Sets double value.
Definition: CbcParam.hpp:240
std::string name() const
Returns name.
Definition: CbcParam.hpp:185
CbcParameterType type() const
type
Definition: CbcParam.hpp:256
int intValue() const
Insert string (only valid for keywords)
Definition: CbcParam.hpp:236
int indexNumber_
index number to use for display purposes
Definition: CbcParam.hpp:319
void setStringValue(std::string value)
Sets string value.
Definition: CbcParam.hpp:247
unsigned int lengthMatch_
If double == okay.
Definition: CbcParam.hpp:297
int checkDoubleParameter(double value) const
Checks a double parameter (nonzero code if error)
std::string stringValue_
String parameter - current value.
Definition: CbcParam.hpp:317
double doubleParameter(CbcModel &model) const
Gets a double parameter.
double doubleValue() const
Insert string (only valid for keywords)
Definition: CbcParam.hpp:243
void append(std::string keyWord)
Insert string (only valid for keywords)
void printLongHelp() const
Print Long help.
std::string stringValue() const
Insert string (only valid for keywords)
Definition: CbcParam.hpp:250
unsigned int lengthName_
If double == okay.
Definition: CbcParam.hpp:295
void printString() const
Print action and string.
int indexNumber() const
type for classification
Definition: CbcParam.hpp:272
std::string longHelp_
Long help.
Definition: CbcParam.hpp:305
CbcParameterType action_
Action.
Definition: CbcParam.hpp:307
void setCurrentOption(int value)
Sets current parameter option.
Definition: CbcParam.hpp:229
double upperDoubleValue_
If double == okay.
Definition: CbcParam.hpp:290
bool displayThis() const
whether to display
Definition: CbcParam.hpp:260
void gutsOfConstructor()
gutsOfConstructor
std::string name_
Name.
Definition: CbcParam.hpp:301
std::string shortHelp_
Short help.
Definition: CbcParam.hpp:303
CbcParameterType
Parameter codes.
Definition: CbcParam.hpp:34
int intParameter(CbcModel &model) const
Gets a int parameter.
int upperIntValue_
If double == okay.
Definition: CbcParam.hpp:293
int setDoubleParameter(CbcModel &model, double value) const
Sets a double parameter (nonzero code if error)
std::vector< std::string > definedKeyWords_
set of valid strings
Definition: CbcParam.hpp:299
double doubleValue_
Double parameter - current value.
Definition: CbcParam.hpp:315
double lowerDoubleValue_
If double == okay.
Definition: CbcParam.hpp:289
CbcParam & operator=(const CbcParam &rhs)
Assignment operator. This copies the data.
int intValue_
Integer parameter - current value.
Definition: CbcParam.hpp:313
int matches(std::string input) const
Returns 1 if matches minimum, 2 if matches less, 0 if not matched.
std::string currentOption() const
Returns current parameter option.
Definition: CbcParam.hpp:225
std::string matchName() const
Returns name which could match.
std::string shortHelp() const
Returns short help.
Definition: CbcParam.hpp:189
void printOptions() const
Prints parameter options.
CbcParam()
Constructors.
bool display_
Display on ?
Definition: CbcParam.hpp:311
Very simple class for setting parameters.
Definition: CbcParam.hpp:152
int parameterOption(std::string check) const
Returns parameter option which matches (-1 if none)
void setIntValue(int value)
Sets int value.
Definition: CbcParam.hpp:233
Simple Branch and bound class.
Definition: CbcModel.hpp:98
int setIntParameter(CbcModel &model, int value) const
Sets a int parameter (nonzero code if error)
void addHelp(std::string keyWord)
Adds one help line.