Bonmin 1.8.9
Loading...
Searching...
No Matches
List of all members
Bonmin::TNLP2FPNLP Class Reference

This is an adapter class to convert an NLP to a Feasibility Pump NLP by changing the objective function to the (2-norm) distance to a point. More...

#include <BonTNLP2FPNLP.hpp>

+ Inheritance diagram for Bonmin::TNLP2FPNLP:
+ Collaboration diagram for Bonmin::TNLP2FPNLP:

Public Member Functions

Constructors/Destructors
 TNLP2FPNLP (const Ipopt::SmartPtr< Ipopt::TNLP > tnlp, double objectiveScalingFactor=100)
 Build using tnlp as source problem.
 
 TNLP2FPNLP (const Ipopt::SmartPtr< TNLP > tnlp, const Ipopt::SmartPtr< TNLP2FPNLP > other)
 Build using tnlp as source problem and using other for all other parameters.
 
virtual ~TNLP2FPNLP ()
 Default destructor.
 
void use (Ipopt::SmartPtr< TNLP > tnlp)
 
Methods to select the objective function and extra constraints
void set_use_feasibility_pump_objective (bool use_feasibility_pump_objective)
 Flag to indicate that we want to use the feasibility pump objective.
 
void set_use_cutoff_constraint (bool use_cutoff_constraint)
 Flag to indicate that we want to use a cutoff constraint This constraint has the form f(x) <= (1-epsilon) f(x')
 
void set_use_local_branching_constraint (bool use_local_branching_constraint)
 Flag to indicate that we want to use a local branching constraint.
 
Methods to provide the rhs of the extra constraints
void set_cutoff (Ipopt::Number cutoff)
 Set the cutoff value to use in the cutoff constraint.
 
void set_rhs_local_branching_constraint (double rhs_local_branching_constraint)
 Set the rhs of the local branching constraint.
 
Methods to change the objective function
void set_dist_to_point_obj (size_t n, const Ipopt::Number *vals, const Ipopt::Index *inds)
 Set the point to which distance is minimized.
 
void setSigma (double sigma)
 Set the value for sigma.
 
void setLambda (double lambda)
 Set the value for lambda.
 
void setNorm (int norm)
 Set the value for simgma.
 
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)
 get info from nlp_ and add hessian information
 
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 tnlp_.
 
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)
 Passed onto tnlp_.
 
virtual bool eval_f (Ipopt::Index n, const Ipopt::Number *x, bool new_x, Ipopt::Number &obj_value)
 overloaded to 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)
 overload this method to 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)
 overload to return the values of the left-hand side of the constraints
 
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)
 overload to return the jacobian of g
 
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)
 Evaluate the modified Hessian of the Lagrangian.
 
Solution Methods
virtual void finalize_solution (Ipopt::SolverReturn status, Ipopt::Index n, const Ipopt::Number *x, const Ipopt::Number *z_L, const Ipopt::Number *z_U, Ipopt::Index m, const Ipopt::Number *g, const Ipopt::Number *lambda, Ipopt::Number obj_value, const Ipopt::IpoptData *ip_data, Ipopt::IpoptCalculatedQuantities *ip_cq)
 This method is called when the algorithm is complete so the TNLP can store/write the solution.
 
virtual bool get_variables_linearity (Ipopt::Index n, LinearityType *var_types)
 
virtual bool get_constraints_linearity (Ipopt::Index m, LinearityType *const_types)
 overload this method to return the constraint linearity.
 
Scaling of the objective function
void setObjectiveScaling (double value)
 
double getObjectiveScaling () const
 
- Public Member Functions inherited from Ipopt::TNLP
 DECLARE_STD_EXCEPTION (INVALID_TNLP)
 
 TNLP ()
 
virtual ~TNLP ()
 
virtual bool get_var_con_metadata (Index n, StringMetaDataMapType &var_string_md, IntegerMetaDataMapType &var_integer_md, NumericMetaDataMapType &var_numeric_md, Index m, StringMetaDataMapType &con_string_md, IntegerMetaDataMapType &con_integer_md, NumericMetaDataMapType &con_numeric_md)
 
virtual bool get_scaling_parameters (Number &obj_scaling, bool &use_x_scaling, Index n, Number *x_scaling, bool &use_g_scaling, Index m, Number *g_scaling)
 
virtual bool get_warm_start_iterate (IteratesVector &warm_start_iterate)
 
virtual Index get_number_of_nonlinear_variables ()
 
virtual bool get_list_of_nonlinear_variables (Index num_nonlin_vars, Index *pos_nonlin_vars)
 
virtual void finalize_metadata (Index n, const StringMetaDataMapType &var_string_md, const IntegerMetaDataMapType &var_integer_md, const NumericMetaDataMapType &var_numeric_md, Index m, const StringMetaDataMapType &con_string_md, const IntegerMetaDataMapType &con_integer_md, const NumericMetaDataMapType &con_numeric_md)
 
