- Main Page
- Namespaces
- Classes
- Files
- Related Pages

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# BonminProblem Class Reference

`#include <OSBonminSolver.h>`

Collaboration diagram for BonminProblem:

[legend]
List of all members.

## Public Member Functions
| BonminProblem (OSInstance *osinstance_, OSOption *osoption_)
| the BonminProblemclass constructor
virtual | ~BonminProblem ()
| the BonminProblem class destructor
virtual bool | get_scaling_parameters (Number &obj_scaling, bool &use_x_scaling, Index n, Number *x_scaling, bool &use_g_scaling, Index m, Number *g_scaling)
virtual const SosInfo * | sosConstraints () const
virtual const BranchingInfo * | branchingInfo () const
void | printSolutionAtEndOfAlgorithm ()
Overloaded functions specific to a TMINLP.
virtual bool | get_variables_types (Index n, VariableType *var_types)
| Pass the type of the variables (INTEGER, BINARY, CONTINUOUS) to the optimizer.
virtual bool | get_variables_linearity (Index n, Ipopt::TNLP::LinearityType *var_types)
| Pass info about linear and nonlinear variables.
virtual bool | get_constraints_linearity (Index m, Ipopt::TNLP::LinearityType *const_types)
| Pass the type of the constraints (LINEAR, NON_LINEAR) to the optimizer.
Overloaded functions defining a TNLP.
This group of function implement the various elements needed to define and solve a TNLP. They are the same as those in a standard Ipopt NLP problem
virtual bool | get_nlp_info (Index &n, Index &m, Index &nnz_jac_g, Index &nnz_h_lag, TNLP::IndexStyleEnum &index_style)
| Method to pass the main dimensions of the problem to Ipopt.
virtual bool | get_bounds_info (Index n, Number *x_l, Number *x_u, Index m, Number *g_l, Number *g_u)
| Method to return the bounds for my problem.
virtual bool | get_starting_point (Index n, bool init_x, Number *x, bool init_z, Number *z_L, Number *z_U, Index m, bool init_lambda, Number *lambda)
| Method to return the starting point for the algorithm.
virtual bool | eval_f (Index n, const Number *x, bool new_x, Number &obj_value)
| Method to return the objective value.
virtual bool | eval_grad_f (Index n, const Number *x, bool new_x, Number *grad_f)
| Method to return the gradient of the objective.
virtual bool | eval_g (Index n, const Number *x, bool new_x, Index m, Number *g)
| Method to return the constraint residuals.
virtual bool | eval_jac_g (Index n, const Number *x, bool new_x, Index m, Index nele_jac, Index *iRow, Index *jCol, Number *values)
| Method to return: 1) The structure of the jacobian (if "values" is NULL) 2) The values of the jacobian (if "values" is not NULL).
virtual bool | eval_h (Index n, const Number *x, bool new_x, Number obj_factor, Index m, const Number *lambda, bool new_lambda, Index nele_hess, Index *iRow, Index *jCol, Number *values)
| Method to return: 1) The structure of the hessian of the lagrangian (if "values" is NULL) 2) The values of the hessian of the lagrangian (if "values" is not NULL).
Solution Methods
virtual void | finalize_solution (TMINLP::SolverReturn status_, Index n, const Number *x, Number obj_value)
| Method called by Ipopt at the end of optimization.
## Public Attributes
OSInstance * | osinstance
OSOption * | osoption
TMINLP::SolverReturn | status
## Private Attributes
bool | printSol_
std::string | bonminErrorMsg

## Detailed Description

Definition at line 85 of file OSBonminSolver.h.

## Constructor & Destructor Documentation

BonminProblem::BonminProblem | ( | OSInstance * | osinstance_,
|  | OSOption * | osoption_ |
| ) |  |  |

the BonminProblemclass constructor

Definition at line 1018 of file OSBonminSolver.cpp.

References osinstance, osoption, and printSol_.

BonminProblem::~BonminProblem | ( |  | ) | `[virtual]`

the BonminProblem class destructor

Definition at line 1024 of file OSBonminSolver.cpp.

## Member Function Documentation

bool BonminProblem::get_variables_types | ( | Index | n,
|  | VariableType * | var_types |
| ) |  |  | `[virtual]`

Pass the type of the variables (INTEGER, BINARY, CONTINUOUS) to the optimizer.

Parameters:

  | n | size of var_types (has to be equal to the number of variables in the problem)
  | var_types | types of the variables (has to be filled by function).

Definition at line 75 of file OSBonminSolver.cpp.

References OSInstance::getVariableNumber(), OSInstance::getVariableTypes(), INTEGER, and osinstance.

bool BonminProblem::get_variables_linearity | ( | Index | n,
|  | Ipopt::TNLP::LinearityType * | var_types |
| ) |  |  | `[virtual]`

