Cbc  2.9.9
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CbcParam.hpp
Go to the documentation of this file.
1 /* $Id: CbcParam.hpp 1573 2011-01-05 01:12:36Z lou $ */
2 // Copyright (C) 2002, International Business Machines
3 // Corporation and others. All Rights Reserved.
4 // This code is licensed under the terms of the Eclipse Public License (EPL).
5 
6 #ifndef CbcParam_H
7 #define CbcParam_H
8 
9 #include "OsiSolverInterface.hpp"
10 #include "CbcModel.hpp"
11 class ClpSimplex;
36 
39 
48 
53 
57 
73 
94 
110 
143 
146 
148 };
149 
150 
152 
153 class CbcParam {
154 
155 public:
156 
159  CbcParam ( );
161  CbcParam (std::string name, std::string help,
162  double lower, double upper, CbcParameterType type, bool display = true);
163  CbcParam (std::string name, std::string help,
164  int lower, int upper, CbcParameterType type, bool display = true);
165  // Other strings will be added by insert
166  CbcParam (std::string name, std::string help, std::string firstValue,
167  CbcParameterType type, int defaultIndex = 0, bool display = true);
168  // Action
169  CbcParam (std::string name, std::string help,
170  CbcParameterType type, int indexNumber = -1, bool display = true);
172  CbcParam(const CbcParam &);
174  CbcParam & operator=(const CbcParam & rhs);
176  ~CbcParam ( );
178 
181  void append(std::string keyWord);
184  void addHelp(std::string keyWord);
186  inline std::string name( ) const {
187  return name_;
188  };
190  inline std::string shortHelp( ) const {
191  return shortHelp_;
192  };
194  int setDoubleParameter(CbcModel & model, double value) const;
196  double doubleParameter(CbcModel & model) const;
198  int setIntParameter(CbcModel & model, int value) const;
200  int intParameter(CbcModel & model) const;
202  int setDoubleParameter(ClpSimplex * model, double value) const;
204  double doubleParameter(ClpSimplex * model) const;
206  int setIntParameter(ClpSimplex * model, int value) const;
208  int intParameter(ClpSimplex * model) const;
210  int setDoubleParameter(OsiSolverInterface * model, double value) const;
212  double doubleParameter(OsiSolverInterface * model) const;
214  int setIntParameter(OsiSolverInterface * model, int value) const;
216  int intParameter(OsiSolverInterface * model) const;
218  int checkDoubleParameter(double value) const;
220  std::string matchName ( ) const;
222  int parameterOption ( std::string check ) const;
224  void printOptions ( ) const;
226  inline std::string currentOption ( ) const {
228  }
230  inline void setCurrentOption ( int value ) {
231  currentKeyWord_ = value;
232  }
234  inline void setIntValue ( int value ) {
235  intValue_ = value;
236  }
237  inline int intValue () const {
238  return intValue_;
239  }
241  inline void setDoubleValue ( double value ) {
242  doubleValue_ = value;
243  }
244  inline double doubleValue () const {
245  return doubleValue_;
246  }
248  inline void setStringValue ( std::string value ) {
249  stringValue_ = value;
250  }
251  inline std::string stringValue () const {
252  return stringValue_;
253  }
255  int matches (std::string input) const;
257  inline CbcParameterType type() const {
258  return type_;
259  }
261  inline bool displayThis() const {
262  return display_;
263  }
265  inline void setLonghelp(const std::string help) {
266  longHelp_ = help;
267  }
269  void printLongHelp() const;
271  void printString() const;
273  inline int indexNumber() const {
274  return indexNumber_;
275  }
276 private:
278  void gutsOfConstructor();
280 private:
282 
287  // Type see CbcParameterType
295  // Length of name
296  unsigned int lengthName_;
297  // Minimum match
298  unsigned int lengthMatch_;
300  std::vector<std::string> definedKeyWords_;
302  std::string name_;
304  std::string shortHelp_;
306  std::string longHelp_;
312  bool display_;
316  double doubleValue_;
318  std::string stringValue_;
322 };
323 #endif /* CbcParam_H */
324 
std::string shortHelp() const
Returns short help.
Definition: CbcParam.hpp:190
std::string stringValue() const
Definition: CbcParam.hpp:251
std::string matchName() const
Returns name which could match.
void setStringValue(std::string value)
Sets string value.
Definition: CbcParam.hpp:248
double doubleValue_
Double parameter - current value.
Definition: CbcParam.hpp:316
CbcParameterType type_
Definition: CbcParam.hpp:288
~CbcParam()
Destructor.
int parameterOption(std::string check) const
Returns parameter option which matches (-1 if none)
void setLonghelp(const std::string help)
Set Long help.
Definition: CbcParam.hpp:265
int matches(std::string input) const
Returns 1 if matches minimum, 2 if matches less, 0 if not matched.
bool display_
Display on ?
Definition: CbcParam.hpp:312
void append(std::string keyWord)
Insert string (only valid for keywords)
CbcParam & operator=(const CbcParam &rhs)
Assignment operator. This copies the data.
CbcParameterType type() const
type
Definition: CbcParam.hpp:257
std::string longHelp_
Long help.
Definition: CbcParam.hpp:306
Abstract Base Class for describing an interface to a solver.
CbcParam()
Constructors.
void printOptions() const
Prints parameter options.
int currentKeyWord_
Current keyWord (if a keyword parameter)
Definition: CbcParam.hpp:310
void setIntValue(int value)
Sets int value.
Definition: CbcParam.hpp:234
std::string name() const
Returns name.
Definition: CbcParam.hpp:186
int setIntParameter(CbcModel &model, int value) const
Sets a int parameter (nonzero code if error)
double lowerDoubleValue_
If double == okay.
Definition: CbcParam.hpp:290
This solves LPs using the simplex method.
Definition: ClpSimplex.hpp:70
CbcParameterType
Parameter codes.
Definition: CbcParam.hpp:35
std::string stringValue_
String parameter - current value.
Definition: CbcParam.hpp:318
int intValue_
Integer parameter - current value.
Definition: CbcParam.hpp:314
void addHelp(std::string keyWord)
Adds one help line.
unsigned int lengthName_
Definition: CbcParam.hpp:296
int intParameter(CbcModel &model) const
Gets a int parameter.
double doubleParameter(CbcModel &model) const
Gets a double parameter.
Very simple class for setting parameters.
Definition: CbcParam.hpp:153
int intValue() const
Definition: CbcParam.hpp:237
std::string name_
Name.
Definition: CbcParam.hpp:302
CbcParameterType action_
Action.
Definition: CbcParam.hpp:308
std::string shortHelp_
Short help.
Definition: CbcParam.hpp:304
int upperIntValue_
Definition: CbcParam.hpp:294
void printString() const
Print action and string.
std::vector< std::string > definedKeyWords_
set of valid strings
Definition: CbcParam.hpp:300
int lowerIntValue_
If int == okay.
Definition: CbcParam.hpp:293
double upperDoubleValue_
Definition: CbcParam.hpp:291
std::string currentOption() const
Returns current parameter option.
Definition: CbcParam.hpp:226
double doubleValue() const
Definition: CbcParam.hpp:244
int indexNumber() const
type for classification
Definition: CbcParam.hpp:273
int indexNumber_
index number to use for display purposes
Definition: CbcParam.hpp:320
void printLongHelp() const
Print Long help.
void gutsOfConstructor()
gutsOfConstructor
Simple Branch and bound class.
Definition: CbcModel.hpp:101
int checkDoubleParameter(double value) const
Checks a double parameter (nonzero code if error)
void setDoubleValue(double value)
Sets double value.
Definition: CbcParam.hpp:241
unsigned int lengthMatch_
Definition: CbcParam.hpp:298
void setCurrentOption(int value)
Sets current parameter option.
Definition: CbcParam.hpp:230
bool displayThis() const
whether to display
Definition: CbcParam.hpp:261
int setDoubleParameter(CbcModel &model, double value) const
Sets a double parameter (nonzero code if error)