Bonmin  1.7
Public Member Functions | Private Attributes
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>

List of all members.

Public Member Functions

void use (Ipopt::SmartPtr< TNLP > tnlp)
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.
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.
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.
Scaling of the objective function
void setObjectiveScaling (double value)
double getObjectiveScaling () const

Private Member Functions

Internal methods to help compute the distance, its gradient and hessian
double dist_to_point (const Ipopt::Number *x)
 Compute the norm-2 distance to the current point to which distance is minimized.
Default Compiler Generated Methods

(Hidden to avoid implicit creation/calling).

These methods are not implemented and we do not want the compiler to implement them for us, so we declare them private and do not define them. This ensures that they will not be implicitly created/called.

 TNLP2FPNLP ()
 Default Constructor.
 TNLP2FPNLP (const TNLP2FPNLP &)
 Copy Constructor.
void operator= (const TNLP2FPNLP &)
 Overloaded Equals Operator.

Private Attributes

Ipopt::SmartPtr< TNLP > tnlp_
 pointer to the tminlp that is being adapted
double objectiveScalingFactor_
 Scaling factor for the objective.
Ipopt::TNLP::IndexStyleEnum index_style_
 Ipopt::Index style (C++ or Fortran)
Data for storing the point the distance to which is minimized
vector< Ipopt::Index > inds_
 Indices of the variables for which distance is minimized (i.e. indices of integer variables in a feasibility pump setting)
vector< Ipopt::Number > vals_
 Values of the point to which we separate (if x is the point vals_[i] should be x[inds_[i]] )
double lambda_
 value for the convex combination to take between original objective and distance function.
double sigma_
 Scaling for the original objective.
int norm_
 Norm to use (L_1 or L_2).
Flags to select the objective function and extra constraints
bool use_feasibility_pump_objective_
 Flag to indicate that we want to use the feasibility pump objective.
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')
bool use_local_branching_constraint_
 Flag to indicate that we want to use a local branching constraint.
Data for storing the rhs of the extra constraints
double cutoff_
 Value of best solution known.
double rhs_local_branching_constraint_
 RHS of local branching constraint.

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

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

Build using tnlp as source problem.

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.

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

Default destructor.

Bonmin::TNLP2FPNLP::TNLP2FPNLP ( ) [private]

Default Constructor.

Bonmin::TNLP2FPNLP::TNLP2FPNLP ( const TNLP2FPNLP ) [private]

Copy Constructor.


Member Function Documentation

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

Definition at line 36 of file BonTNLP2FPNLP.hpp.

References tnlp_.

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.

References use_feasibility_pump_objective_.

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.

References use_cutoff_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.

References use_local_branching_constraint_.

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

Set the cutoff value to use in the cutoff 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.

References rhs_local_branching_constraint_.

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
void Bonmin::TNLP2FPNLP::setSigma ( double  sigma) [inline]

Set the value for sigma.

Definition at line 76 of file BonTNLP2FPNLP.hpp.

References sigma_.

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

Set the value for lambda.

Definition at line 80 of file BonTNLP2FPNLP.hpp.

References lambda_.

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

Set the value for simgma.

Definition at line 84 of file BonTNLP2FPNLP.hpp.

References norm_.

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

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_.

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 
) [inline, virtual]

Passed onto tnlp_.

Definition at line 102 of file BonTNLP2FPNLP.hpp.

References tnlp_, use_cutoff_constraint_, and use_local_branching_constraint_.

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

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

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

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

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.

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.

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

Definition at line 158 of file BonTNLP2FPNLP.hpp.

References tnlp_.

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

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).

Definition at line 166 of file BonTNLP2FPNLP.hpp.

References tnlp_, use_cutoff_constraint_, and use_local_branching_constraint_.

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

Definition at line 181 of file BonTNLP2FPNLP.hpp.

References objectiveScalingFactor_.

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

Definition at line 185 of file BonTNLP2FPNLP.hpp.

References objectiveScalingFactor_.

double Bonmin::TNLP2FPNLP::dist_to_point ( const Ipopt::Number *  x) [private]

Compute the norm-2 distance to the current point to which distance is minimized.

void Bonmin::TNLP2FPNLP::operator= ( const TNLP2FPNLP ) [private]

Overloaded Equals Operator.


Member Data Documentation

Ipopt::SmartPtr<TNLP> Bonmin::TNLP2FPNLP::tnlp_ [private]

pointer to the tminlp that is being adapted

Definition at line 215 of file BonTNLP2FPNLP.hpp.

Referenced by get_constraints_linearity(), get_starting_point(), get_variables_linearity(), and use().

vector<Ipopt::Index> Bonmin::TNLP2FPNLP::inds_ [private]

Indices of the variables for which distance is minimized (i.e. indices of integer variables in a feasibility pump setting)

Definition at line 220 of file BonTNLP2FPNLP.hpp.

vector<Ipopt::Number> Bonmin::TNLP2FPNLP::vals_ [private]

Values of the point to which we separate (if x is the point vals_[i] should be x[inds_[i]] )

Definition at line 222 of file BonTNLP2FPNLP.hpp.

double Bonmin::TNLP2FPNLP::lambda_ [private]

value for the convex combination to take between original objective and distance function.

( take lambda_ * distance + (1-lambda) sigma f(x).

Definition at line 225 of file BonTNLP2FPNLP.hpp.

Referenced by setLambda().

double Bonmin::TNLP2FPNLP::sigma_ [private]

Scaling for the original objective.

Definition at line 227 of file BonTNLP2FPNLP.hpp.

Referenced by setSigma().

Norm to use (L_1 or L_2).

Definition at line 229 of file BonTNLP2FPNLP.hpp.

Referenced by setNorm().

Scaling factor for the objective.

Definition at line 233 of file BonTNLP2FPNLP.hpp.

Referenced by getObjectiveScaling(), and setObjectiveScaling().

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

Definition at line 238 of file BonTNLP2FPNLP.hpp.

Referenced by set_use_feasibility_pump_objective().

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 242 of file BonTNLP2FPNLP.hpp.

Referenced by get_constraints_linearity(), get_starting_point(), and set_use_cutoff_constraint().

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

Definition at line 245 of file BonTNLP2FPNLP.hpp.

Referenced by get_constraints_linearity(), get_starting_point(), and set_use_local_branching_constraint().

double Bonmin::TNLP2FPNLP::cutoff_ [private]

Value of best solution known.

Definition at line 251 of file BonTNLP2FPNLP.hpp.

RHS of local branching constraint.

Definition at line 254 of file BonTNLP2FPNLP.hpp.

Referenced by set_rhs_local_branching_constraint().

Ipopt::TNLP::IndexStyleEnum Bonmin::TNLP2FPNLP::index_style_ [private]

Ipopt::Index style (C++ or Fortran)

Definition at line 258 of file BonTNLP2FPNLP.hpp.


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