Bonmin
1.7
|
This is a derived class fro TMINLP2TNLP to handle adding quadratic cuts. More...
#include <BonTMINLP2Quad.hpp>
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) | |
Copy Constructor. | |
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) |
Add some linear or quadratic cuts to the problem formulation if some of the OsiRowCuts are quadratic they will be well understood as long as safe is true. | |
void | addCuts (const OsiCuts &cuts) |
Add some cuts to the problem formulaiton (handles Quadratics). | |
virtual void | addCuts (unsigned int numberCuts, const OsiRowCut **cuts) |
Add some linear cuts to the problem formulation. | |
void | removeCuts (unsigned int number, const int *toRemove) |
Remove some cuts from the formulation. | |
Protected Member Functions | |
void | addRowCuts (const OsiCuts &cuts, bool safe) |
Add some cuts to the problem formulaiton (handles Quadratics). | |
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. |
This is a derived class fro TMINLP2TNLP to handle adding quadratic cuts.
Definition at line 22 of file BonTMINLP2Quad.hpp.
Bonmin::TMINLP2TNLPQuadCuts::TMINLP2TNLPQuadCuts | ( | const Ipopt::SmartPtr< Bonmin::TMINLP > | tminlp | ) |
Copy Constructor.
Bonmin::TMINLP2TNLPQuadCuts::TMINLP2TNLPQuadCuts | ( | const TMINLP2TNLPQuadCuts & | ) |
Copy Constructor.
virtual Bonmin::TMINLP2TNLPQuadCuts::~TMINLP2TNLPQuadCuts | ( | ) | [virtual] |
Destructor.
Bonmin::TMINLP2TNLPQuadCuts::TMINLP2TNLPQuadCuts | ( | ) | [protected] |
Default Constructor.
Referenced by clone().
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] |
Returns the value of the objective function in x.
Reimplemented from Bonmin::TMINLP2TNLP.
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] |
compute the value of a single constraint
Reimplemented from Bonmin::TMINLP2TNLP.
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 | ||
) |
Add some linear or quadratic cuts to the problem formulation if some of the OsiRowCuts are quadratic they will be well understood as long as safe is true.
void Bonmin::TMINLP2TNLPQuadCuts::addCuts | ( | const OsiCuts & | cuts | ) | [virtual] |
Add some cuts to the problem formulaiton (handles Quadratics).
Reimplemented from Bonmin::TMINLP2TNLP.
virtual void Bonmin::TMINLP2TNLPQuadCuts::addCuts | ( | unsigned int | numberCuts, |
const OsiRowCut ** | cuts | ||
) | [virtual] |
Add some linear cuts to the problem formulation.
Reimplemented from Bonmin::TMINLP2TNLP.
void Bonmin::TMINLP2TNLPQuadCuts::removeCuts | ( | unsigned int | number, |
const int * | toRemove | ||
) | [virtual] |
Remove some cuts from the formulation.
Reimplemented from Bonmin::TMINLP2TNLP.
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.
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] |
Add some cuts to the problem formulaiton (handles Quadratics).
TMINLP2TNLPQuadCuts& Bonmin::TMINLP2TNLPQuadCuts::operator= | ( | const TMINLP2TNLP & | ) | [protected] |
Overloaded Equals Operator.
Reimplemented from Bonmin::TMINLP2TNLP.
void Bonmin::TMINLP2TNLPQuadCuts::printH | ( | ) | [private] |
print H_ for debug.
vector<QuadRow *> Bonmin::TMINLP2TNLPQuadCuts::quadRows_ [private] |
Some storage for quadratic cuts.
Definition at line 172 of file BonTMINLP2Quad.hpp.
AdjustableMat Bonmin::TMINLP2TNLPQuadCuts::H_ [private] |
Storage for the original hessian of the problem.
Definition at line 175 of file BonTMINLP2Quad.hpp.
int Bonmin::TMINLP2TNLPQuadCuts::curr_nnz_jac_ [private] |
Current umber of entries in the jacobian.
Definition at line 180 of file BonTMINLP2Quad.hpp.
vector<double> Bonmin::TMINLP2TNLPQuadCuts::obj_ [private] |
Store user passed linear objective.
Definition at line 183 of file BonTMINLP2Quad.hpp.
Referenced by reset_objective().
double Bonmin::TMINLP2TNLPQuadCuts::c_ [private] |
constant term in objective function.
Definition at line 185 of file BonTMINLP2Quad.hpp.