virtual bool intermediate_callback (AlgorithmMode mode, Index iter, Number obj_value, Number inf_pr, Number inf_du, Number mu, Number d_norm, Number regularization_size, Number alpha_du, Number alpha_pr, Index ls_trials, const IpoptData *ip_data, IpoptCalculatedQuantities *ip_cq)
 
bool get_curr_iterate (const IpoptData *ip_data, IpoptCalculatedQuantities *ip_cq, bool scaled, Index n, Number *x, Number *z_L, Number *z_U, Index m, Number *g, Number *lambda) const
 
bool get_curr_violations (const IpoptData *ip_data, IpoptCalculatedQuantities *ip_cq, bool scaled, Index n, Number *x_L_violation, Number *x_U_violation, Number *compl_x_L, Number *compl_x_U, Number *grad_lag_x, Index m, Number *nlp_constraint_violation, Number *compl_g) const
 
 TNLP ()
 
virtual ~TNLP ()
 
virtual bool get_var_con_metadata (Index n, StringMetaDataMapType &var_string_md, IntegerMetaDataMapType &var_integer_md, NumericMetaDataMapType &var_numeric_md, Index m, StringMetaDataMapType &con_string_md, IntegerMetaDataMapType &con_integer_md, NumericMetaDataMapType &con_numeric_md)
 
virtual bool get_scaling_parameters (Number &obj_scaling, bool &use_x_scaling, Index n, Number *x_scaling, bool &use_g_scaling, Index m, Number *g_scaling)
 
virtual bool get_warm_start_iterate (IteratesVector &warm_start_iterate)
 
virtual Index get_number_of_nonlinear_variables ()
 
virtual bool get_list_of_nonlinear_variables (Index num_nonlin_vars, Index *pos_nonlin_vars)
 
virtual void finalize_metadata (Index n, const StringMetaDataMapType &var_string_md, const IntegerMetaDataMapType &var_integer_md, const NumericMetaDataMapType &var_numeric_md, Index m, const StringMetaDataMapType &con_string_md, const IntegerMetaDataMapType &con_integer_md, const NumericMetaDataMapType &con_numeric_md)
 
virtual bool intermediate_callback (AlgorithmMode mode, Index iter, Number obj_value, Number inf_pr, Number inf_du, Number mu, Number d_norm, Number regularization_size, Number alpha_du, Number alpha_pr, Index ls_trials, const IpoptData *ip_data, IpoptCalculatedQuantities *ip_cq)
 
bool get_curr_iterate (const IpoptData *ip_data, IpoptCalculatedQuantities *ip_cq, bool scaled, Index n, Number *x, Number *z_L, Number *z_U, Index m, Number *g, Number *lambda) const
 
bool get_curr_violations (const IpoptData *ip_data, IpoptCalculatedQuantities *ip_cq, bool scaled, Index n, Number *x_L_violation, Number *x_U_violation, Number *compl_x_L, Number *compl_x_U, Number *grad_lag_x, Index m, Number *nlp_constraint_violation, Number *compl_g) const
 
- 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 Ipopt::TNLP
enum  LinearityType
 
enum  IndexStyleEnum
 
typedef std::map< std::string, std::vector< std::string > > StringMetaDataMapType
 
typedef std::map< std::string, std::vector< Index > > IntegerMetaDataMapType
 
typedef std::map< std::string, std::vector< Number > > NumericMetaDataMapType
 
- Public Attributes inherited from Ipopt::TNLP
 LINEAR
 
 NON_LINEAR
 
 C_STYLE
 
 FORTRAN_STYLE
 

Detailed Description

This is an adapter class to convert an NLP to a Feasibility Pump NLP by changing the objective function to the (2-norm) distance to a point.

The extra function is set_dist_to_point_obj(size_t n, const double *, const int *)

Definition at line 22 of file BonTNLP2FPNLP.hpp.

Constructor & Destructor Documentation

◆ TNLP2FPNLP() [1/2]

Bonmin::TNLP2FPNLP::TNLP2FPNLP ( const Ipopt::SmartPtr< Ipopt::TNLP > tnlp,
double objectiveScalingFactor = 100 )

Build using tnlp as source problem.

◆ TNLP2FPNLP() [2/2]

Bonmin::TNLP2FPNLP::TNLP2FPNLP ( const Ipopt::SmartPtr< TNLP > tnlp,
const Ipopt::SmartPtr< TNLP2FPNLP > other )

Build using tnlp as source problem and using other for all other parameters.

◆ ~TNLP2FPNLP()

virtual Bonmin::TNLP2FPNLP::~TNLP2FPNLP ( )
virtual

Default destructor.

Member Function Documentation

◆ use()

void Bonmin::TNLP2FPNLP::use ( Ipopt::SmartPtr< TNLP > tnlp)
inline

Definition at line 36 of file BonTNLP2FPNLP.hpp.

◆ set_use_feasibility_pump_objective()

void Bonmin::TNLP2FPNLP::set_use_feasibility_pump_objective ( bool use_feasibility_pump_objective)
inline