Pass info about linear and nonlinear variables.

get an index map of the nonlinear variables and see which variable are in <nonlinearExpressions> element

iterate through and get an index of all variables that are in <nonlinearExpressions> element

Definition at line 101 of file OSBonminSolver.cpp.

References bonminErrorMsg, ErrorClass::errormsg, OSInstance::getAllNonlinearVariablesIndexMap(), OSInstance::initForAlgDiff(), and osinstance.

bool BonminProblem::get_constraints_linearity | ( | Index | m,
|  | Ipopt::TNLP::LinearityType * | const_types |
| ) |  |  | `[virtual]`

Pass the type of the constraints (LINEAR, NON_LINEAR) to the optimizer.

Parameters:

  | m | size of const_types (has to be equal to the number of constraints in the problem)
  | const_types | types of the constraints (has to be filled by function).

Definition at line 141 of file OSBonminSolver.cpp.

References OSInstance::getNonlinearExpressionTreeModIndexes(), OSInstance::getNumberOfNonlinearExpressionTreeModIndexes(), and osinstance.

bool BonminProblem::get_nlp_info | ( | Index & | n,
|  | Index & | m,
|  | Index & | nnz_jac_g,
|  | Index & | nnz_h_lag,
|  | TNLP::IndexStyleEnum & | index_style |
| ) |  |  | `[virtual]`

Method to pass the main dimensions of the problem to Ipopt.

Parameters:

  | n | number of variables in problem.
  | m | number of constraints.
  | nnz_jac_g | number of nonzeroes in Jacobian of constraints system.
  | nnz_h_lag | number of nonzeroes in Hessian of the Lagrangean.
  | index_style | indicate wether arrays are numbered from 0 (C-style) or from 1 (Fortran).

Returns:
  true in case of success.

Definition at line 167 of file OSBonminSolver.cpp.

References bonminErrorMsg, OSInstance::bUseExpTreeForFunEval, ErrorClass::errormsg, OSInstance::getConstraintNumber(), OSInstance::getJacobianSparsityPattern(), OSInstance::getLagrangianHessianSparsityPattern(), OSInstance::getNumberOfNonlinearExpressions(), OSInstance::getNumberOfQuadraticTerms(), OSInstance::getVariableNumber(), SparseHessianMatrix::hessDimension, OSInstance::initForAlgDiff(), osinstance, and SparseJacobianMatrix::valueSize.

bool BonminProblem::get_bounds_info | ( | Index | n,
|  | Number * | x_l,
|  | Number * | x_u,
|  | Index | m,
|  | Number * | g_l,
|  | Number * | g_u |
| ) |  |  | `[virtual]`

Method to return the bounds for my problem.

Definition at line 225 of file OSBonminSolver.cpp.

References OSInstance::getConstraintLowerBounds(), OSInstance::getConstraintUpperBounds(), OSInstance::getVariableLowerBounds(), OSInstance::getVariableUpperBounds(), and osinstance.

bool BonminProblem::get_starting_point | ( | Index | n,
|  | bool | init_x,
|  | Number * | x,
|  | bool | init_z,
|  | Number * | z_L,
|  | Number * | z_U,
|  | Index | m,
|  | bool | init_lambda,
|  | Number * | lambda |
| ) |  |  | `[virtual]`

Method to return the starting point for the algorithm.

Definition at line 265 of file OSBonminSolver.cpp.

References DEBUG, OSOption::getInitVarValuesSparse(), OSOption::getNumberOfInitVarValues(), OSInstance::getVariableNumber(), InitVarValue::idx, OSInstance::instanceData, Variable::lb, OSDBL_MAX, osinstance, osoption, Variable::ub, InitVarValue::value, Variables::var, and InstanceData::variables.

bool BonminProblem::eval_f | ( | Index | n,
|  | const Number * | x,
|  | bool | new_x,
|  | Number & | obj_value |
| ) |  |  | `[virtual]`

Method to return the objective value.

Definition at line 392 of file OSBonminSolver.cpp.

References bonminErrorMsg, OSInstance::calculateAllObjectiveFunctionValues(), ErrorClass::errormsg, OSInstance::getObjectiveNumber(), OSInstance::instanceData, Objective::maxOrMin, Objectives::obj, InstanceData::objectives, and osinstance.

bool BonminProblem::eval_grad_f | ( | Index | n,
|  | const Number * | x,
|  | bool | new_x,
|  | Number * | grad_f |
| ) |  |  | `[virtual]`

Method to return the gradient of the objective.

Definition at line 411 of file OSBonminSolver.cpp.

References bonminErrorMsg, OSInstance::calculateObjectiveFunctionGradient(), ErrorClass::errormsg, OSInstance::getObjectiveNumber(), OSInstance::instanceData, Objective::maxOrMin, Objectives::obj, InstanceData::objectives, and osinstance.

