Cbc  2.9.9
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CbcOrClpParam.hpp
Go to the documentation of this file.
1 
2 /* $Id: CbcOrClpParam.hpp 2175 2015-10-06 08:56:43Z forrest $ */
3 // Copyright (C) 2002, International Business Machines
4 // Corporation and others. All Rights Reserved.
5 // This code is licensed under the terms of the Eclipse Public License (EPL).
6 
7 #ifdef USE_CBCCONFIG
8 # include "CbcConfig.h"
9 #else
10 # include "ClpConfig.h"
11 #endif
12 
13 #ifndef CbcOrClpParam_H
14 #define CbcOrClpParam_H
15 
27 class OsiSolverInterface;
28 class CbcModel;
29 class ClpSimplex;
48 
49 {
52 
61 
69 
81 
83 #ifndef COIN_HAS_CBC
85 #endif
106 
137 #ifdef COIN_HAS_CBC
139 #endif
147 
174 
224 
275 
284 
287 
289 } ;
290 #include <vector>
291 #include <string>
292 
294 
296 public:
299  CbcOrClpParam ( );
301  CbcOrClpParam (std::string name, std::string help,
302  double lower, double upper, CbcOrClpParameterType type, int display = 2);
303  CbcOrClpParam (std::string name, std::string help,
304  int lower, int upper, CbcOrClpParameterType type, int display = 2);
305  // Other strings will be added by insert
306  CbcOrClpParam (std::string name, std::string help, std::string firstValue,
307  CbcOrClpParameterType type, int whereUsed = 7, int display = 2);
308  // Action
309  CbcOrClpParam (std::string name, std::string help,
310  CbcOrClpParameterType type, int whereUsed = 7, int display = 2);
312  CbcOrClpParam(const CbcOrClpParam &);
314  CbcOrClpParam & operator=(const CbcOrClpParam & rhs);
316  ~CbcOrClpParam ( );
318 
321  void append(std::string keyWord);
324  void addHelp(std::string keyWord);
326  inline std::string name( ) const {
327  return name_;
328  }
330  inline std::string shortHelp( ) const {
331  return shortHelp_;
332  }
334  int setDoubleParameter(CbcModel & model, double value) ;
336  const char * setDoubleParameterWithMessage ( CbcModel & model, double value , int & returnCode);
338  double doubleParameter(CbcModel & model) const;
340  int setIntParameter(CbcModel & model, int value) ;
342  const char * setIntParameterWithMessage ( CbcModel & model, int value , int & returnCode);
344  int intParameter(CbcModel & model) const;
346  int setDoubleParameter(ClpSimplex * model, double value) ;
348  double doubleParameter(ClpSimplex * model) const;
350  const char * setDoubleParameterWithMessage ( ClpSimplex * model, double value , int & returnCode);
352  int setIntParameter(ClpSimplex * model, int value) ;
354  const char * setIntParameterWithMessage ( ClpSimplex * model, int value , int & returnCode);
356  int intParameter(ClpSimplex * model) const;
358  int setDoubleParameter(OsiSolverInterface * model, double value) ;
360  const char * setDoubleParameterWithMessage ( OsiSolverInterface * model, double value , int & returnCode);
362  double doubleParameter(OsiSolverInterface * model) const;
364  int setIntParameter(OsiSolverInterface * model, int value) ;
366  const char * setIntParameterWithMessage ( OsiSolverInterface * model, int value , int & returnCode);
368  int intParameter(OsiSolverInterface * model) const;
370  int checkDoubleParameter(double value) const;
372  std::string matchName ( ) const;
374  int lengthMatchName ( ) const;
376  int parameterOption ( std::string check ) const;
378  void printOptions ( ) const;
380  inline std::string currentOption ( ) const {
382  }
384  void setCurrentOption ( int value , bool printIt = false);
386  const char * setCurrentOptionWithMessage ( int value );
388  void setCurrentOption (const std::string value );
390  const char * setCurrentOptionWithMessage (const std::string value );
392  int currentOptionAsInteger ( ) const ;
397  int currentOptionAsInteger ( int & fakeInteger ) const;
399  void setIntValue ( int value );
401  const char * setIntValueWithMessage ( int value );
402  inline int intValue () const {
403  return intValue_;
404  }
406  void setDoubleValue ( double value );
408  const char * setDoubleValueWithMessage ( double value );
409  inline double doubleValue () const {
410  return doubleValue_;
411  }
413  void setStringValue ( std::string value );
414  inline std::string stringValue () const {
415  return stringValue_;
416  }
418  int matches (std::string input) const;
420  inline CbcOrClpParameterType type() const {
421  return type_;
422  }
424  inline int displayThis() const {
425  return display_;
426  }
428  inline void setLonghelp(const std::string help) {
429  longHelp_ = help;
430  }
432  void printLongHelp() const;
434  void printString() const;
440  inline int whereUsed() const {
441  return whereUsed_;
442  }
444  inline int fakeKeyWord() const
445  { return fakeKeyWord_;}
447  inline void setFakeKeyWord(int value, int fakeValue)
448  { fakeKeyWord_ = value; fakeValue_ = fakeValue;}
450  void setFakeKeyWord(int fakeValue);
451 
452 private:
454  void gutsOfConstructor();
456 private:
458 
463  // Type see CbcOrClpParameterType
471  // Length of name
472  unsigned int lengthName_;
473  // Minimum match
474  unsigned int lengthMatch_;
476  std::vector<std::string> definedKeyWords_;
478  std::string name_;
480  std::string shortHelp_;
482  std::string longHelp_;
488  int display_;
492  double doubleValue_;
494  std::string stringValue_;
509 };
511 std::string CoinReadNextField();
512 
513 std::string CoinReadGetCommand(int argc, const char *argv[]);
514 std::string CoinReadGetString(int argc, const char *argv[]);
515 // valid 0 - okay, 1 bad, 2 not there
516 int CoinReadGetIntField(int argc, const char *argv[], int * valid);
517 double CoinReadGetDoubleField(int argc, const char *argv[], int * valid);
518 void CoinReadPrintit(const char * input);
519 void setCbcOrClpPrinting(bool yesNo);
520 #define CBCMAXPARAMETERS 250
521 /*
522  Subroutine to establish the cbc parameter array. See the description of
523  class CbcOrClpParam for details. Pulled from C..Main() for clarity.
524 */
525 void establishParams (int &numberParameters, CbcOrClpParam *const parameters);
526 // Given a parameter type - returns its number in list
528  int numberParameters, CbcOrClpParam *const parameters);
529 // Dump/restore a solution to file
530 void saveSolution(const ClpSimplex * lpSolver, std::string fileName);
531 void restoreSolution(ClpSimplex * lpSolver, std::string fileName, int mode);
532 #endif /* CbcOrClpParam_H */
int displayThis() const
whether to display
void gutsOfConstructor()
gutsOfConstructor
std::string shortHelp() const
Returns short help.
std::string CoinReadNextField()
Simple read stuff.
int lengthMatchName() const
Returns length of name for ptinting.
void setCbcOrClpPrinting(bool yesNo)
int intValue_
Integer parameter - current value.
void establishParams(int &numberParameters, CbcOrClpParam *const parameters)
double doubleValue() const
std::string CoinReadGetCommand(int argc, const char *argv[])
double doubleValue_
Double parameter - current value.
int intParameter(CbcModel &model) const
Gets a int parameter.
int whichParam(CbcOrClpParameterType name, int numberParameters, CbcOrClpParam *const parameters)
std::string stringValue() const
std::vector< std::string > definedKeyWords_
set of valid strings
std::string name() const
Returns name.
std::string CoinReadGetString(int argc, const char *argv[])
const char * setCurrentOptionWithMessage(int value)
Sets current parameter option and returns printable string.
int display_
Display on ?
Very simple class for setting parameters.
void addHelp(std::string keyWord)
Adds one help line.
void setIntValue(int value)
Sets int value.
CbcOrClpParam & operator=(const CbcOrClpParam &rhs)
Assignment operator. This copies the data.
void printIt(const char *msg)
Utility to print a long message as filled lines of text.
void setCurrentOption(int value, bool printIt=false)
Sets current parameter option.
int whereUsed() const
7 if used everywhere, 1 - used by clp 2 - used by cbc 4 - used by ampl
Abstract Base Class for describing an interface to a solver.
const char * setDoubleParameterWithMessage(CbcModel &model, double value, int &returnCode)
Sets double parameter and returns printable string and error code.
void printLongHelp() const
Print Long help.
const char * setDoubleValueWithMessage(double value)
Sets double value with message.
int whereUsed_
7 if used everywhere, 1 - used by clp 2 - used by cbc 4 - used by ampl
const char * setIntParameterWithMessage(CbcModel &model, int value, int &returnCode)
Sets int parameter and returns printable string and error code.
void setFakeKeyWord(int value, int fakeValue)
Sets value of fake keyword.
void setDoubleValue(double value)
Sets double value.
This solves LPs using the simplex method.
Definition: ClpSimplex.hpp:70
int currentKeyWord_
Current keyWord (if a keyword parameter)
void CoinReadPrintit(const char *input)
double lowerDoubleValue_
If double == okay.
void printOptions() const
Prints parameter options.
int fakeValue_
Return this as main value if an integer.
double CoinReadGetDoubleField(int argc, const char *argv[], int *valid)
int fakeKeyWord() const
Gets value of fake keyword.
unsigned int lengthMatch_
std::string shortHelp_
Short help.
std::string longHelp_
Long help.
int checkDoubleParameter(double value) const
Checks a double parameter (nonzero code if error)
void append(std::string keyWord)
Insert string (only valid for keywords)
CbcOrClpParameterType type() const
type
double upperDoubleValue_
int CoinReadGetIntField(int argc, const char *argv[], int *valid)
int intValue() const
unsigned int lengthName_
void setLonghelp(const std::string help)
Set Long help.
int fakeKeyWord_
If &gt;=0 then integers allowed as a fake keyword So minusnnnn would got to -nnnn in currentKeyword_ and...
CbcOrClpParameterType
Parameter codes.
CbcOrClpParam()
Constructors.
double doubleParameter(CbcModel &model) const
Gets a double parameter.
void restoreSolution(ClpSimplex *lpSolver, std::string fileName, int mode)
int lowerIntValue_
If int == okay.
int parameterOption(std::string check) const
Returns parameter option which matches (-1 if none)
std::string matchName() const
Returns name which could match.
~CbcOrClpParam()
Destructor.
int setDoubleParameter(CbcModel &model, double value)
Sets a double parameter (nonzero code if error)
void setStringValue(std::string value)
Sets string value.
CbcOrClpParameterType action_
Action.
std::string currentOption() const
Returns current parameter option.
std::string name_
Name.
void saveSolution(const ClpSimplex *lpSolver, std::string fileName)
int matches(std::string input) const
Returns 1 if matches minimum, 2 if matches less, 0 if not matched.
int currentOptionAsInteger() const
Returns current parameter option position.
Simple Branch and bound class.
Definition: CbcModel.hpp:101
void printString() const
Print action and string.
int setIntParameter(CbcModel &model, int value)
Sets a int parameter (nonzero code if error)
std::string stringValue_
String parameter - current value.
const char * setIntValueWithMessage(int value)
Sets int value with message.
CbcOrClpParameterType type_