Clp 1.16.9
Loading...
Searching...
No Matches
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
28class CbcModel;
29class 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
296public:
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);
318
322 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);
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 {
381 return definedKeyWords_[currentKeyWord_];
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 );
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;
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
452private:
454 void gutsOfConstructor();
456
457private:
458
463 // Type see CbcOrClpParameterType
466 double lowerDoubleValue_;
467 double upperDoubleValue_;
469 int lowerIntValue_;
470 int upperIntValue_;
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_;
484 CbcOrClpParameterType action_;
486 int currentKeyWord_;
488 int display_;
490 int intValue_;
492 double doubleValue_;
494 std::string stringValue_;
500 int whereUsed_;
505 int fakeKeyWord_;
507 int fakeValue_;
509};
511std::string CoinReadNextField();
512
513std::string CoinReadGetCommand(int argc, const char *argv[]);
514std::string CoinReadGetString(int argc, const char *argv[]);
515// valid 0 - okay, 1 bad, 2 not there
516int CoinReadGetIntField(int argc, const char *argv[], int * valid);
517double CoinReadGetDoubleField(int argc, const char *argv[], int * valid);
518void CoinReadPrintit(const char * input);
519void 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*/
525void 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
530void saveSolution(const ClpSimplex * lpSolver, std::string fileName);
531void restoreSolution(ClpSimplex * lpSolver, std::string fileName, int mode);
532#endif /* CbcOrClpParam_H */
void setCbcOrClpPrinting(bool yesNo)
std::string CoinReadGetString(int argc, const char *argv[])
void restoreSolution(ClpSimplex *lpSolver, std::string fileName, int mode)
std::string CoinReadNextField()
Simple read stuff.
void saveSolution(const ClpSimplex *lpSolver, std::string fileName)
void CoinReadPrintit(const char *input)
int whichParam(CbcOrClpParameterType name, int numberParameters, CbcOrClpParam *const parameters)
void establishParams(int &numberParameters, CbcOrClpParam *const parameters)
double CoinReadGetDoubleField(int argc, const char *argv[], int *valid)
CbcOrClpParameterType
Parameter codes.
@ CBC_PARAM_NOTUSED_CBCSTUFF
@ CBC_PARAM_STR_PREPROCESS
@ CLP_PARAM_STR_CROSSOVER
@ CBC_PARAM_STR_RANDROUND
@ CLP_PARAM_INT_DUALIZE
@ CLP_PARAM_INT_SUBSTITUTION
@ CLP_PARAM_ACTION_PRIMALSIMPLEX
@ CLP_PARAM_ACTION_DUALSIMPLEX
@ CBC_PARAM_ACTION_MIPLIB
@ CLP_PARAM_DBL_OBJSCALE
@ CLP_PARAM_ACTION_NEXTBESTSOLUTION
@ CLP_PARAM_INT_VERBOSE
@ CLP_PARAM_STR_CHOLESKY
@ CBC_PARAM_NOTUSED_INVALID
@ CBC_PARAM_STR_DW
@ CBC_PARAM_INT_EXTRA4
@ CLP_PARAM_DBL_TIMELIMIT
@ CLP_PARAM_INT_LOGLEVEL
@ CBC_PARAM_INT_STRONG_STRATEGY
@ CLP_PARAM_ACTION_NETWORK
@ CLP_PARAM_STR_PFI
@ CLP_PARAM_ACTION_DIRECTORY
@ CBC_PARAM_ACTION_DIRMIPLIB
@ CBC_PARAM_DBL_INFEASIBILITYWEIGHT
@ CLP_PARAM_STR_BUFFER_MODE
@ CLP_PARAM_STR_DUALPIVOT
@ CLP_PARAM_STR_MESSAGES
@ CBC_PARAM_STR_COSTSTRATEGY
@ CBC_PARAM_STR_COMBINE
@ CBC_PARAM_INT_MULTIPLEROOTS
@ CLP_PARAM_INT_MORESPECIALOPTIONS
@ CBC_PARAM_INT_STRATEGY
@ CBC_PARAM_ACTION_MIPSTART
@ CLP_PARAM_STR_SPARSEFACTOR
@ CLP_PARAM_ACTION_EITHERSIMPLEX
@ CLP_PARAM_ACTION_UNITTEST
@ CBC_PARAM_STR_PROXIMITY
@ CBC_PARAM_INT_EXTRA1
@ CLP_PARAM_INT_PRESOLVEPASS
@ CBC_PARAM_STR_NODESTRATEGY
@ CBC_PARAM_STR_LAGOMORYCUTS
@ CBC_PARAM_STR_LANDPCUTS
@ CBC_PARAM_DBL_ARTIFICIALCOST
@ CBC_PARAM_INT_EXTRA2
@ CBC_PARAM_INT_DIVEOPTSOLVES
@ CLP_PARAM_ACTION_USERCLP
@ CBC_PARAM_DBL_DJFIX
@ CBC_PARAM_STR_LATWOMIRCUTS
@ CBC_PARAM_DBL_SMALLBAB
@ CBC_PARAM_STR_PIVOTANDCOMPLEMENT
@ CBC_PARAM_STR_RESIDCUTS
@ CBC_PARAM_STR_ROUNDING
@ CLP_PARAM_DBL_RHSSCALE
@ CLP_PARAM_STR_DIRECTION
@ CBC_PARAM_STR_CLIQUECUTS
@ CLP_PARAM_INT_MAXFACTOR
@ CLP_PARAM_STR_KEEPNAMES
@ CLP_PARAM_ACTION_NETLIB_TUNE
@ CBC_PARAM_INT_CUTLENGTH
@ CBC_PARAM_INT_MOREMIPOPTIONS
@ CBC_PARAM_STR_MIXEDCUTS
@ CLP_PARAM_ACTION_PARAMETRICS
@ CLP_PARAM_DBL_ZEROTOLERANCE
@ CBC_PARAM_ACTION_USERCBC
@ CBC_PARAM_STR_VND
@ CBC_PARAM_DBL_TIMELIMIT_BAB
@ CBC_PARAM_STR_DINS
@ CLP_PARAM_ACTION_STOREDFILE
@ CLP_PARAM_ACTION_ALLSLACK
@ CLP_PARAM_INT_PROCESSTUNE
@ CBC_PARAM_STR_CPX
@ CLP_PARAM_STR_CRASH
@ CLP_PARAM_ACTION_CSVSTATISTICS
@ CLP_PARAM_ACTION_PRINTMASK
@ CLP_PARAM_ACTION_DIRNETLIB
@ CBC_PARAM_STR_RINS
@ CLP_PARAM_ACTION_HELP
@ CLP_PARAM_ACTION_EXPORT
@ CBC_PARAM_STR_GMICUTS
@ CLP_PARAM_INT_RANDOMSEED
@ CLP_PARAM_INT_PRESOLVEOPTIONS
@ CBC_PARAM_STR_BRANCHSTRATEGY
@ CBC_PARAM_INT_EXTRA3
@ CBC_PARAM_DBL_INCREMENT
@ CBC_PARAM_DBL_ALLOWABLEGAP
@ CLP_PARAM_ACTION_NETLIB_PRIMAL
@ CBC_PARAM_INT_NUMBERANALYZE
@ CLP_PARAM_ACTION_PLUSMINUS
@ CLP_PARAM_DBL_PRIMALWEIGHT
@ CBC_PARAM_DBL_TIGHTENFACTOR
@ CBC_PARAM_INT_HOPTIONS
@ CLP_PARAM_INT_IDIOT
@ CBC_PARAM_INT_THREADS
@ CBC_PARAM_STR_DIVINGV
@ CLP_PARAM_ACTION_CLEARCUTS
@ CLP_PARAM_ACTION_IMPORT
@ CLP_PARAM_INT_SPECIALOPTIONS
@ CBC_PARAM_ACTION_BAB
@ CLP_PARAM_INT_SLPVALUE
@ CBC_PARAM_DBL_DEXTRA4
@ CBC_PARAM_STR_DIVINGG
@ CBC_PARAM_INT_MAXNODES
@ CLP_PARAM_STR_PERTURBATION
@ CLP_PARAM_INT_PRINTOPTIONS
@ CBC_PARAM_INT_TESTOSI
@ CLP_PARAM_INT_OUTPUTFORMAT
@ CBC_PARAM_STR_SOS
@ CLP_PARAM_ACTION_STDIN
@ CLP_PARAM_ACTION_BASISOUT
@ CBC_PARAM_ACTION_STRENGTHEN
@ CLP_PARAM_STR_ALLCOMMANDS
@ CBC_PARAM_INT_NUMBERBEFORE
@ CBC_PARAM_STR_DIVINGC
@ CLP_PARAM_ACTION_RESTORESOL
@ CLP_PARAM_INT_USESOLUTION
@ CBC_PARAM_INT_FPUMPTUNE
@ CLP_PARAM_ACTION_DUMMY
@ CLP_PARAM_DBL_PRIMALTOLERANCE
@ CBC_PARAM_DBL_DEXTRA3
@ CBC_PARAM_STR_HEURISTICSTRATEGY
@ CBC_PARAM_STR_DIVINGS
@ CLP_PARAM_ACTION_NETLIB_BARRIER
@ CBC_PARAM_INT_EXTRA_VARIABLES
@ CLP_PARAM_INT_MAXITERATION
@ CLP_PARAM_DBL_OBJSCALE2
@ CBC_PARAM_INT_MOREMOREMIPOPTIONS
@ CBC_PARAM_STR_LOCALTREE
@ CLP_PARAM_DBL_DUALTOLERANCE
@ CLP_PARAM_ACTION_TIGHTEN
@ CLP_PARAM_ACTION_MINIMIZE
@ CBC_PARAM_INT_MIPOPTIONS
@ CBC_PARAM_INT_MAX_SLOW_CUTS
@ CBC_PARAM_ACTION_DOHEURISTIC
@ CBC_PARAM_INT_VUBTRY
@ CBC_PARAM_STR_TWOMIRCUTS
@ CBC_PARAM_STR_GREEDY
@ CBC_PARAM_INT_MAXHOTITS
@ CLP_PARAM_STR_FACTORIZATION
@ CLP_PARAM_ACTION_DEBUG
@ CLP_PARAM_ACTION_REALLY_SCALE
@ CBC_PARAM_STR_ORBITAL
@ CLP_PARAM_ACTION_SAVESOL
@ CLP_PARAM_ACTION_FAKEBOUND
@ CBC_PARAM_INT_CUTPASS
@ CBC_PARAM_INT_MAXSAVEDSOLS
@ CLP_PARAM_ACTION_MAXIMIZE
@ CLP_PARAM_STR_PRIMALPIVOT
@ CBC_PARAM_GENERALQUERY
@ CBC_PARAM_INT_FPUMPITS
@ CBC_PARAM_DBL_GAPRATIO
@ CLP_PARAM_STR_ABCWANTED
@ CLP_PARAM_STR_TIME_MODE
@ CBC_PARAM_STR_RENS
@ CBC_PARAM_STR_CUTSSTRATEGY
@ CBC_PARAM_STR_KNAPSACKCUTS
@ CBC_PARAM_INT_DEPTHMINIBAB
@ CLP_PARAM_INT_CPP
@ CLP_PARAM_STR_PRESOLVE
@ CBC_PARAM_STR_ZEROHALFCUTS
@ CBC_PARAM_STR_SOLVER
@ CBC_PARAM_STR_GOMORYCUTS
@ CBC_PARAM_STR_PIVOTANDFIX
@ CBC_PARAM_STR_PROBINGCUTS
@ CBC_PARAM_STR_CUTOFF_CONSTRAINT
@ CLP_PARAM_ACTION_SOLUTION
@ CBC_PARAM_INT_EXPERIMENT
@ CBC_PARAM_FULLGENERALQUERY
@ CLP_PARAM_ACTION_VERSION
@ CLP_PARAM_STR_GAMMA
@ CLP_PARAM_STR_ERRORSALLOWED
@ CLP_PARAM_ACTION_NETLIB_EITHER
@ CLP_PARAM_ACTION_OUTDUPROWS
@ CLP_PARAM_ACTION_STATISTICS
@ CLP_PARAM_STR_VECTOR
@ CLP_PARAM_ACTION_EXIT
@ CBC_PARAM_STR_FPUMP
@ CLP_PARAM_ACTION_BASISIN
@ CBC_PARAM_ACTION_PRIORITYIN
@ CBC_PARAM_STR_FLOWCUTS
@ CBC_PARAM_INT_MAXSOLS
@ CBC_PARAM_INT_FPUMPTUNE2
@ CBC_PARAM_STR_REDSPLIT2CUTS
@ CLP_PARAM_STR_BARRIERSCALE
@ CLP_PARAM_DBL_DUALBOUND
@ CLP_PARAM_ACTION_REVERSE
@ CBC_PARAM_STR_REDSPLITCUTS
@ CLP_PARAM_INT_SOLVERLOGLEVEL
@ CBC_PARAM_INT_CUTDEPTH
@ CLP_PARAM_ACTION_RESTORE
@ CLP_PARAM_STR_AUTOSCALE
@ CBC_PARAM_STR_NAIVE
@ CBC_PARAM_DBL_FAKECUTOFF
@ CBC_PARAM_DBL_FAKEINCREMENT
@ CLP_PARAM_ACTION_SOLVECONTINUOUS
@ CLP_PARAM_ACTION_ENVIRONMENT
@ CLP_PARAM_ACTION_SAVE
@ CLP_PARAM_STR_BIASLU
@ CBC_PARAM_INT_DENSE
@ CBC_PARAM_DBL_INTEGERTOLERANCE
@ CLP_PARAM_INT_DECOMPOSE_BLOCKS
@ CBC_PARAM_INT_SMALLFACT
@ CLP_PARAM_ACTION_BARRIER
@ CBC_PARAM_NOTUSED_OSLSTUFF
@ CLP_PARAM_STR_INTPRINT
@ CLP_PARAM_ACTION_NETLIB_DUAL
@ CBC_PARAM_INT_RANDOMSEED
@ CLP_PARAM_INT_SPRINT
@ CBC_PARAM_STR_DIVINGF
@ CBC_PARAM_INT_CUTPASSINTREE
@ CLP_PARAM_ACTION_DIRSAMPLE
@ CBC_PARAM_INT_STRONGBRANCHING
@ CLP_PARAM_STR_KKT
@ CLP_PARAM_DBL_PRESOLVETOLERANCE
@ CBC_PARAM_INT_DIVEOPT
@ CBC_PARAM_STR_DIVINGL
@ CBC_PARAM_STR_DIVINGP
@ CBC_PARAM_DBL_CUTOFF
@ CLP_PARAM_ACTION_GMPL_SOLUTION
@ CLP_PARAM_STR_SCALING
@ CBC_PARAM_STR_CROSSOVER2
@ CBC_PARAM_DBL_DEXTRA5
@ CLP_PARAM_ACTION_MODELIN
@ CLP_PARAM_INT_PERTVALUE
std::string CoinReadGetCommand(int argc, const char *argv[])
int CoinReadGetIntField(int argc, const char *argv[], int *valid)
#define OsiSolverInterface
Definition: Idiot.hpp:14
Very simple class for setting parameters.
CbcOrClpParam()
Constructors.
const char * setDoubleValueWithMessage(double value)
Sets double value with message.
int setDoubleParameter(CbcModel &model, double value)
Sets a double parameter (nonzero code if error)
int whereUsed() const
7 if used everywhere, 1 - used by clp 2 - used by cbc 4 - used by ampl
void setStringValue(std::string value)
Sets string value.
void printLongHelp() const
Print Long help.
std::string currentOption() const
Returns current parameter option.
void setDoubleValue(double value)
Sets double value.
void setCurrentOption(int value, bool printIt=false)
Sets current parameter option.
void setCurrentOption(const std::string value)
Sets current parameter option using string.
void setLonghelp(const std::string help)
Set Long help.
std::string matchName() const
Returns name which could match.
const char * setDoubleParameterWithMessage(ClpSimplex *model, double value, int &returnCode)
Sets double parameter and returns printable string and error code.
CbcOrClpParam(std::string name, std::string help, double lower, double upper, CbcOrClpParameterType type, int display=2)
void printOptions() const
Prints parameter options.
int currentOptionAsInteger() const
Returns current parameter option position.
double doubleParameter(ClpSimplex *model) const
Gets a double parameter.
const char * setIntParameterWithMessage(CbcModel &model, int value, int &returnCode)
Sets int parameter and returns printable string and error code.
int setDoubleParameter(ClpSimplex *model, double value)
Sets a double parameter (nonzero code if error)
const char * setIntParameterWithMessage(ClpSimplex *model, int value, int &returnCode)
Sets int parameter and returns printable string and error code.
void setIntValue(int value)
Sets int value.
void append(std::string keyWord)
Insert string (only valid for keywords)
const char * setDoubleParameterWithMessage(CbcModel &model, double value, int &returnCode)
Sets double parameter and returns printable string and error code.
int displayThis() const
whether to display
int lengthMatchName() const
Returns length of name for ptinting.
int setIntParameter(OsiSolverInterface *model, int value)
Sets a int parameter (nonzero code if error)
double doubleValue() const
int intParameter(CbcModel &model) const
Gets a int parameter.
void printString() const
Print action and string.
void addHelp(std::string keyWord)
Adds one help line.
const char * setIntValueWithMessage(int value)
Sets int value with message.
std::string name() const
Returns name.
int intParameter(ClpSimplex *model) const
Gets a int parameter.
int intParameter(OsiSolverInterface *model) const
Gets a int parameter.
std::string shortHelp() const
Returns short help.
const char * setCurrentOptionWithMessage(const std::string value)
Sets current parameter option using string with message.
const char * setCurrentOptionWithMessage(int value)
Sets current parameter option and returns printable string.
double doubleParameter(OsiSolverInterface *model) const
Gets a double parameter.
void setFakeKeyWord(int fakeValue)
Sets value of fake keyword to current size of keywords.
CbcOrClpParam(std::string name, std::string help, CbcOrClpParameterType type, int whereUsed=7, int display=2)
int setDoubleParameter(OsiSolverInterface *model, double value)
Sets a double parameter (nonzero code if error)
int parameterOption(std::string check) const
Returns parameter option which matches (-1 if none)
CbcOrClpParam & operator=(const CbcOrClpParam &rhs)
Assignment operator. This copies the data.
CbcOrClpParam(const CbcOrClpParam &)
Copy constructor.
CbcOrClpParam(std::string name, std::string help, std::string firstValue, CbcOrClpParameterType type, int whereUsed=7, int display=2)
CbcOrClpParam(std::string name, std::string help, int lower, int upper, CbcOrClpParameterType type, int display=2)
const char * setIntParameterWithMessage(OsiSolverInterface *model, int value, int &returnCode)
Sets int parameter and returns printable string and error code.
int currentOptionAsInteger(int &fakeInteger) const
Returns current parameter option position but if fake keyword returns a fake value and sets fakeInteg...
void setFakeKeyWord(int value, int fakeValue)
Sets value of fake keyword.
std::string stringValue() const
int checkDoubleParameter(double value) const
Checks a double parameter (nonzero code if error)
int matches(std::string input) const
Returns 1 if matches minimum, 2 if matches less, 0 if not matched.
int intValue() const
int setIntParameter(CbcModel &model, int value)
Sets a int parameter (nonzero code if error)
~CbcOrClpParam()
Destructor.
double doubleParameter(CbcModel &model) const
Gets a double parameter.
int fakeKeyWord() const
Gets value of fake keyword.
int setIntParameter(ClpSimplex *model, int value)
Sets a int parameter (nonzero code if error)
const char * setDoubleParameterWithMessage(OsiSolverInterface *model, double value, int &returnCode)
Sets double parameter and returns printable string and error code.
CbcOrClpParameterType type() const
type
This solves LPs using the simplex method.
Definition: ClpSimplex.hpp:70