Bonmin  1.8.7
Public Member Functions | 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:
+ Collaboration diagram for Bonmin::TMINLPLinObj:

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 int * get_const_xtra_id () const
 Access array describing constraint to which perspectives should be applied. More...
 
 TMINLP ()
 
virtual ~TMINLP ()
 Default destructor. More...
 
- Public Member Functions inherited from Ipopt::ReferencedObject
 ReferencedObject ()
 
virtual ~ReferencedObject ()
 
Index ReferenceCount () const
 
void AddRef (const Referencer *referencer) const
 
void ReleaseRef (const Referencer *referencer) const
 

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 \begin{array}{l} \min \eta\ s.t\ -\infty \leq f(x) - \eta \leq 0\ g_l \leq g(x) \leq g_u\ x_l \leq x \leq u \end{array} \f] 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

◆ TMINLPLinObj()

Bonmin::TMINLPLinObj::TMINLPLinObj ( )

Default constructor.

◆ ~TMINLPLinObj()

virtual Bonmin::TMINLPLinObj::~TMINLPLinObj ( )
virtual

destructor.

Member Function Documentation

◆ setTminlp()

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

set reference TMINLP

◆ get_nlp_info()

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.

◆ get_scaling_parameters()

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.

◆ get_variables_types()

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.

◆ get_constraints_linearity()

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.

◆ get_bounds_info()

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.

◆ get_starting_point()

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.

◆ eval_f()

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.

◆ eval_grad_f()

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.

◆ eval_g()

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.

◆ eval_jac_g()

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.

◆ eval_h()

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.

◆ eval_gi()

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.

◆ eval_grad_gi()

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.

◆ get_variables_linearity()

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.

◆ finalize_solution()

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.

◆ branchingInfo()

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

Use tminlp_ function.

Implements Bonmin::TMINLP.

Definition at line 165 of file BonTMINLPLinObj.hpp.

◆ sosConstraints()

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.

◆ perturbInfo()

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

Use tminlp_ function.

Reimplemented from Bonmin::TMINLP.

Definition at line 175 of file BonTMINLPLinObj.hpp.

◆ hasUpperBoundingObjective()

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

Use tminlp_ function.

Reimplemented from Bonmin::TMINLP.

Definition at line 181 of file BonTMINLPLinObj.hpp.

◆ eval_upper_bound_f()

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.

◆ hasLinearObjective()

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.

◆ tminlp()

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

return pointer to tminlp_.

Definition at line 194 of file BonTMINLPLinObj.hpp.


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