Bonmin  1.7
Public Member Functions | Private Member Functions | Private Attributes
Bonmin::TMINLPLinObj Class Reference

From a TMINLP, this class adapts to another TMINLP where the original objective is transformed into a constraint by adding an extra variable which is minimized. More...

#include <BonTMINLPLinObj.hpp>

Inheritance diagram for Bonmin::TMINLPLinObj:
Bonmin::TMINLP

List of all members.

Public Member Functions

 TMINLPLinObj ()
 Default constructor.
virtual ~TMINLPLinObj ()
 destructor.
void setTminlp (Ipopt::SmartPtr< TMINLP > tminlp)
 set reference TMINLP
virtual bool get_variables_linearity (Ipopt::Index n, Ipopt::TNLP::LinearityType *c)
 overload this method to provide the variables linearity.
virtual const BranchingInfobranchingInfo () const
 Use tminlp_ function.
virtual const SosInfososConstraints () const
 Use tminlp_ function.
virtual const PerturbInfoperturbInfo () const
 Use tminlp_ function.
virtual bool hasUpperBoundingObjective ()
 Use tminlp_ function.
virtual bool eval_upper_bound_f (Ipopt::Index n, const Ipopt::Number *x, Ipopt::Number &obj_value)
 Use tminlp_ function.
virtual bool hasLinearObjective ()
 Say if problem has a linear objective (for OA)
Ipopt::SmartPtr< TMINLPtminlp ()
 return pointer to tminlp_.
methods to gather information about the MINLP
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)
 Return the number of variables and constraints, and the number of non-zeros in the jacobian and the hessian.
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)
 Return scaling parameters.
virtual bool get_variables_types (Ipopt::Index n, VariableType *var_types)
 Get the variable type.
virtual bool get_constraints_linearity (Ipopt::Index m, Ipopt::TNLP::LinearityType *const_types)
 Return the constraints linearity.
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)
 Return the information about the bound on the variables and constraints.
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)
 Return the starting point.
virtual bool eval_f (Ipopt::Index n, const Ipopt::Number *x, bool new_x, Ipopt::Number &obj_value)
 Return the value of the objective function.
virtual bool eval_grad_f (Ipopt::Index n, const Ipopt::Number *x, bool new_x, Ipopt::Number *grad_f)
 Return 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)
 Return the vector of constraint values.
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)
 Return the jacobian of the constraints.
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.
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.
Solution Methods
virtual void finalize_solution (TMINLP::SolverReturn status, Ipopt::Index n, const Ipopt::Number *x, Ipopt::Number obj_value)
 Use tminlp_ function.

Private Member Functions

void gutsOfDestructor ()
 Reset all data.

Private Attributes

Ipopt::SmartPtr< TMINLPtminlp_
 Reference TMINLP which is to be relaxed.
int m_
 Ipopt::Number of constraints in the transformed MINLP.
int n_
 Ipopt::Number of variables in the transformed MINLP.
int nnz_jac_
 number of non-zeroes in the jacobian of the transformed MINLP.
int offset_
 offset for jacobian.

Detailed Description

From a TMINLP, this class adapts to another TMINLP where the original objective is transformed into a constraint by adding an extra variable which is minimized.

More precisely

\[ \begin{array}{l} \min f(x)\\ s.t\\ g_l \leq g(x) \leq g_u\\ x_l \leq x \leq u \end{array} \]

is transformed ino {array}{l} \ s.t\ - f(x) - 0\ g_l g(x) g_u\ x_l x u {array} ] The objective is put as first constraint of the problem and the extra variable is the last one.

Definition at line 39 of file BonTMINLPLinObj.hpp.


Constructor & Destructor Documentation

Bonmin::TMINLPLinObj::TMINLPLinObj ( )

Default constructor.

virtual Bonmin::TMINLPLinObj::~TMINLPLinObj ( ) [virtual]

destructor.


Member Function Documentation

void Bonmin::TMINLPLinObj::setTminlp ( Ipopt::SmartPtr< TMINLP tminlp)

set reference TMINLP

virtual bool Bonmin::TMINLPLinObj::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]

Return the number of variables and constraints, and the number of non-zeros in the jacobian and the hessian.

Call tminlp_ one but number of constraints and non-zeroes in the jacobian is stored internally.

Implements Bonmin::TMINLP.

virtual bool Bonmin::TMINLPLinObj::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]

Return scaling parameters.

If tminlp_ method returns true, translate constraint scaling (if asked).

Reimplemented from Bonmin::TMINLP.

virtual bool Bonmin::TMINLPLinObj::get_variables_types ( Ipopt::Index  n,
VariableType var_types 
) [inline, virtual]

Get the variable type.

Just call tminlp_'s method;.

Implements Bonmin::TMINLP.

Definition at line 68 of file BonTMINLPLinObj.hpp.

References Bonmin::TMINLP::CONTINUOUS, n_, and tminlp_.

virtual bool Bonmin::TMINLPLinObj::get_constraints_linearity ( Ipopt::Index  m,
Ipopt::TNLP::LinearityType *  const_types 
) [virtual]

Return the constraints linearity.

Call tminlp_'s method and translate.

Implements Bonmin::TMINLP.

virtual bool Bonmin::TMINLPLinObj::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]

Return the information about the bound on the variables and constraints.

Call tminlp_'s method and translate constraints bounds.

Implements Bonmin::TMINLP.

virtual bool Bonmin::TMINLPLinObj::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]

Return the starting point.

Have to translate z_L and z_U.

Implements Bonmin::TMINLP.

