This allows the use of the standalone solver in a flexible manner. More...
#include <CbcSolver.hpp>
Public Member Functions | |
Solve method | |
int | solve (int argc, const char *argv[], int returnMode) |
This takes a list of commands, does "stuff" and returns returnMode - 0 model and solver untouched - babModel updated 1 model updated - just with solution basis etc 2 model updated i.e. | |
int | solve (const char *input, int returnMode) |
This takes a list of commands, does "stuff" and returns returnMode - 0 model and solver untouched - babModel updated 1 model updated - just with solution basis etc 2 model updated i.e. | |
int | solve (int argc, const char *argv[], int returnMode) |
This takes a list of commands, does "stuff" and returns returnMode - 0 model and solver untouched - babModel updated 1 model updated - just with solution basis etc 2 model updated i.e. | |
int | solve (const char *input, int returnMode) |
This takes a list of commands, does "stuff" and returns returnMode - 0 model and solver untouched - babModel updated 1 model updated - just with solution basis etc 2 model updated i.e. | |
Constructors and destructors etc | |
CbcSolver () | |
Default Constructor. | |
CbcSolver (const OsiClpSolverInterface &) | |
Constructor from solver. | |
CbcSolver (const CbcModel &) | |
Constructor from model. | |
CbcSolver (const CbcSolver &rhs) | |
Copy constructor . | |
CbcSolver & | operator= (const CbcSolver &rhs) |
Assignment operator. | |
~CbcSolver () | |
Destructor. | |
void | fillParameters () |
Fill with standard parameters. | |
void | fillValuesInSolver () |
Set default values in solvers from parameters. | |
void | addUserFunction (CbcUser *function) |
Add user function. | |
void | setUserCallBack (CbcStopNow *function) |
Set user call back. | |
void | addCutGenerator (CglCutGenerator *generator) |
Add cut generator. | |
CbcSolver () | |
Default Constructor. | |
CbcSolver (const OsiClpSolverInterface &) | |
Constructor from solver. | |
CbcSolver (const CbcModel &) | |
Constructor from model. | |
CbcSolver (const CbcSolver &rhs) | |
Copy constructor . | |
CbcSolver & | operator= (const CbcSolver &rhs) |
Assignment operator. | |
~CbcSolver () | |
Destructor. | |
void | fillParameters () |
Fill with standard parameters. | |
void | fillValuesInSolver () |
Set default values in solvers from parameters. | |
void | addUserFunction (CbcUser *function) |
Add user function. | |
void | setUserCallBack (CbcStopNow *function) |
Set user call back. | |
void | addCutGenerator (CglCutGenerator *generator) |
Add cut generator. | |
miscellaneous methods to line up with old | |
int * | analyze (OsiClpSolverInterface *solverMod, int &numberChanged, double &increment, bool changeInt, CoinMessageHandler *generalMessageHandler) |
1 - add heuristics to model 2 - do heuristics (and set cutoff and best solution) 3 - for miplib test so skip some (out model later) | |
void | updateModel (ClpSimplex *model2, int returnMode) |
1 - add heuristics to model 2 - do heuristics (and set cutoff and best solution) 3 - for miplib test so skip some (out model later) | |
int * | analyze (OsiClpSolverInterface *solverMod, int &numberChanged, double &increment, bool changeInt, CoinMessageHandler *generalMessageHandler) |
1 - add heuristics to model 2 - do heuristics (and set cutoff and best solution) 3 - for miplib test so skip some (out model later) | |
void | updateModel (ClpSimplex *model2, int returnMode) |
1 - add heuristics to model 2 - do heuristics (and set cutoff and best solution) 3 - for miplib test so skip some (out model later) | |
useful stuff | |
int | intValue (CbcOrClpParameterType type) const |
Get int value. | |
void | setIntValue (CbcOrClpParameterType type, int value) |
Set int value. | |
double | doubleValue (CbcOrClpParameterType type) const |
Get double value. | |
void | setDoubleValue (CbcOrClpParameterType type, double value) |
Set double value. | |
CbcUser * | userFunction (const char *name) const |
User function (NULL if no match) | |
CbcModel * | model () |
Return original Cbc model. | |
CbcModel * | babModel () |
Return updated Cbc model. | |
int | numberUserFunctions () const |
Number of userFunctions. | |
CbcUser ** | userFunctionArray () const |
User function array. | |
OsiClpSolverInterface * | originalSolver () const |
Copy of model on initial load (will contain output solutions) | |
CoinModel * | originalCoinModel () const |
Copy of model on initial load. | |
void | setOriginalSolver (OsiClpSolverInterface *originalSolver) |
Copy of model on initial load (will contain output solutions) | |
void | setOriginalCoinModel (CoinModel *originalCoinModel) |
Copy of model on initial load. | |
int | numberCutGenerators () const |
Number of cutgenerators. | |
CglCutGenerator ** | cutGeneratorArray () const |
Cut generator array. | |
double | startTime () const |
Start time. | |
void | setPrinting (bool onOff) |
Whether to print to std::cout. | |
void | setReadMode (int value) |
Where to start reading commands. | |
int | intValue (CbcOrClpParameterType type) const |
Get int value. | |
void | setIntValue (CbcOrClpParameterType type, int value) |
Set int value. | |
double | doubleValue (CbcOrClpParameterType type) const |
Get double value. | |
void | setDoubleValue (CbcOrClpParameterType type, double value) |
Set double value. | |
CbcUser * | userFunction (const char *name) const |
User function (NULL if no match) | |
CbcModel * | model () |
Return original Cbc model. | |
CbcModel * | babModel () |
Return updated Cbc model. | |
int | numberUserFunctions () const |
Number of userFunctions. | |
CbcUser ** | userFunctionArray () const |
User function array. | |
OsiClpSolverInterface * | originalSolver () const |
Copy of model on initial load (will contain output solutions) | |
CoinModel * | originalCoinModel () const |
Copy of model on initial load. | |
void | setOriginalSolver (OsiClpSolverInterface *originalSolver) |
Copy of model on initial load (will contain output solutions) | |
void | setOriginalCoinModel (CoinModel *originalCoinModel) |
Copy of model on initial load. | |
int | numberCutGenerators () const |
Number of cutgenerators. | |
CglCutGenerator ** | cutGeneratorArray () const |
Cut generator array. | |
double | startTime () const |
Start time. | |
void | setPrinting (bool onOff) |
Whether to print to std::cout. | |
void | setReadMode (int value) |
Where to start reading commands. |
Private Attributes | |
Private member data | |
CbcModel | model_ |
Reference model. | |
CbcModel * | babModel_ |
Updated model. | |
CbcUser ** | userFunction_ |
User functions. | |
int * | statusUserFunction_ |
Status of user functions 0 - not used 1 - needs cbc_load 2 - available - data in coinModel 3 - data loaded - can do cbc_save. | |
OsiClpSolverInterface * | originalSolver_ |
Copy of model on initial load (will contain output solutions) | |
CoinModel * | originalCoinModel_ |
Copy of model on initial load. | |
CglCutGenerator ** | cutGenerator_ |
Cut generators. | |
int | numberUserFunctions_ |
Number of user functions. | |
int | numberCutGenerators_ |
Number of cut generators. | |
CbcStopNow * | callBack_ |
Stop now stuff. | |
double | startTime_ |
Cpu time at instantiation. | |
CbcOrClpParam * | parameters_ |
Parameters and values. | |
int | numberParameters_ |
Number of parameters. | |
bool | doMiplib_ |
Whether to do miplib test. | |
bool | noPrinting_ |
Whether to print to std::cout. | |
int | readMode_ |
Where to start reading commands. |
This allows the use of the standalone solver in a flexible manner.
It has an original OsiClpSolverInterface and CbcModel which it can use repeatedly, e.g., to get a heuristic solution and then start again.
So I [jjf] will need a primitive scripting language which can then call solve and manipulate solution value and solution arrays.
Also provides for user callback functions. Currently two ideas in gestation, CbcUser and CbcStopNow. The latter seems limited to deciding whether or not to stop. The former seems completely general, with a notion of importing and exporting, and a `solve', which should be interpreted as `do whatever this user function does'.
Parameter initialisation is at last centralised in fillParameters().
Definition at line 55 of file CbcSolver.hpp.
CbcSolver::CbcSolver | ( | ) |
Default Constructor.
CbcSolver::CbcSolver | ( | const OsiClpSolverInterface & | ) |
Constructor from solver.
CbcSolver::CbcSolver | ( | const CbcModel & | ) |
Constructor from model.
CbcSolver::CbcSolver | ( | const CbcSolver & | rhs | ) |
Copy constructor .
CbcSolver::~CbcSolver | ( | ) |
Destructor.
CbcSolver::CbcSolver | ( | ) |
Default Constructor.
CbcSolver::CbcSolver | ( | const OsiClpSolverInterface & | ) |
Constructor from solver.
CbcSolver::CbcSolver | ( | const CbcModel & | ) |
Constructor from model.
CbcSolver::CbcSolver | ( | const CbcSolver & | rhs | ) |
Copy constructor .
CbcSolver::~CbcSolver | ( | ) |
Destructor.
int CbcSolver::solve | ( | int | argc, |
const char * | argv[], | ||
int | returnMode | ||
) |
This takes a list of commands, does "stuff" and returns returnMode - 0 model and solver untouched - babModel updated 1 model updated - just with solution basis etc 2 model updated i.e.
as babModel (babModel NULL) (only use without preprocessing)
int CbcSolver::solve | ( | const char * | input, |
int | returnMode | ||
) |
This takes a list of commands, does "stuff" and returns returnMode - 0 model and solver untouched - babModel updated 1 model updated - just with solution basis etc 2 model updated i.e.
as babModel (babModel NULL) (only use without preprocessing)
void CbcSolver::fillParameters | ( | ) |
Fill with standard parameters.
void CbcSolver::fillValuesInSolver | ( | ) |
Set default values in solvers from parameters.
Misleading. The current code actually reads default values from the underlying solvers and installs them as default values for a subset of parameters in parameters_.
void CbcSolver::addUserFunction | ( | CbcUser * | function | ) |
Add user function.
void CbcSolver::setUserCallBack | ( | CbcStopNow * | function | ) |
Set user call back.
void CbcSolver::addCutGenerator | ( | CglCutGenerator * | generator | ) |
Add cut generator.
int* CbcSolver::analyze | ( | OsiClpSolverInterface * | solverMod, |
int & | numberChanged, | ||
double & | increment, | ||
bool | changeInt, | ||
CoinMessageHandler * | generalMessageHandler | ||
) |
1 - add heuristics to model 2 - do heuristics (and set cutoff and best solution) 3 - for miplib test so skip some (out model later)
Updates model_ from babModel_ according to returnMode returnMode - 0 model and solver untouched - babModel updated 1 model updated - just with solution basis etc 2 model updated i.e. as babModel (babModel NULL) (only use without preprocessing)
void CbcSolver::updateModel | ( | ClpSimplex * | model2, |
int | returnMode | ||
) |
1 - add heuristics to model 2 - do heuristics (and set cutoff and best solution) 3 - for miplib test so skip some (out model later)
Updates model_ from babModel_ according to returnMode returnMode - 0 model and solver untouched - babModel updated 1 model updated - just with solution basis etc 2 model updated i.e. as babModel (babModel NULL) (only use without preprocessing)
int CbcSolver::intValue | ( | CbcOrClpParameterType | type | ) | const |
Get int value.
void CbcSolver::setIntValue | ( | CbcOrClpParameterType | type, |
int | value | ||
) |
Set int value.
double CbcSolver::doubleValue | ( | CbcOrClpParameterType | type | ) | const |
Get double value.
void CbcSolver::setDoubleValue | ( | CbcOrClpParameterType | type, |
double | value | ||
) |
Set double value.
CbcUser* CbcSolver::userFunction | ( | const char * | name | ) | const |
User function (NULL if no match)
|
inline |
Return original Cbc model.
Definition at line 143 of file CbcSolver.hpp.
|
inline |
Return updated Cbc model.
Definition at line 147 of file CbcSolver.hpp.
|
inline |
Number of userFunctions.
Definition at line 151 of file CbcSolver.hpp.
|
inline |
User function array.
Definition at line 155 of file CbcSolver.hpp.
|
inline |
Copy of model on initial load (will contain output solutions)
Definition at line 159 of file CbcSolver.hpp.
|
inline |
Copy of model on initial load.
Definition at line 163 of file CbcSolver.hpp.
void CbcSolver::setOriginalSolver | ( | OsiClpSolverInterface * | originalSolver | ) |
Copy of model on initial load (will contain output solutions)
void CbcSolver::setOriginalCoinModel | ( | CoinModel * | originalCoinModel | ) |
Copy of model on initial load.
|
inline |
Number of cutgenerators.
Definition at line 171 of file CbcSolver.hpp.
|
inline |
Cut generator array.
Definition at line 175 of file CbcSolver.hpp.
|
inline |
Start time.
Definition at line 179 of file CbcSolver.hpp.
|
inline |
Whether to print to std::cout.
Definition at line 183 of file CbcSolver.hpp.
|
inline |
Where to start reading commands.
Definition at line 187 of file CbcSolver.hpp.
int CbcSolver::solve | ( | int | argc, |
const char * | argv[], | ||
int | returnMode | ||
) |
This takes a list of commands, does "stuff" and returns returnMode - 0 model and solver untouched - babModel updated 1 model updated - just with solution basis etc 2 model updated i.e.
as babModel (babModel NULL) (only use without preprocessing)
int CbcSolver::solve | ( | const char * | input, |
int | returnMode | ||
) |
This takes a list of commands, does "stuff" and returns returnMode - 0 model and solver untouched - babModel updated 1 model updated - just with solution basis etc 2 model updated i.e.
as babModel (babModel NULL) (only use without preprocessing)
void CbcSolver::fillParameters | ( | ) |
Fill with standard parameters.
void CbcSolver::fillValuesInSolver | ( | ) |
Set default values in solvers from parameters.
Misleading. The current code actually reads default values from the underlying solvers and installs them as default values for a subset of parameters in parameters_.
void CbcSolver::addUserFunction | ( | CbcUser * | function | ) |
Add user function.
void CbcSolver::setUserCallBack | ( | CbcStopNow * | function | ) |
Set user call back.
void CbcSolver::addCutGenerator | ( | CglCutGenerator * | generator | ) |
Add cut generator.
int* CbcSolver::analyze | ( | OsiClpSolverInterface * | solverMod, |
int & | numberChanged, | ||
double & | increment, | ||
bool | changeInt, | ||
CoinMessageHandler * | generalMessageHandler | ||
) |
1 - add heuristics to model 2 - do heuristics (and set cutoff and best solution) 3 - for miplib test so skip some (out model later)
Updates model_ from babModel_ according to returnMode returnMode - 0 model and solver untouched - babModel updated 1 model updated - just with solution basis etc 2 model updated i.e. as babModel (babModel NULL) (only use without preprocessing)
void CbcSolver::updateModel | ( | ClpSimplex * | model2, |
int | returnMode | ||
) |
1 - add heuristics to model 2 - do heuristics (and set cutoff and best solution) 3 - for miplib test so skip some (out model later)
Updates model_ from babModel_ according to returnMode returnMode - 0 model and solver untouched - babModel updated 1 model updated - just with solution basis etc 2 model updated i.e. as babModel (babModel NULL) (only use without preprocessing)
int CbcSolver::intValue | ( | CbcOrClpParameterType | type | ) | const |
Get int value.
void CbcSolver::setIntValue | ( | CbcOrClpParameterType | type, |
int | value | ||
) |
Set int value.
double CbcSolver::doubleValue | ( | CbcOrClpParameterType | type | ) | const |
Get double value.
void CbcSolver::setDoubleValue | ( | CbcOrClpParameterType | type, |
double | value | ||
) |
Set double value.
CbcUser* CbcSolver::userFunction | ( | const char * | name | ) | const |
User function (NULL if no match)
|
inline |
Return original Cbc model.
Definition at line 143 of file CbcSolver.hpp.
|
inline |
Return updated Cbc model.
Definition at line 147 of file CbcSolver.hpp.
|
inline |
Number of userFunctions.
Definition at line 151 of file CbcSolver.hpp.
|
inline |
User function array.
Definition at line 155 of file CbcSolver.hpp.
|
inline |
Copy of model on initial load (will contain output solutions)
Definition at line 159 of file CbcSolver.hpp.
|
inline |
Copy of model on initial load.
Definition at line 163 of file CbcSolver.hpp.
void CbcSolver::setOriginalSolver | ( | OsiClpSolverInterface * | originalSolver | ) |
Copy of model on initial load (will contain output solutions)
void CbcSolver::setOriginalCoinModel | ( | CoinModel * | originalCoinModel | ) |
Copy of model on initial load.
|
inline |
Number of cutgenerators.
Definition at line 171 of file CbcSolver.hpp.
|
inline |
Cut generator array.
Definition at line 175 of file CbcSolver.hpp.
|
inline |
Start time.
Definition at line 179 of file CbcSolver.hpp.
|
inline |
Whether to print to std::cout.
Definition at line 183 of file CbcSolver.hpp.
|
inline |
Where to start reading commands.
Definition at line 187 of file CbcSolver.hpp.
|
private |
Reference model.
Definition at line 196 of file CbcSolver.hpp.
|
private |
Updated model.
Definition at line 199 of file CbcSolver.hpp.
|
private |
User functions.
Definition at line 202 of file CbcSolver.hpp.
|
private |
Status of user functions 0 - not used 1 - needs cbc_load 2 - available - data in coinModel 3 - data loaded - can do cbc_save.
Definition at line 209 of file CbcSolver.hpp.
|
private |
Copy of model on initial load (will contain output solutions)
Definition at line 211 of file CbcSolver.hpp.
|
private |
Copy of model on initial load.
Definition at line 213 of file CbcSolver.hpp.
|
private |
Cut generators.
Definition at line 215 of file CbcSolver.hpp.
|
private |
Number of user functions.
Definition at line 217 of file CbcSolver.hpp.
|
private |
Number of cut generators.
Definition at line 219 of file CbcSolver.hpp.
|
private |
Stop now stuff.
Definition at line 221 of file CbcSolver.hpp.
|
private |
Cpu time at instantiation.
Definition at line 223 of file CbcSolver.hpp.
|
private |
Parameters and values.
Definition at line 225 of file CbcSolver.hpp.
|
private |
Number of parameters.
Definition at line 227 of file CbcSolver.hpp.
|
private |
Whether to do miplib test.
Definition at line 229 of file CbcSolver.hpp.
|
private |
Whether to print to std::cout.
Definition at line 231 of file CbcSolver.hpp.
|
private |
Where to start reading commands.
Definition at line 233 of file CbcSolver.hpp.