#include <BonTMINLP2Quad.hpp>
Inheritance diagram for Bonmin::TMINLP2TNLPQuadCuts:
Public Member Functions | |
void | set_linear_objective (int n_var, const double *obj, double c_0) |
Change objective to a linear one whith given objective function. | |
void | reset_objective () |
Reset objective to original one. | |
Constructors/Destructors | |
TMINLP2TNLPQuadCuts (const Ipopt::SmartPtr< Bonmin::TMINLP > tminlp) | |
TMINLP2TNLPQuadCuts (const TMINLP2TNLPQuadCuts &) | |
Copy Constructor. | |
virtual Bonmin::TMINLP2TNLP * | clone () const |
Virtual copy. | |
virtual | ~TMINLP2TNLPQuadCuts () |
Destructor. | |
methods to gather information about the NLP | |
virtual bool | get_nlp_info (Ipopt::Index &n, Ipopt::Index &m, Ipopt::Index &nnz_jac_g, Ipopt::Index &nnz_h_lag, Ipopt::TNLP::IndexStyleEnum &index_style) |
This call is just passed onto parent class and add number of quadratic cuts. | |
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) |
This call is just passed onto parent class and add bounds of quadratic cuts. | |
virtual bool | get_constraints_linearity (Ipopt::Index m, Ipopt::TNLP::LinearityType *const_types) |
This call is just passed onto parent class and add number of quadratic cuts. | |
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) |
This call is just passed onto parent class and add lambda for quadratic cuts. | |
virtual bool | get_scaling_parameters (Ipopt::Number &obj_scaling, bool &use_x_scaling, Ipopt::Index n, Ipopt::Number *x_scaling, bool &use_g_scaling, Ipopt::Index m, Ipopt::Number *g_scaling) |
Method that returns scaling parameters (passed to parent all quadratic not scaled). | |
virtual bool | eval_f (Ipopt::Index n, const Ipopt::Number *x, bool new_x, Ipopt::Number &obj_value) |
Returns the value of the objective function in x. | |
virtual bool | eval_grad_f (Ipopt::Index n, const Ipopt::Number *x, bool new_x, Ipopt::Number *grad_f) |
Returns the vector of the gradient of the objective w.r.t. | |
virtual bool | eval_g (Ipopt::Index n, const Ipopt::Number *x, bool new_x, Ipopt::Index m, Ipopt::Number *g) |
Returns the vector of constraint values in x (appends constraint values for quadratics). | |
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) |
Returns the jacobian of the constraints. | |
virtual bool | eval_gi (Ipopt::Index n, const Ipopt::Number *x, bool new_x, Ipopt::Index i, Ipopt::Number &gi) |
compute the value of a single constraint | |
virtual bool | eval_grad_gi (Ipopt::Index n, const Ipopt::Number *x, bool new_x, Ipopt::Index i, Ipopt::Index &nele_grad_gi, Ipopt::Index *jCol, Ipopt::Number *values) |
compute the structure or values of the gradient for one constraint | |
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) |
Return the hessian of the lagrangian. | |
Cuts management. | |
void | addCuts (const Cuts &cuts, bool safe) |
Method to add quadratic cuts . | |
void | addCuts (const OsiCuts &cuts) |
Method to add OsiCuts figuring out which is quadratic (slow!). | |
virtual void | addCuts (unsigned int numberCuts, const OsiRowCut **cuts) |
Method to add array of OsiRowCut figuring out which is quadratic (slow!). | |
void | removeCuts (unsigned int number, const int *toRemove) |
Method which removes a set of cuts. | |
Protected Member Functions | |
void | addRowCuts (const OsiCuts &cuts, bool safe) |
Method to add OsiCuts eventualy figuring out which is quadratic. | |
Default Compiler Generated Methods | |
(Hidden to avoid implicit creation/calling). These methods are not implemented and we do not want the compiler to implement them for us, so we declare them private and do not define them. This ensures that they will not be implicitly created/called. | |
TMINLP2TNLPQuadCuts () | |
Default Constructor. | |
TMINLP2TNLPQuadCuts & | operator= (const TMINLP2TNLP &) |
Overloaded Equals Operator. | |
Private Member Functions | |
void | printH () |
print H_ for debug. | |
Private Attributes | |
vector< QuadRow * > | quadRows_ |
Some storage for quadratic cuts. | |
AdjustableMat | H_ |
Storage for the original hessian of the problem. | |
int | curr_nnz_jac_ |
Current umber of entries in the jacobian. | |
vector< double > | obj_ |
Store user passed linear objective. | |
double | c_ |
constant term in objective function. |
Definition at line 22 of file BonTMINLP2Quad.hpp.
Bonmin::TMINLP2TNLPQuadCuts::TMINLP2TNLPQuadCuts | ( | const Ipopt::SmartPtr< Bonmin::TMINLP > | tminlp | ) |
Bonmin::TMINLP2TNLPQuadCuts::TMINLP2TNLPQuadCuts | ( | const TMINLP2TNLPQuadCuts & | ) |
Copy Constructor.
Definition at line 51 of file BonTMINLP2Quad.cpp.
References Bonmin::TMINLP2TNLP::eval_h(), H_, Bonmin::TMINLP2TNLP::index_style(), m, Bonmin::TMINLP2TNLP::nnz_h_lag(), Bonmin::TMINLP2TNLP::num_constraints(), Bonmin::TMINLP2TNLP::num_variables(), and quadRows_.
Bonmin::TMINLP2TNLPQuadCuts::~TMINLP2TNLPQuadCuts | ( | ) | [virtual] |
Bonmin::TMINLP2TNLPQuadCuts::TMINLP2TNLPQuadCuts | ( | ) | [protected] |
virtual Bonmin::TMINLP2TNLP* Bonmin::TMINLP2TNLPQuadCuts::clone | ( | ) | const [inline, virtual] |
Virtual copy.
Reimplemented from Bonmin::TMINLP2TNLP.
Definition at line 41 of file BonTMINLP2Quad.hpp.
References TMINLP2TNLPQuadCuts().
virtual bool Bonmin::TMINLP2TNLPQuadCuts::get_nlp_info | ( | Ipopt::Index & | n, | |
Ipopt::Index & | m, | |||
Ipopt::Index & | nnz_jac_g, | |||
Ipopt::Index & | nnz_h_lag, | |||
Ipopt::TNLP::IndexStyleEnum & | index_style | |||
) | [virtual] |
This call is just passed onto parent class and add number of quadratic cuts.
virtual bool Bonmin::TMINLP2TNLPQuadCuts::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 | |||
) | [virtual] |
This call is just passed onto parent class and add bounds of quadratic cuts.
Reimplemented from Bonmin::TMINLP2TNLP.
virtual bool Bonmin::TMINLP2TNLPQuadCuts::get_constraints_linearity | ( | Ipopt::Index | m, | |
Ipopt::TNLP::LinearityType * | const_types | |||
) | [virtual] |
This call is just passed onto parent class and add number of quadratic cuts.
virtual bool Bonmin::TMINLP2TNLPQuadCuts::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 | |||
) | [virtual] |
This call is just passed onto parent class and add lambda for quadratic cuts.
Reimplemented from Bonmin::TMINLP2TNLP.
virtual bool Bonmin::TMINLP2TNLPQuadCuts::get_scaling_parameters | ( | Ipopt::Number & | obj_scaling, | |
bool & | use_x_scaling, | |||
Ipopt::Index | n, | |||
Ipopt::Number * | x_scaling, | |||
bool & | use_g_scaling, | |||
Ipopt::Index | m, | |||
Ipopt::Number * | g_scaling | |||
) | [virtual] |
Method that returns scaling parameters (passed to parent all quadratic not scaled).
Reimplemented from Bonmin::TMINLP2TNLP.
virtual bool Bonmin::TMINLP2TNLPQuadCuts::eval_f | ( | Ipopt::Index | n, | |
const Ipopt::Number * | x, | |||
bool | new_x, | |||
Ipopt::Number & | obj_value | |||
) | [virtual] |
virtual bool Bonmin::TMINLP2TNLPQuadCuts::eval_grad_f | ( | Ipopt::Index | n, | |
const Ipopt::Number * | x, | |||
bool | new_x, | |||
Ipopt::Number * | grad_f | |||
) | [virtual] |
Returns the vector of the gradient of the objective w.r.t.
x
Reimplemented from Bonmin::TMINLP2TNLP.
virtual bool Bonmin::TMINLP2TNLPQuadCuts::eval_g | ( | Ipopt::Index | n, | |
const Ipopt::Number * | x, | |||
bool | new_x, | |||
Ipopt::Index | m, | |||
Ipopt::Number * | g | |||
) | [virtual] |
Returns the vector of constraint values in x (appends constraint values for quadratics).
Reimplemented from Bonmin::TMINLP2TNLP.
virtual bool Bonmin::TMINLP2TNLPQuadCuts::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 | |||
) | [virtual] |
Returns the jacobian of the constraints.
The vectors iRow and jCol only need to be set once. The first call is used to set the structure only (iRow and jCol will be non-NULL, and values will be NULL) For subsequent calls, iRow and jCol will be NULL.
Reimplemented from Bonmin::TMINLP2TNLP.
virtual bool Bonmin::TMINLP2TNLPQuadCuts::eval_gi | ( | Ipopt::Index | n, | |
const Ipopt::Number * | x, | |||
bool | new_x, | |||
Ipopt::Index | i, | |||
Ipopt::Number & | gi | |||
) | [virtual] |
virtual bool Bonmin::TMINLP2TNLPQuadCuts::eval_grad_gi | ( | Ipopt::Index | n, | |
const Ipopt::Number * | x, | |||
bool | new_x, | |||
Ipopt::Index | i, | |||
Ipopt::Index & | nele_grad_gi, | |||
Ipopt::Index * | jCol, | |||
Ipopt::Number * | values | |||
) | [virtual] |
compute the structure or values of the gradient for one constraint
Reimplemented from Bonmin::TMINLP2TNLP.
virtual bool Bonmin::TMINLP2TNLPQuadCuts::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 | |||
) | [virtual] |
Return the hessian of the lagrangian.
The vectors iRow and jCol only need to be set once (during the first call). The first call is used to set the structure only (iRow and jCol will be non-NULL, and values will be NULL) For subsequent calls, iRow and jCol will be NULL. This matrix is symmetric - specify the lower diagonal only
Reimplemented from Bonmin::TMINLP2TNLP.
void Bonmin::TMINLP2TNLPQuadCuts::addCuts | ( | const Cuts & | cuts, | |
bool | safe | |||
) |
Method to add quadratic cuts .
Definition at line 344 of file BonTMINLP2Quad.cpp.
References addRowCuts(), curr_nnz_jac_, Bonmin::TMINLP2TNLP::duals_init_, Bonmin::TMINLP2TNLP::duals_sol_, Bonmin::TMINLP2TNLP::g_l_, Bonmin::TMINLP2TNLP::g_u_, H_, Bonmin::TMINLP2TNLP::index_style(), Bonmin::Cuts::quadCut(), quadRows_, Bonmin::Cuts::sizeQuadCuts(), Bonmin::TMINLP2TNLP::x_init_, and Bonmin::TMINLP2TNLP::x_l_.
Referenced by addCuts().
void Bonmin::TMINLP2TNLPQuadCuts::addCuts | ( | const OsiCuts & | cuts | ) | [virtual] |
Method to add OsiCuts figuring out which is quadratic (slow!).
Reimplemented from Bonmin::TMINLP2TNLP.
Definition at line 397 of file BonTMINLP2Quad.cpp.
References addCuts(), and addRowCuts().
void Bonmin::TMINLP2TNLPQuadCuts::addCuts | ( | unsigned int | numcuts, | |
const OsiRowCut ** | cuts | |||
) | [virtual] |
Method to add array of OsiRowCut figuring out which is quadratic (slow!).
Reimplemented from Bonmin::TMINLP2TNLP.
Definition at line 370 of file BonTMINLP2Quad.cpp.
References curr_nnz_jac_, Bonmin::TMINLP2TNLP::duals_init_, Bonmin::TMINLP2TNLP::duals_sol_, Bonmin::TMINLP2TNLP::g_l_, Bonmin::TMINLP2TNLP::g_u_, H_, Bonmin::TMINLP2TNLP::index_style(), quadRows_, Bonmin::TMINLP2TNLP::x_init_, and Bonmin::TMINLP2TNLP::x_l_.
void Bonmin::TMINLP2TNLPQuadCuts::removeCuts | ( | unsigned int | number, | |
const int * | toRemove | |||
) | [virtual] |
Method which removes a set of cuts.
Reimplemented from Bonmin::TMINLP2TNLP.
Definition at line 444 of file BonTMINLP2Quad.cpp.
References curr_nnz_jac_, Bonmin::TMINLP2TNLP::g_l(), Bonmin::TMINLP2TNLP::g_l_, Bonmin::TMINLP2TNLP::g_u(), Bonmin::TMINLP2TNLP::g_u_, H_, k, Bonmin::TMINLP2TNLP::num_constraints(), and quadRows_.
void Bonmin::TMINLP2TNLPQuadCuts::set_linear_objective | ( | int | n_var, | |
const double * | obj, | |||
double | c_0 | |||
) |
Change objective to a linear one whith given objective function.
Definition at line 493 of file BonTMINLP2Quad.cpp.
References c_, Bonmin::TMINLP2TNLP::num_variables(), and obj_.
void Bonmin::TMINLP2TNLPQuadCuts::reset_objective | ( | ) | [inline] |
Reset objective to original one.
Definition at line 148 of file BonTMINLP2Quad.hpp.
References obj_.
void Bonmin::TMINLP2TNLPQuadCuts::addRowCuts | ( | const OsiCuts & | cuts, | |
bool | safe | |||
) | [protected] |
Method to add OsiCuts eventualy figuring out which is quadratic.
Definition at line 411 of file BonTMINLP2Quad.cpp.
References curr_nnz_jac_, Bonmin::TMINLP2TNLP::duals_init_, Bonmin::TMINLP2TNLP::duals_sol_, Bonmin::TMINLP2TNLP::g_l_, Bonmin::TMINLP2TNLP::g_u_, H_, Bonmin::TMINLP2TNLP::index_style(), quadRows_, Bonmin::TMINLP2TNLP::x_init_, and Bonmin::TMINLP2TNLP::x_l_.
Referenced by addCuts().
TMINLP2TNLPQuadCuts& Bonmin::TMINLP2TNLPQuadCuts::operator= | ( | const TMINLP2TNLP & | ) | [protected] |
void Bonmin::TMINLP2TNLPQuadCuts::printH | ( | ) | [private] |
vector<QuadRow *> Bonmin::TMINLP2TNLPQuadCuts::quadRows_ [private] |
Some storage for quadratic cuts.
Definition at line 172 of file BonTMINLP2Quad.hpp.
Referenced by addCuts(), addRowCuts(), removeCuts(), TMINLP2TNLPQuadCuts(), and ~TMINLP2TNLPQuadCuts().
AdjustableMat Bonmin::TMINLP2TNLPQuadCuts::H_ [private] |
Storage for the original hessian of the problem.
Definition at line 175 of file BonTMINLP2Quad.hpp.
Referenced by addCuts(), addRowCuts(), printH(), removeCuts(), and TMINLP2TNLPQuadCuts().
int Bonmin::TMINLP2TNLPQuadCuts::curr_nnz_jac_ [private] |
Current umber of entries in the jacobian.
Definition at line 180 of file BonTMINLP2Quad.hpp.
Referenced by addCuts(), addRowCuts(), and removeCuts().
vector<double> Bonmin::TMINLP2TNLPQuadCuts::obj_ [private] |
Store user passed linear objective.
Definition at line 183 of file BonTMINLP2Quad.hpp.
Referenced by reset_objective(), and set_linear_objective().
double Bonmin::TMINLP2TNLPQuadCuts::c_ [private] |
constant term in objective function.
Definition at line 185 of file BonTMINLP2Quad.hpp.
Referenced by set_linear_objective().