![]() |
MAiNGO
|
Class for representing problems to be solved by IpOpt, providing an interface to the problem definition in problem.h used by MC++. More...
#include <ipoptProblem.h>
Public Member Functions | |
IpoptProblem () | |
Standard constructor. More... | |
IpoptProblem (unsigned nvarIn, unsigned neqIn, unsigned nineqIn, unsigned nineqSquashIn, UbpStructure *structureIn, std::vector< Constraint > *constraintPropertiesIn, std::shared_ptr< DagObj > dagObj) | |
Constructor actually used in ubp.cpp. Initializes the corresponding members. More... | |
virtual | ~IpoptProblem () |
Destructor. More... | |
virtual bool | get_nlp_info (Ipopt::Index &n, Ipopt::Index &m, Ipopt::Index &nnz_jac_g, Ipopt::Index &nnz_h_lag, IndexStyleEnum &Index_style) |
Function called by Ipopt to get basic information on the problem. More... | |
virtual bool | get_bounds_info (Ipopt::Index n, Ipopt::Number *x_l, Ipopt::Number *x_u, Ipopt::Index m, Ipopt::Number *g_l, Ipopt::Number *g_u) |
Function called by Ipopt to get information on variables bounds. More... | |
virtual bool | get_starting_point (Ipopt::Index n, bool init_x, Ipopt::Number *x, bool init_z, Ipopt::Number *z_L, Ipopt::Number *z_U, Ipopt::Index m, bool init_lambda, Ipopt::Number *lambda) |
Function called by Ipopt to query the starting point for local search. More... | |
virtual bool | eval_f (Ipopt::Index n, const Ipopt::Number *x, bool new_x, Ipopt::Number &obj_value) |
Function called by Ipopt to evaluate the objective function. More... | |
virtual bool | eval_grad_f (Ipopt::Index n, const Ipopt::Number *x, bool new_x, Ipopt::Number *grad_f) |
Function called by Ipopt to evaluate the gradient of the objective function. More... | |
virtual bool | eval_g (Ipopt::Index n, const Ipopt::Number *x, bool new_x, Ipopt::Index m, Ipopt::Number *g) |
Function called by Ipopt to evaluate the constraints. More... | |
virtual bool | eval_jac_g (Ipopt::Index n, const Ipopt::Number *x, bool new_x, Ipopt::Index m, Ipopt::Index nele_jac, Ipopt::Index *iRow, Ipopt::Index *jCol, Ipopt::Number *values) |
Function called by Ipopt to evaluate the constraints. More... | |
virtual bool | eval_h (Ipopt::Index n, const Ipopt::Number *x, bool new_x, Ipopt::Number obj_factor, Ipopt::Index m, const Ipopt::Number *lambda, bool new_lambda, Ipopt::Index nele_hess, Ipopt::Index *iRow, Ipopt::Index *jCol, Ipopt::Number *values) |
Function called by Ipopt to evaluate the Hessian - not implemented, just throws an exception! More... | |
virtual void | finalize_solution (Ipopt::SolverReturn status, Ipopt::Index n, const Ipopt::Number *x, const Ipopt::Number *z_L, const Ipopt::Number *z_U, Ipopt::Index m, const Ipopt::Number *g, const Ipopt::Number *lambda, Ipopt::Number obj_value, const Ipopt::IpoptData *ip_data, Ipopt::IpoptCalculatedQuantities *ip_cq) |
Function called by Ipopt to communicate the result of the local search. More... | |
double | get_solution (std::vector< double > &sol_x) |
Function called from the upper bounding wrapper to query the solution. More... | |
void | set_bounds_and_starting_point (const std::vector< double > &xL, const std::vector< double > &xU, const std::vector< double > &xStart) |
Function called from the upper bounding wrapper to specify the variable bounds and starting point. More... | |
Private Member Functions | |
IpoptProblem (const IpoptProblem &) | |
IpoptProblem & | operator= (const IpoptProblem &) |
Private Attributes | |
std::shared_ptr< DagObj > | _DAGobj |
Internal IPOPT variables | |
Ipopt::Index | _nvar |
Ipopt::Index | _nineq |
Ipopt::Index | _nineqSquash |
Ipopt::Index | _neq |
UbpStructure * | _structure |
std::vector< Constraint > * | _constraintProperties |
double | _solution_f |
std::vector< double > | _xL |
std::vector< double > | _xU |
std::vector< double > | _xStart |
std::vector< double > | _solutionX |
Class for representing problems to be solved by IpOpt, providing an interface to the problem definition in problem.h used by MC++.
This class is a specialization of the problem definition class within the Ipopt C++ API. It provides an interface between Ipopt and the problem definition in problem.h. by evaluating the Model equations and preparing the information required by Ipopt. An instance of this class is handed to Ipopt as an argument of its optimizeTNLP routine in ubp.cpp. For more information on the basic interface see https://www.coin-or.org/Ipopt/documentation/node23.html.
maingo::ubp::IpoptProblem::IpoptProblem | ( | ) |
Standard constructor.
IpoptProblem::IpoptProblem | ( | unsigned | nvarIn, |
unsigned | neqIn, | ||
unsigned | nineqIn, | ||
unsigned | nineqSquashIn, | ||
UbpStructure * | structureIn, | ||
std::vector< Constraint > * | constraintPropertiesIn, | ||
std::shared_ptr< DagObj > | dagObj | ||
) |
Constructor actually used in ubp.cpp. Initializes the corresponding members.
[in] | nvarIn | is the number of optimization variables |
[in] | neqIn | is the number of equality constraints |
[in] | nineqIn | is the number of inequality constraints |
[in] | nineqSquashIn | is the number of squash inequality constraints which are to be used only if the squash node has been used |
[in] | structureIn | is a struct containing information on sparsity patterns of the Lagrangian and Hessian |
[in] | constraintPropertiesIn | is a pointer to the constraint properties determined by MAiNGO |
[in] | dagObj | is a pointer to the struct holding the DAG to be evaluated |
|
virtual |
Destructor.
|
private |
default copy constructor declared private to prevent use
|
virtual |
Function called by Ipopt to evaluate the objective function.
[in] | n | is the number of optimization variables |
[in] | x | is a pointer to an array containing the point at which the objective is to be evaluated |
[in] | new_x | indicates whether the current x is different from the previous one handed to one of the evaluation functions |
[out] | obj_value | is the value of the objective function at the current point |
|
virtual |
Function called by Ipopt to evaluate the constraints.
[in] | n | is the number of optimization variables |
[in] | x | is a pointer to an array containing the point at which the objective is to be evaluated |
[in] | new_x | indicates whether the current x is different from the previous one handed to one of the evaluation functions |
[in] | m | is the total number of constraints (both equality and inequality) |
[out] | g | is a pointer to an array containing the values of the constraints at the current point |
|
virtual |
Function called by Ipopt to evaluate the gradient of the objective function.
[in] | n | is the number of optimization variables |
[in] | x | is a pointer to an array containing the point at which the objective is to be evaluated |
[in] | new_x | indicates whether the current x is different from the previous one handed to one of the evaluation functions |
[out] | grad_f | is a pointer to an array containing the gradient of the objective function at the current point |
|
virtual |
Function called by Ipopt to evaluate the Hessian - not implemented, just throws an exception!
[in] | n | not implemented |
[in] | x | not implemented |
[in] | new_x | not implemented |
[in] | obj_factor | not implemented |
[in] | m | not implemented |
[in] | lambda | not implemented |
[in] | new_lambda | not implemented |
[in] | nele_hess | not implemented |
[in] | iRow | not implemented |
[in] | jCol | not implemented |
[in] | values | not implemented |
|
virtual |
Function called by Ipopt to evaluate the constraints.
[in] | n | is the number of optimization variables |
[in] | x | is a pointer to an array containing the point at which the objective is to be evaluated |
[in] | new_x | indicates whether the current x is different from the previous one handed to one of the evaluation functions |
[in] | m | is the total number of constraints (both equality and inequality) |
[in] | nele_jac | is not documented in MAiNGO |
[out] | iRow | is a pointer to an array containing the row indices according to the sparsity pattern (see https://www.coin-or.org/Ipopt/documentation/node23.html). |
[out] | jCol | is a pointer to an array containing the row indices according to the sparsity pattern (see https://www.coin-or.org/Ipopt/documentation/node23.html). |
[in,out] | values | is a pointer to an array containing the jacobian of the constraints at the current point. If the function is called with values==NULL, only information on the structure of the Jacobian is required. |
|
virtual |
Function called by Ipopt to communicate the result of the local search.
[in] | status | Return code of Ipopt (not used since feasibility is checked in ubp.cpp and local optimality is not as important in this case). |
[in] | n | is the number of optimization variables |
[in] | x | is a pointer to an array containing the solution point of the local search |
[in] | obj_value | is the objective function value at the solution point |
[in] | z_L | not used |
[in] | z_U | not used |
[in] | m | not used |
[in] | g | not used |
[in] | lambda | not used |
[in] | ip_data | not used |
[in] | ip_cq | not used |
|
virtual |
Function called by Ipopt to get information on variables bounds.
[in] | n | is the number of optimization variables |
[in] | m | is the total number of constraints (both equality and inequality) |
[out] | x_l | is a pointer to an array containing the lower bounds on the optimization variables |
[out] | x_u | is a pointer to an array containing the upper bounds on the optimization variables |
[out] | g_l | is a pointer to an array containing the lower bounds on the constraints (zero for equalities, and -2e19 for inequalities) |
[out] | g_u | is a pointer to an array containing the upper bounds on the constraints (all zero) |
|
virtual |
Function called by Ipopt to get basic information on the problem.
[out] | n | is the number of optimization variables |
[out] | m | is the total number of constraints (both equality and inequality) |
[out] | nnz_jac_g | is the number of non-zero elements of the Jacobian of the constraints (assumed to be dense) |
[out] | nnz_h_lag | is the number of non-zero elements of the Hessian of the Lagrangian (not used since BigMC currently only relies on BFGS) |
[out] | Index_style | Information on indexing of arrays (using C-style indexing, i.e., starting with 0) |
double IpoptProblem::get_solution | ( | std::vector< double > & | sol_x | ) |
Function called from the upper bounding wrapper to query the solution.
[out] | sol_x | is a vector containing the solution point |
|
virtual |
Function called by Ipopt to query the starting point for local search.
[in] | n | is the number of optimization variables |
[in] | m | is the total number of constraints (both equality and inequality) |
[in] | init_x | indicates that a starting point for x is required |
[out] | x | is a pointer to an array containing the initial point |
[in] | init_z | not used in MAiNGO implementation |
[in] | z_L | not used in MAiNGO implementation |
[in] | z_U | not used in MAiNGO implementation |
[in] | init_lambda | not used in MAiNGO implementation |
[in] | lambda | not used in MAiNGO implementation |
|
private |
default assignment operator declared private to prevent use
void IpoptProblem::set_bounds_and_starting_point | ( | const std::vector< double > & | xL, |
const std::vector< double > & | xU, | ||
const std::vector< double > & | xStart | ||
) |
Function called from the upper bounding wrapper to specify the variable bounds and starting point.
[in] | xL | is a vector containing the lower bounds on the optimization variables |
[in] | xU | is a vector containing the upper bounds on the optimization variables |
[in] | xStart | is a vector containing the starting point to be used in local search |
|
private |
pointer to constraint properties determined by MAiNGO
|
private |
pointer to object containing DAG for upper bounding
|
private |
number of equalities
|
private |
number of inequalities
|
private |
number of squash inequalities
|
private |
number of variables
|
private |
solution value
|
private |
vector holding the solution point
|
private |
pointer to struct storing information on the problem structure
|
private |
vector holding lower bounds
|
private |
vector holding the initial point
|
private |
vector holding upper bounds