Public Member Functions | Private Member Functions | Private Attributes | List of all members
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:
Inheritance graph
[legend]
Collaboration diagram for Bonmin::TMINLPLinObj:
Collaboration graph
[legend]

Public Member Functions

 TMINLPLinObj ()
 Default constructor. More...
 
virtual ~TMINLPLinObj ()
 destructor. More...
 
void setTminlp (Ipopt::SmartPtr< TMINLP > tminlp)
 set reference TMINLP More...
 
virtual bool get_variables_linearity (Ipopt::Index n, Ipopt::TNLP::LinearityType *c)
 overload this method to provide the variables linearity. More...
 
virtual const BranchingInfobranchingInfo () const
 Use tminlp_ function. More...
 
virtual const SosInfososConstraints () const
 Use tminlp_ function. More...
 
virtual const PerturbInfoperturbInfo () const
 Use tminlp_ function. More...
 
virtual bool hasUpperBoundingObjective ()
 Use tminlp_ function. More...
 
virtual bool eval_upper_bound_f (Ipopt::Index n, const Ipopt::Number *x, Ipopt::Number &obj_value)
 Use tminlp_ function. More...
 
virtual bool hasLinearObjective ()
 Say if problem has a linear objective (for OA) More...
 
Ipopt::SmartPtr< TMINLPtminlp ()
 return pointer to tminlp_. More...
 
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. More...
 
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. More...
 
virtual bool get_variables_types (Ipopt::Index n, VariableType *var_types)
 Get the variable type. More...
 
virtual bool get_constraints_linearity (Ipopt::Index m, Ipopt::TNLP::LinearityType *const_types)
 Return the constraints linearity. 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)
 Return the information about the bound on the variables and constraints. 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)
 Return the starting point. More...
 
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. More...
 
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. More...
 
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. 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)
 Return the jacobian of 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)
 Return the hessian of the lagrangian. More...
 
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. More...
 
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. More...
 
Solution Methods
virtual void finalize_solution (TMINLP::SolverReturn status, Ipopt::Index n, const Ipopt::Number *x, Ipopt::Number obj_value)
 Use tminlp_ function. More...
 
- Public Member Functions inherited from Bonmin::TMINLP
virtual bool get_constraint_convexities (int m, TMINLP::Convexity *constraints_convexities) const
 Get accest to constraint convexities. More...
 
virtual bool get_number_nonconvex (int &number_non_conv, int &number_concave) const
 Get dimension information on nonconvex constraints. More...
 
virtual bool get_constraint_convexities (int number_non_conv, MarkedNonConvex *non_convs) const
 Get array describing the constraints marked nonconvex in the model. More...
 
virtual bool get_simple_concave_constraints (int number_concave, SimpleConcaveConstraint *simple_concave) const
 Fill array containing indices of simple concave constraints. More...
 
bool hasGeneralInteger ()
 Say if problem has general integer variables. More...
 
virtual const intget_const_xtra_id () const
 Access array describing constraint to which perspectives should be applied. More...
 
 TMINLP ()
 Default destructor. More...
 
virtual ~TMINLP ()
 Default destructor. More...
 

Private Member Functions

void gutsOfDestructor ()
 Reset all data. More...
 

Private Attributes

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

Additional Inherited Members

- Public Types inherited from Bonmin::TMINLP
enum  SolverReturn {
  SUCCESS, INFEASIBLE, CONTINUOUS_UNBOUNDED, LIMIT_EXCEEDED,
  USER_INTERRUPT, MINLP_ERROR
}
 Return statuses of algorithm. More...
 
enum  VariableType { CONTINUOUS, BINARY, INTEGER }
 Type of the variables. More...
 
enum  Convexity { Convex, NonConvex, SimpleConcave }
 Used to mark constraints of the problem. More...
 
- Protected Member Functions inherited from Bonmin::TMINLP
 TMINLP (const TMINLP &)
 Copy constructor. More...
 