bool BonminProblem::eval_g | ( | Index | n,
|  | const Number * | x,
|  | bool | new_x,
|  | Index | m,
|  | Number * | g |
| ) |  |  | `[virtual]`

Method to return the constraint residuals.

Definition at line 440 of file OSBonminSolver.cpp.

References bonminErrorMsg, OSInstance::calculateAllConstraintFunctionValues(), ErrorClass::errormsg, and osinstance.

bool BonminProblem::eval_jac_g | ( | Index | n,
|  | const Number * | x,
|  | bool | new_x,
|  | Index | m,
|  | Index | nele_jac,
|  | Index * | iRow,
|  | Index * | jCol,
|  | Number * | values |
| ) |  |  | `[virtual]`

Method to return: 1) The structure of the jacobian (if "values" is NULL) 2) The values of the jacobian (if "values" is not NULL).

Definition at line 458 of file OSBonminSolver.cpp.

References bonminErrorMsg, ErrorClass::errormsg, OSInstance::getJacobianSparsityPattern(), SparseJacobianMatrix::indexes, osinstance, and SparseJacobianMatrix::starts.

bool BonminProblem::eval_h | ( | Index | n,
|  | const Number * | x,
|  | bool | new_x,
|  | Number | obj_factor,
|  | Index | m,
|  | const Number * | lambda,
|  | bool | new_lambda,
|  | Index | nele_hess,
|  | Index * | iRow,
|  | Index * | jCol,
|  | Number * | values |
| ) |  |  | `[virtual]`

Method to return: 1) The structure of the hessian of the lagrangian (if "values" is NULL) 2) The values of the hessian of the lagrangian (if "values" is not NULL).

Definition at line 508 of file OSBonminSolver.cpp.

References bonminErrorMsg, OSInstance::calculateLagrangianHessian(), ErrorClass::errormsg, OSInstance::getLagrangianHessianSparsityPattern(), SparseHessianMatrix::hessColIdx, SparseHessianMatrix::hessRowIdx, SparseHessianMatrix::hessValues, and osinstance.

bool BonminProblem::get_scaling_parameters | ( | Number & | obj_scaling,
|  | bool & | use_x_scaling,
|  | Index | n,
|  | Number * | x_scaling,
|  | bool & | use_g_scaling,
|  | Index | m,
|  | Number * | g_scaling |
| ) |  |  | `[virtual]`

Definition at line 557 of file OSBonminSolver.cpp.

void BonminProblem::finalize_solution | ( | TMINLP::SolverReturn | status_,
|  | Index | n,
|  | const Number * | x,
|  | Number | obj_value |
| ) |  |  | `[virtual]`

Method called by Ipopt at the end of optimization.

Definition at line 577 of file OSBonminSolver.cpp.

References status.

virtual const SosInfo* BonminProblem::sosConstraints | ( |  | ) | const`[inline, virtual]`

Definition at line 197 of file OSBonminSolver.h.

virtual const BranchingInfo* BonminProblem::branchingInfo | ( |  | ) | const`[inline, virtual]`

Definition at line 198 of file OSBonminSolver.h.

void BonminProblem::printSolutionAtEndOfAlgorithm | ( |  | ) | `[inline]`

Definition at line 200 of file OSBonminSolver.h.

References printSol_.

## Member Data Documentation

OSInstance* BonminProblem::osinstance

Definition at line 97 of file OSBonminSolver.h.

Referenced by BonminProblem(), eval_f(), eval_g(), eval_grad_f(), eval_h(), eval_jac_g(), get_bounds_info(), get_constraints_linearity(), get_nlp_info(), get_starting_point(), get_variables_linearity(), and get_variables_types().

OSOption* BonminProblem::osoption

Definition at line 99 of file OSBonminSolver.h.

Referenced by BonminProblem(), and get_starting_point().

TMINLP::SolverReturn BonminProblem::status

Definition at line 101 of file OSBonminSolver.h.

Referenced by finalize_solution().

bool BonminProblem::printSol_`[private]`

Definition at line 208 of file OSBonminSolver.h.

Referenced by BonminProblem(), and printSolutionAtEndOfAlgorithm().

std::string BonminProblem::bonminErrorMsg`[private]`

Definition at line 228 of file OSBonminSolver.h.

Referenced by eval_f(), eval_g(), eval_grad_f(), eval_h(), eval_jac_g(), get_nlp_info(), and get_variables_linearity().

The documentation for this class was generated from the following files:

- /home/coin/SVN-release/OS-2.3.5/OS/src/OSSolverInterfaces/OSBonminSolver.h
- /home/coin/SVN-release/OS-2.3.5/OS/src/OSSolverInterfaces/OSBonminSolver.cpp
- /home/coin/SVN-release/OS-2.3.5/OS/v2.0/OSBonminSolver.cpp