virtual bool Bonmin::TMINLPLinObj::eval_f ( Ipopt::Index  n,
const Ipopt::Number *  x,
bool  new_x,
Ipopt::Number &  obj_value 
) [inline, virtual]

Return the value of the objective function.

Just call tminlp_ method.

Implements Bonmin::TMINLP.

Definition at line 96 of file BonTMINLPLinObj.hpp.

References n_.

virtual bool Bonmin::TMINLPLinObj::eval_grad_f ( Ipopt::Index  n,
const Ipopt::Number *  x,
bool  new_x,
Ipopt::Number *  grad_f 
) [inline, virtual]

Return the vector of the gradient of the objective w.r.t.

x. Just call tminlp_ method.

Implements Bonmin::TMINLP.

Definition at line 104 of file BonTMINLPLinObj.hpp.

References n_, and tminlp_.

virtual bool Bonmin::TMINLPLinObj::eval_g ( Ipopt::Index  n,
const Ipopt::Number *  x,
bool  new_x,
Ipopt::Index  m,
Ipopt::Number *  g 
) [virtual]

Return the vector of constraint values.

Use tminlp_ functions and use mapping to get the needed values.

Implements Bonmin::TMINLP.

virtual bool Bonmin::TMINLPLinObj::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]

Return the jacobian of the constraints.

In first call nothing to change. In later just fix the values for the simple concaves and remove entries corresponding to nonConvex constraints.

Implements Bonmin::TMINLP.

virtual bool Bonmin::TMINLPLinObj::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.

Here we just put lambda in the correct format and call tminlp_'s function.

Implements Bonmin::TMINLP.

virtual bool Bonmin::TMINLPLinObj::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.

The constraint number is i (starting counting from 0.

Reimplemented from Bonmin::TMINLP.

virtual bool Bonmin::TMINLPLinObj::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.

The constraint * number is i (starting counting from 0. Other things are like with eval_jac_g.

Reimplemented from Bonmin::TMINLP.

virtual bool Bonmin::TMINLPLinObj::get_variables_linearity ( Ipopt::Index  n,
Ipopt::TNLP::LinearityType *  var_types 
) [inline, virtual]

overload this method to provide the variables linearity.

array should be allocated with length at least n.

Implements Bonmin::TMINLP.

Definition at line 145 of file BonTMINLPLinObj.hpp.

References n_, and tminlp_.

virtual void Bonmin::TMINLPLinObj::finalize_solution ( TMINLP::SolverReturn  status,
Ipopt::Index  n,
const Ipopt::Number *  x,
Ipopt::Number  obj_value 
) [inline, virtual]

Use tminlp_ function.

Implements Bonmin::TMINLP.

Definition at line 157 of file BonTMINLPLinObj.hpp.

References tminlp_.

virtual const BranchingInfo* Bonmin::TMINLPLinObj::branchingInfo ( ) const [inline, virtual]

Use tminlp_ function.

Implements Bonmin::TMINLP.

Definition at line 165 of file BonTMINLPLinObj.hpp.

References tminlp_.

virtual const SosInfo* Bonmin::TMINLPLinObj::sosConstraints ( ) const [inline, virtual]

Use tminlp_ function.

Bug:
Has to translate sos information.

Implements Bonmin::TMINLP.

Definition at line 171 of file BonTMINLPLinObj.hpp.

References tminlp_.

virtual const PerturbInfo* Bonmin::TMINLPLinObj::perturbInfo ( ) const [inline, virtual]

Use tminlp_ function.

Reimplemented from Bonmin::TMINLP.

Definition at line 175 of file BonTMINLPLinObj.hpp.

References tminlp_.

virtual bool Bonmin::TMINLPLinObj::hasUpperBoundingObjective ( ) [inline, virtual]

Use tminlp_ function.

Reimplemented from Bonmin::TMINLP.

Definition at line 181 of file BonTMINLPLinObj.hpp.

References tminlp_.

virtual bool Bonmin::TMINLPLinObj::eval_upper_bound_f ( Ipopt::Index  n,
const Ipopt::Number *  x,
Ipopt::Number &  obj_value 
) [inline, virtual]

Use tminlp_ function.

Reimplemented from Bonmin::TMINLP.

Definition at line 186 of file BonTMINLPLinObj.hpp.

References tminlp_.

virtual bool Bonmin::TMINLPLinObj::hasLinearObjective ( ) [inline, virtual]

Say if problem has a linear objective (for OA)

Reimplemented from Bonmin::TMINLP.

Definition at line 192 of file BonTMINLPLinObj.hpp.

Ipopt::SmartPtr<TMINLP> Bonmin::TMINLPLinObj::tminlp ( ) [inline]

return pointer to tminlp_.

Definition at line 194 of file BonTMINLPLinObj.hpp.

References tminlp_.

void Bonmin::TMINLPLinObj::gutsOfDestructor ( ) [private]

Reset all data.


Member Data Documentation

Ipopt::SmartPtr<TMINLP> Bonmin::TMINLPLinObj::tminlp_ [private]
int Bonmin::TMINLPLinObj::m_ [private]

Ipopt::Number of constraints in the transformed MINLP.

Definition at line 202 of file BonTMINLPLinObj.hpp.

int Bonmin::TMINLPLinObj::n_ [private]

Ipopt::Number of variables in the transformed MINLP.

Definition at line 204 of file BonTMINLPLinObj.hpp.

Referenced by eval_f(), eval_grad_f(), get_variables_linearity(), and get_variables_types().

number of non-zeroes in the jacobian of the transformed MINLP.

Definition at line 206 of file BonTMINLPLinObj.hpp.

offset for jacobian.

Definition at line 208 of file BonTMINLPLinObj.hpp.


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