void operator= (const TMINLP &)
 Overloaded Equals Operator. More...
 

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.

Definition at line 15 of file BonTMINLPLinObj.cpp.

Bonmin::TMINLPLinObj::~TMINLPLinObj ( )
virtual

destructor.

Definition at line 26 of file BonTMINLPLinObj.cpp.

Member Function Documentation

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

set reference TMINLP

Definition at line 31 of file BonTMINLPLinObj.cpp.

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.

Definition at line 44 of file BonTMINLPLinObj.cpp.

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.

Definition at line 59 of file BonTMINLPLinObj.cpp.

virtual bool Bonmin::TMINLPLinObj::get_variables_types ( Ipopt::Index  n,
VariableType var_types 
)
inlinevirtual

Get the variable type.

Just call tminlp_'s method;.

Implements Bonmin::TMINLP.

Definition at line 68 of file BonTMINLPLinObj.hpp.

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.

Definition at line 86 of file BonTMINLPLinObj.cpp.

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.

Definition at line 94 of file BonTMINLPLinObj.cpp.

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.

Definition at line 110 of file BonTMINLPLinObj.cpp.

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

Return the value of the objective function.

Just call tminlp_ method.

Implements Bonmin::TMINLP.

Definition at line 96 of file BonTMINLPLinObj.hpp.

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

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.

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.

Definition at line 127 of file BonTMINLPLinObj.cpp.

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.

Definition at line 139 of file BonTMINLPLinObj.cpp.

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.

Definition at line 165 of file BonTMINLPLinObj.cpp.

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.

Definition at line 178 of file BonTMINLPLinObj.cpp.

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.

Definition at line 192 of file BonTMINLPLinObj.cpp.

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

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.

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

Use tminlp_ function.

Implements Bonmin::TMINLP.

Definition at line 157 of file BonTMINLPLinObj.hpp.

virtual const BranchingInfo* Bonmin::TMINLPLinObj::branchingInfo ( ) const
inlinevirtual

Use tminlp_ function.

Implements Bonmin::TMINLP.

Definition at line 165 of file BonTMINLPLinObj.hpp.

virtual const SosInfo* Bonmin::TMINLPLinObj::sosConstraints ( ) const
inlinevirtual

Use tminlp_ function.

Bug:
Has to translate sos information.

Implements Bonmin::TMINLP.

Definition at line 171 of file BonTMINLPLinObj.hpp.

virtual const PerturbInfo* Bonmin::TMINLPLinObj::perturbInfo ( ) const
inlinevirtual

Use tminlp_ function.

Reimplemented from Bonmin::TMINLP.

Definition at line 175 of file BonTMINLPLinObj.hpp.

virtual bool Bonmin::TMINLPLinObj::hasUpperBoundingObjective ( )
inlinevirtual

Use tminlp_ function.

Reimplemented from Bonmin::TMINLP.

Definition at line 181 of file BonTMINLPLinObj.hpp.

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

Use tminlp_ function.

Reimplemented from Bonmin::TMINLP.

Definition at line 186 of file BonTMINLPLinObj.hpp.

virtual bool Bonmin::TMINLPLinObj::hasLinearObjective ( )
inlinevirtual

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.

void Bonmin::TMINLPLinObj::gutsOfDestructor ( )
private

Reset all data.

Definition at line 21 of file BonTMINLPLinObj.cpp.

Member Data Documentation

Ipopt::SmartPtr<TMINLP> Bonmin::TMINLPLinObj::tminlp_
private

Reference TMINLP which is to be relaxed.

Definition at line 200 of file BonTMINLPLinObj.hpp.

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.

int Bonmin::TMINLPLinObj::nnz_jac_
private

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

Definition at line 206 of file BonTMINLPLinObj.hpp.

int Bonmin::TMINLPLinObj::offset_
private

offset for jacobian.

Definition at line 208 of file BonTMINLPLinObj.hpp.


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