
Public Member Functions | |
| SolveModelImpl (SolverImpl *p) | |
| ~SolveModelImpl () throw () | |
| void | solve () |
| void | solveLp () |
| void | solveNlp () |
| bool | isSolved () const |
Private Member Functions | |
| SolverImpl * | getSolverImpl () const |
| auto_ptr < lp::BaseAlgorithm > | getLpAlgorithm () const |
| auto_ptr < nlp::BaseAlgorithm > | getNlpAlgorithm () const |
| void | parseConstraints (LpModelBuilder *pBuilder) |
| void | resolveConstraintAddress (LpModelBuilder *pBuilder) |
| CellAddress | resolveObjectiveFuncAddress () |
| vector< CellAddress > | resolveDecisionVarAddress () |
| void | updateCells (LpModelBuilder *pBuilder) |
Private Attributes | |
| SolverImpl * | m_pSolverImpl |
| bool | m_bSolved |
| Matrix | m_mxSolution |
Definition at line 188 of file solvemodel.cxx.
| scsolver::SolveModelImpl::SolveModelImpl | ( | SolverImpl * | p | ) | [inline] |
Definition at line 191 of file solvemodel.cxx.
| scsolver::SolveModelImpl::~SolveModelImpl | ( | ) | throw () [inline] |
Definition at line 197 of file solvemodel.cxx.
| void scsolver::SolveModelImpl::solve | ( | ) | [inline] |
This is the gateway method that calls either solveLp() or solveNlp() as appropriate based on the corresponding option setting.
Definition at line 206 of file solvemodel.cxx.
References scsolver::OptionData::getModelType(), scsolver::SolverImpl::getOptionData(), getSolverImpl(), scsolver::OPTMODELTYPE_LP, scsolver::OPTMODELTYPE_MILP, scsolver::OPTMODELTYPE_MINLP, scsolver::OPTMODELTYPE_NLP, solveLp(), and solveNlp().
| void scsolver::SolveModelImpl::solveLp | ( | ) | [inline] |
This method takes model parameters from the dialog, constructs an internal representation of an LP model, chooses an algorithm, solves it, and in case a feasible solution is found it puts the solution back into the cells.
Definition at line 230 of file solvemodel.cxx.
References scsolver::Debug(), scsolver::SolverDialog::getGoal(), getLpAlgorithm(), scsolver::SolverImpl::getMainDialog(), scsolver::RuntimeError::getMessage(), scsolver::SolverImpl::getOptionData(), scsolver::BaseDialog::getResStr(), getSolverImpl(), scsolver::OptionData::getVarInteger(), scsolver::OptionData::getVarPositive(), scsolver::numeric::GOAL_UNKNOWN, m_bSolved, m_mxSolution, parseConstraints(), resolveConstraintAddress(), resolveDecisionVarAddress(), resolveObjectiveFuncAddress(), scsolver::OptionData::setVarPositive(), scsolver::SolverDialog::showMessage(), scsolver::SolverDialog::showSolutionFound(), scsolver::SolverDialog::showSolutionInfeasible(), and updateCells().
Referenced by solve().
| void scsolver::SolveModelImpl::solveNlp | ( | ) | [inline] |
Solve non-linear model. Still work in progress.
Definition at line 303 of file solvemodel.cxx.
References scsolver::NlpModelBuilder::appendDecVarAddress(), scsolver::NlpModelBuilder::clearDecVarAddresses(), scsolver::SolverImpl::getCalcInterface(), scsolver::SolverDialog::getGoal(), scsolver::SolverImpl::getMainDialog(), scsolver::RuntimeError::getMessage(), scsolver::NlpModelBuilder::getModel(), getNlpAlgorithm(), scsolver::BaseDialog::getResStr(), getSolverImpl(), scsolver::numeric::GOAL_UNKNOWN, m_bSolved, m_pSolverImpl, scsolver::numeric::nlp::Model::print(), resolveDecisionVarAddress(), resolveObjectiveFuncAddress(), scsolver::NlpModelBuilder::setFuncObj(), scsolver::numeric::nlp::Model::setGoal(), scsolver::NlpModelBuilder::setObjectiveFormulaAddress(), scsolver::SolverDialog::showMessage(), and scsolver::SolverDialog::showSolutionFound().
Referenced by solve().
| bool scsolver::SolveModelImpl::isSolved | ( | ) | const [inline] |
| SolverImpl* scsolver::SolveModelImpl::getSolverImpl | ( | ) | const [inline, private] |
Definition at line 374 of file solvemodel.cxx.
References m_pSolverImpl.
Referenced by getLpAlgorithm(), resolveConstraintAddress(), resolveDecisionVarAddress(), resolveObjectiveFuncAddress(), solve(), solveLp(), and solveNlp().
| auto_ptr< lp::BaseAlgorithm > scsolver::SolveModelImpl::getLpAlgorithm | ( | ) | const [private] |
This method returns an algorithm object to use to solve a given LP model. While all this method does currently is simply return the pre-selected algorithm, in future this method may be used to pick a user-selected algorithm based on his/her settings.
Definition at line 573 of file solvemodel.cxx.
References scsolver::ascii(), and getSolverImpl().
Referenced by solveLp().
| auto_ptr<nlp::BaseAlgorithm> scsolver::SolveModelImpl::getNlpAlgorithm | ( | ) | const [inline, private] |
| void scsolver::SolveModelImpl::parseConstraints | ( | LpModelBuilder * | pBuilder | ) | [inline, private] |
Transform a LP model given in the cells into the standard format. This is done by setting the value of one of the decision variable cells to 1 and all the others to 0, and interpret the values of the objective function and constraint cells, and repeat it for every decision variable cell.
Definition at line 394 of file solvemodel.cxx.
References scsolver::ascii(), scsolver::LpModelBuilder::getAllConstraintAddresses(), scsolver::LpModelBuilder::getAllDecisionVarAddresses(), scsolver::SolverImpl::getCalcInterface(), scsolver::CalcInterface::getCellFormula(), scsolver::CalcInterface::getCellValue(), scsolver::LpModelBuilder::getCostVector(), scsolver::LpModelBuilder::getObjectiveFormulaAddress(), scsolver::LpModelBuilder::getTempCellFormula(), scsolver::ConstantTermStorage::getValue(), m_pSolverImpl, scsolver::CalcInterface::setCellFormula(), scsolver::LpModelBuilder::setConstraintCoefficient(), scsolver::LpModelBuilder::setConstraintMatrixSize(), scsolver::LpModelBuilder::setCostVector(), scsolver::LpModelBuilder::setTempCellFormula(), and scsolver::ConstantTermStorage::setValue().
Referenced by solveLp().
| void scsolver::SolveModelImpl::resolveConstraintAddress | ( | LpModelBuilder * | pBuilder | ) | [private] |
Get all the constraint strings (both the LHS and RHS strings) from the main dialog, resolve their addresses into sheet, column, and row IDs, and give them to the builder.
Definition at line 605 of file solvemodel.cxx.
References scsolver::LpModelBuilder::clearConstraintAddresses(), scsolver::Debug(), scsolver::ConstraintString::Equal, scsolver::SolverDialog::getAllConstraints(), scsolver::SolverImpl::getCalcInterface(), scsolver::CalcInterface::getCellRangeAddress(), scsolver::SolverImpl::getMainDialog(), getSolverImpl(), scsolver::lcl_isNumeric(), scsolver::ConstraintString::Left, m_pSolverImpl, scsolver::ConstraintString::Right, scsolver::LpModelBuilder::setConstraintAddress(), scsolver::ConstraintAddress::setEquality(), scsolver::ConstraintAddress::setLeftCellAddr(), scsolver::ConstraintAddress::setLeftCellValue(), scsolver::ConstraintAddress::setRightCellAddr(), and scsolver::ConstraintAddress::setRightCellValue().
Referenced by solveLp().
| CellAddress scsolver::SolveModelImpl::resolveObjectiveFuncAddress | ( | ) | [inline, private] |
Takes the string form of an objective function cell address (e.g. $'Sheet1'.$A$2), converts it into a 3D address.
Definition at line 510 of file solvemodel.cxx.
References scsolver::SolverImpl::getCalcInterface(), scsolver::CalcInterface::getCellAddress(), scsolver::SolverImpl::getMainDialog(), scsolver::SolverImpl::getResStr(), getSolverImpl(), scsolver::SolverDialog::getTargetCellAddress(), and m_pSolverImpl.
Referenced by solveLp(), and solveNlp().
| vector<CellAddress> scsolver::SolveModelImpl::resolveDecisionVarAddress | ( | ) | [inline, private] |
Convert a 3D cell reference (e.g. $'Sheet Name'.$B$5:$C$7) into an array of individual cell addresses. These addresses represent a series of decision variables in sequential order.
Definition at line 529 of file solvemodel.cxx.
References scsolver::SolverImpl::getCalcInterface(), scsolver::CalcInterface::getCellRangeAddress(), scsolver::SolverImpl::getMainDialog(), scsolver::SolverImpl::getResStr(), getSolverImpl(), scsolver::SolverDialog::getVarCellAddress(), and m_pSolverImpl.
Referenced by solveLp(), and solveNlp().
| void scsolver::SolveModelImpl::updateCells | ( | LpModelBuilder * | pBuilder | ) | [private] |
Definition at line 711 of file solvemodel.cxx.
References scsolver::LpModelBuilder::getAllDecisionVarAddresses(), scsolver::SolverImpl::getCalcInterface(), m_mxSolution, m_pSolverImpl, scsolver::numeric::Matrix::rows(), and scsolver::CalcInterface::setCellValue().
Referenced by solveLp().
Definition at line 370 of file solvemodel.cxx.
Referenced by getSolverImpl(), parseConstraints(), resolveConstraintAddress(), resolveDecisionVarAddress(), resolveObjectiveFuncAddress(), solveNlp(), and updateCells().
bool scsolver::SolveModelImpl::m_bSolved [private] |
Matrix scsolver::SolveModelImpl::m_mxSolution [private] |
1.5.3