Flag to indicate that we want to use the feasibility pump objective.

Definition at line 41 of file BonTNLP2FPNLP.hpp.

◆ set_use_cutoff_constraint()

void Bonmin::TNLP2FPNLP::set_use_cutoff_constraint ( bool use_cutoff_constraint)
inline

Flag to indicate that we want to use a cutoff constraint This constraint has the form f(x) <= (1-epsilon) f(x')

Definition at line 46 of file BonTNLP2FPNLP.hpp.

◆ set_use_local_branching_constraint()

void Bonmin::TNLP2FPNLP::set_use_local_branching_constraint ( bool use_local_branching_constraint)
inline

Flag to indicate that we want to use a local branching constraint.

Definition at line 50 of file BonTNLP2FPNLP.hpp.

◆ set_cutoff()

void Bonmin::TNLP2FPNLP::set_cutoff ( Ipopt::Number cutoff)

Set the cutoff value to use in the cutoff constraint.

◆ set_rhs_local_branching_constraint()

void Bonmin::TNLP2FPNLP::set_rhs_local_branching_constraint ( double rhs_local_branching_constraint)
inline

Set the rhs of the local branching constraint.

Definition at line 60 of file BonTNLP2FPNLP.hpp.

◆ set_dist_to_point_obj()

void Bonmin::TNLP2FPNLP::set_dist_to_point_obj ( size_t n,
const Ipopt::Number * vals,
const Ipopt::Index * inds )

Set the point to which distance is minimized.

The distance is minimize in a subspace define by a subset of coordinates

Parameters
nnumber of coordinates on which distance is minimized
indsindices of the coordinates on which distance is minimized
valsvalues of the point for coordinates in ind

◆ setSigma()

void Bonmin::TNLP2FPNLP::setSigma ( double sigma)
inline

Set the value for sigma.

Definition at line 76 of file BonTNLP2FPNLP.hpp.

◆ setLambda()

void Bonmin::TNLP2FPNLP::setLambda ( double lambda)
inline

Set the value for lambda.

Definition at line 80 of file BonTNLP2FPNLP.hpp.

◆ setNorm()

void Bonmin::TNLP2FPNLP::setNorm ( int norm)
inline

Set the value for simgma.

Definition at line 84 of file BonTNLP2FPNLP.hpp.

◆ get_nlp_info()

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

get info from nlp_ and add hessian information

Implements Ipopt::TNLP.

◆ get_bounds_info()

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

Implements Ipopt::TNLP.

◆ get_starting_point()

virtual bool Bonmin::TNLP2FPNLP::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 )
inlinevirtual

Passed onto tnlp_.

Implements Ipopt::TNLP.

Definition at line 102 of file BonTNLP2FPNLP.hpp.

◆ eval_f()

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

overloaded to return the value of the objective function

Implements Ipopt::TNLP.

◆ eval_grad_f()

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

overload this method to return the vector of the gradient of the objective w.r.t.

x

Implements Ipopt::TNLP.

◆ eval_g()

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

overload to return the values of the left-hand side of the constraints

Implements Ipopt::TNLP.

◆ eval_jac_g()

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

overload to return the jacobian of g

Implements Ipopt::TNLP.

◆ eval_h()

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

Evaluate the modified Hessian of the Lagrangian.

Reimplemented from Ipopt::TNLP.

◆ finalize_solution()

virtual void Bonmin::TNLP2FPNLP::finalize_solution ( Ipopt::SolverReturn status,
Ipopt::Index n,
const Ipopt::Number * x,
const Ipopt::Number * z_L,
const Ipopt::Number * z_U,
Ipopt::Index m,
const Ipopt::Number * g,
const Ipopt::Number * lambda,
Ipopt::Number obj_value,
const Ipopt::IpoptData * ip_data,
Ipopt::IpoptCalculatedQuantities * ip_cq )
virtual

This method is called when the algorithm is complete so the TNLP can store/write the solution.

Implements Ipopt::TNLP.

◆ get_variables_linearity()

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

Reimplemented from Ipopt::TNLP.

Definition at line 158 of file BonTNLP2FPNLP.hpp.

◆ get_constraints_linearity()

virtual bool Bonmin::TNLP2FPNLP::get_constraints_linearity ( Ipopt::Index m,
LinearityType * const_types )
inlinevirtual

overload this method to return the constraint linearity.

array should be alocated with length at least n. (default implementation just return false and does not fill the array).

Reimplemented from Ipopt::TNLP.

Definition at line 166 of file BonTNLP2FPNLP.hpp.

◆ setObjectiveScaling()

void Bonmin::TNLP2FPNLP::setObjectiveScaling ( double value)
inline

Definition at line 181 of file BonTNLP2FPNLP.hpp.

◆ getObjectiveScaling()

double Bonmin::TNLP2FPNLP::getObjectiveScaling ( ) const
inline

Definition at line 185 of file BonTNLP2FPNLP.hpp.


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