Bonmin 1.8.9
Loading...
Searching...
No Matches
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.
 
virtual ~TMINLPLinObj ()
 destructor.
 
void setTminlp (Ipopt::SmartPtr< TMINLP > tminlp)
 set reference 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.
 
virtual bool get_variables_linearity (Ipopt::Index n, Ipopt::TNLP::LinearityType *c)
 overload this method to provide the variables linearity.
 
- Public Member Functions inherited from Bonmin::TMINLP
 TMINLP ()
 
virtual ~TMINLP ()
 Default destructor.
 
virtual bool get_constraint_convexities (int m, TMINLP::Convexity *constraints_convexities) const
 Get accest to constraint convexities.
 
virtual bool get_number_nonconvex (int &number_non_conv, int &number_concave) const
 Get dimension information on nonconvex constraints.
 
virtual bool get_constraint_convexities (int number_non_conv, MarkedNonConvex *non_convs) const
 Get array describing the constraints marked nonconvex in the model.
 
virtual bool get_simple_concave_constraints (int number_concave, SimpleConcaveConstraint *simple_concave) const
 Fill array containing indices of simple concave constraints.
 
bool hasGeneralInteger ()
 Say if problem has general integer variables.
 
virtual const int * get_const_xtra_id () const
 Access array describing constraint to which perspectives should be applied.
 
- 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
 

Solution Methods

virtual void finalize_solution (TMINLP::SolverReturn status, Ipopt::Index n, const Ipopt::Number *x, Ipopt::Number obj_value)
 Use tminlp_ function.
 
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_.
 

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.
 
void operator= (const TMINLP &)
 Overloaded Equals Operator.
 

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: