#include <OSCoinSolver.h>
Inheritance diagram for CoinSolver:
Public Member Functions | |
CoinSolver () | |
The class constructor. | |
~CoinSolver () | |
The class destructor. | |
virtual void | solve () throw (ErrorClass) |
The implementation of the corresponding virtual function. | |
virtual void | buildSolverInstance () throw (ErrorClass) |
The implementation of the corresponding virtual function. | |
virtual void | setSolverOptions () throw (ErrorClass) |
The implementation of the corresponding virtual function. | |
bool | setCoinPackedMatrix () |
Create a CoinPackedMatrix. | |
std::string | getCoinSolverType (std::string osol_) |
void | dataEchoCheck () |
Print out problem parameters. | |
void | writeResult (OsiSolverInterface *solver) |
void | writeResult (CbcModel *model) |
Public Attributes | |
OsiSolverInterface * | osiSolver |
osiSolver is the osi solver object -- in this case clp, glpk, cbc, cplex, symphony or dylp | |
OSiLReader * | m_osilreader |
m_osilreader is an OSiLReader object used to create an osinstance from an osil string if needed | |
OSoLReader * | m_osolreader |
m_osolreader is an OSoLReader object used to create an osoption from an osol string if needed | |
Private Attributes | |
CoinPackedMatrix * | m_CoinPackedMatrix |
m_CoinPackedMatrix is a Coin Packed Matrix ojbect | |
OSrLWriter * | osrlwriter |
osrlwriter object used to write osrl from an OSResult object | |
const char ** | cbc_argv |
when Cbc is the solver, these are the arguments sent to Cbc Solve | |
int | num_cbc_argv |
the number of arguments in the argument list to the Cbc Solver | |
double | cpuTime |
This class implements a solve method for the Coin solvers It reads an OSInstance object and puts into the Coin OSI format
Definition at line 37 of file OSCoinSolver.h.
CoinSolver::CoinSolver | ( | ) |
CoinSolver::~CoinSolver | ( | ) |
The class destructor.
Definition at line 92 of file OSCoinSolver.cpp.
References cbc_argv, m_CoinPackedMatrix, m_osilreader, m_osolreader, num_cbc_argv, osiSolver, DefaultSolver::osresult, and osrlwriter.
void CoinSolver::solve | ( | ) | throw (ErrorClass) [virtual] |
The implementation of the corresponding virtual function.
Implements DefaultSolver.
Definition at line 698 of file OSCoinSolver.cpp.
References buildSolverInstance(), cbc_argv, cpuTime, e, ErrorClass::errormsg, OSInstance::getConstraintNumber(), OSInstance::getInstanceName(), OSInstance::getNumberOfBinaryVariables(), OSInstance::getNumberOfIntegerVariables(), OSInstance::getVariableNumber(), num_cbc_argv, DefaultSolver::osinstance, osiSolver, DefaultSolver::osresult, DefaultSolver::osrl, osrlwriter, OSResult::setConstraintNumber(), OSResult::setGeneralMessage(), OSResult::setGeneralStatusType(), OSResult::setInstanceName(), OSResult::setObjectiveNumber(), OSResult::setSolutionNumber(), OSResult::setSolverInvoked(), setSolverOptions(), OSResult::setVariableNumber(), DefaultSolver::sSolverName, OSrLWriter::writeOSrL(), and writeResult().
Referenced by OSBearcatSolverXkij::getInitialRestrictedMaster(), OSBearcatSolverXij::getRouteDistance(), main(), OSDipBlockCoinSolver::solve(), and OSColGenApp::solveRestrictedMasterRelaxation().
void CoinSolver::buildSolverInstance | ( | ) | throw (ErrorClass) [virtual] |
The implementation of the corresponding virtual function.
Implements DefaultSolver.
Definition at line 125 of file OSCoinSolver.cpp.
References DefaultSolver::bCallbuildSolverInstance, ErrorClass::errormsg, OSInstance::getConstraintLowerBounds(), OSInstance::getConstraintUpperBounds(), OSInstance::getDenseObjectiveCoefficients(), OSInstance::getLinearConstraintCoefficientNumber(), OSInstance::getNumberOfBinaryVariables(), OSInstance::getNumberOfIntegerVariables(), OSInstance::getNumberOfNonlinearExpressions(), OSInstance::getNumberOfQuadraticTerms(), OSInstance::getNumberOfSemiContinuousVariables(), OSInstance::getNumberOfSemiIntegerVariables(), OSInstance::getNumberOfStringVariables(), OSInstance::getObjectiveMaxOrMins(), OSInstance::getObjectiveNumber(), OSInstance::getVariableLowerBounds(), OSInstance::getVariableNumber(), OSInstance::getVariableTypes(), OSInstance::getVariableUpperBounds(), k, m_CoinPackedMatrix, m_osilreader, DefaultSolver::osil, DefaultSolver::osinstance, osiSolver, DefaultSolver::osresult, DefaultSolver::osrl, osrlwriter, OSiLReader::readOSiL(), setCoinPackedMatrix(), OSResult::setGeneralMessage(), OSResult::setGeneralStatusType(), DefaultSolver::sSolverName, and OSrLWriter::writeOSrL().
Referenced by OSBearcatSolverXkij::getInitialRestrictedMaster(), main(), OSDipBlockCoinSolver::OSDipBlockCoinSolver(), OSColGenApp::resetMaster(), solve(), and OSColGenApp::solve().
void CoinSolver::setSolverOptions | ( | ) | throw (ErrorClass) [virtual] |
The implementation of the corresponding virtual function.
Implements DefaultSolver.
Definition at line 270 of file OSCoinSolver.cpp.
References DefaultSolver::bSetSolverOptions, cbc_argv, DEBUG, OSOption::getInitVarValuesSparse(), OSOption::getNumberOfInitVarValues(), OSOption::getNumberOfSolverOptions(), OSInstance::getObjectiveConstants(), OSOption::getSolverOptions(), OSInstance::getVariableNumber(), OSInstance::instanceData, k, Variable::lb, m, m_osolreader, n, num_cbc_argv, os_strtod(), OSDBL_MAX, DefaultSolver::osinstance, osiSolver, DefaultSolver::osol, DefaultSolver::osoption, OSoLReader::readOSoL(), DefaultSolver::sSolverName, Variable::ub, InitVarValue::value, Variables::var, and InstanceData::variables.
Referenced by solve().
bool CoinSolver::setCoinPackedMatrix | ( | ) |
Create a CoinPackedMatrix.
Definition at line 651 of file OSCoinSolver.cpp.
References ErrorClass::errormsg, OSInstance::getConstraintNumber(), OSInstance::getLinearConstraintCoefficientMajor(), OSInstance::getLinearConstraintCoefficientNumber(), OSInstance::getLinearConstraintCoefficientsInColumnMajor(), OSInstance::getLinearConstraintCoefficientsInRowMajor(), OSInstance::getVariableNumber(), SparseMatrix::indexes, m_CoinPackedMatrix, DefaultSolver::osinstance, DefaultSolver::osresult, DefaultSolver::osrl, osrlwriter, OSResult::setGeneralMessage(), OSResult::setGeneralStatusType(), SparseMatrix::starts, SparseMatrix::values, and OSrLWriter::writeOSrL().
Referenced by buildSolverInstance().
std::string CoinSolver::getCoinSolverType | ( | std::string | osol_ | ) |
Definition at line 908 of file OSCoinSolver.cpp.
References ErrorClass::errormsg, DefaultSolver::osresult, DefaultSolver::osrl, osrlwriter, OSResult::setGeneralMessage(), OSResult::setGeneralStatusType(), and OSrLWriter::writeOSrL().
void CoinSolver::dataEchoCheck | ( | ) |
Print out problem parameters.
Definition at line 949 of file OSCoinSolver.cpp.
References OSInstance::getConstraintLowerBounds(), OSInstance::getConstraintNames(), OSInstance::getConstraintNumber(), OSInstance::getConstraintUpperBounds(), OSInstance::getDenseObjectiveCoefficients(), OSInstance::getInstanceDescription(), OSInstance::getInstanceName(), OSInstance::getInstanceSource(), OSInstance::getObjectiveMaxOrMins(), OSInstance::getVariableLowerBounds(), OSInstance::getVariableNames(), OSInstance::getVariableNumber(), OSInstance::getVariableTypes(), OSInstance::getVariableUpperBounds(), OSInstance::instanceData, m_CoinPackedMatrix, Objectives::numberOfObjectives, Objectives::obj, InstanceData::objectives, and DefaultSolver::osinstance.
void CoinSolver::writeResult | ( | OsiSolverInterface * | solver | ) |
Definition at line 998 of file OSCoinSolver.cpp.
References cpuTime, ENUM_BASIS_STATUS_atLower, ENUM_BASIS_STATUS_atUpper, ENUM_BASIS_STATUS_basic, ENUM_BASIS_STATUS_isFree, ENUM_PROBLEM_COMPONENT_constraints, ENUM_PROBLEM_COMPONENT_variables, ErrorClass::errormsg, OSInstance::getConstraintNumber(), OSInstance::getNumberOfBinaryVariables(), OSInstance::getNumberOfIntegerVariables(), os_dtoa_format(), OSgetVersionInfo(), DefaultSolver::osinstance, DefaultSolver::osresult, DefaultSolver::osrl, osrlwriter, OSResult::setAnOtherVariableResultSparse(), OSResult::setBasisStatus(), OSResult::setDualVariableValuesDense(), OSResult::setGeneralMessage(), OSResult::setGeneralStatusType(), OSResult::setNumberOfOtherVariableResults(), OSResult::setObjectiveValuesDense(), OSResult::setPrimalVariableValuesDense(), OSResult::setServiceName(), OSResult::setSolutionMessage(), OSResult::setSolutionStatus(), OSResult::setSolverInvoked(), OSResult::setTime(), DefaultSolver::sSolverName, OSrLWriter::writeOSrL(), and x.
Referenced by solve().
void CoinSolver::writeResult | ( | CbcModel * | model | ) |
Definition at line 1544 of file OSCoinSolver.cpp.
References cpuTime, OSInstance::getNumberOfBinaryVariables(), OSInstance::getNumberOfIntegerVariables(), os_dtoa_format(), OSgetVersionInfo(), DefaultSolver::osinstance, DefaultSolver::osresult, DefaultSolver::osrl, osrlwriter, OSResult::setAnOtherVariableResultSparse(), OSResult::setDualVariableValuesDense(), OSResult::setGeneralStatusType(), OSResult::setNumberOfOtherVariableResults(), OSResult::setObjectiveValuesDense(), OSResult::setPrimalVariableValuesDense(), OSResult::setServiceName(), OSResult::setSolutionStatus(), OSResult::setTime(), OSrLWriter::writeOSrL(), and x.
OsiSolverInterface* CoinSolver::osiSolver |
osiSolver is the osi solver object -- in this case clp, glpk, cbc, cplex, symphony or dylp
Definition at line 93 of file OSCoinSolver.h.
Referenced by buildSolverInstance(), OSBearcatSolverXkij::getInitialRestrictedMaster(), OSBearcatSolverXij::getRouteDistance(), main(), OSColGenApp::resetMaster(), setSolverOptions(), solve(), OSColGenApp::solve(), OSDipBlockCoinSolver::solve(), and ~CoinSolver().
m_osilreader is an OSiLReader object used to create an osinstance from an osil string if needed
Definition at line 101 of file OSCoinSolver.h.
Referenced by buildSolverInstance(), and ~CoinSolver().
m_osolreader is an OSoLReader object used to create an osoption from an osol string if needed
Definition at line 107 of file OSCoinSolver.h.
Referenced by setSolverOptions(), and ~CoinSolver().
CoinPackedMatrix* CoinSolver::m_CoinPackedMatrix [private] |
m_CoinPackedMatrix is a Coin Packed Matrix ojbect
Definition at line 126 of file OSCoinSolver.h.
Referenced by buildSolverInstance(), dataEchoCheck(), setCoinPackedMatrix(), and ~CoinSolver().
OSrLWriter* CoinSolver::osrlwriter [private] |
osrlwriter object used to write osrl from an OSResult object
Definition at line 129 of file OSCoinSolver.h.
Referenced by buildSolverInstance(), CoinSolver(), getCoinSolverType(), setCoinPackedMatrix(), solve(), writeResult(), and ~CoinSolver().
const char** CoinSolver::cbc_argv [private] |
when Cbc is the solver, these are the arguments sent to Cbc Solve
Definition at line 134 of file OSCoinSolver.h.
Referenced by setSolverOptions(), solve(), and ~CoinSolver().
int CoinSolver::num_cbc_argv [private] |
the number of arguments in the argument list to the Cbc Solver
Definition at line 138 of file OSCoinSolver.h.
Referenced by setSolverOptions(), solve(), and ~CoinSolver().
double CoinSolver::cpuTime [private] |