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>
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. More... | |
Constructors/Destructors | |
TNLP2FPNLP (const Ipopt::SmartPtr< Ipopt::TNLP > tnlp, double objectiveScalingFactor=100) | |
Build using tnlp as source problem. More... | |
TNLP2FPNLP (const Ipopt::SmartPtr< TNLP > tnlp, const Ipopt::SmartPtr< TNLP2FPNLP > other) | |
Build using tnlp as source problem and using other for all other parameters. More... | |
virtual | ~TNLP2FPNLP () |
Default destructor. More... | |
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. More... | |
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') More... | |
void | set_use_local_branching_constraint (bool use_local_branching_constraint) |
Flag to indicate that we want to use a local branching constraint. More... | |
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. More... | |
void | set_rhs_local_branching_constraint (double rhs_local_branching_constraint) |
Set the rhs of the local branching constraint. More... | |
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. More... | |
void | setSigma (double sigma) |
Set the value for sigma. More... | |
void | setLambda (double lambda) |
Set the value for lambda. More... | |
void | setNorm (int norm) |
Set the value for simgma. More... | |
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 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) |
This call is just passed onto tnlp_. 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) |
Passed onto tnlp_. More... | |
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 More... | |
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. More... | |
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 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) |
overload to return the jacobian of g 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) |
Evaluate the modified Hessian of the Lagrangian. More... | |
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. More... | |
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. More... | |
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. More... | |
TNLP2FPNLP (const TNLP2FPNLP &) | |
Copy Constructor. More... | |
void | operator= (const TNLP2FPNLP &) |
Overloaded Equals Operator. More... | |
Private Attributes | |
Ipopt::SmartPtr< TNLP > | tnlp_ |
pointer to the tminlp that is being adapted More... | |
double | objectiveScalingFactor_ |
Scaling factor for the objective. More... | |
Ipopt::TNLP::IndexStyleEnum | index_style_ |
Ipopt::Index style (C++ or Fortran) More... | |
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) More... | |
vector< Ipopt::Number > | vals_ |
Values of the point to which we separate (if x is the point vals_[i] should be x[inds_[i]] ) More... | |
double | lambda_ |
value for the convex combination to take between original objective and distance function. More... | |
double | sigma_ |
Scaling for the original objective. More... | |
int | norm_ |
Norm to use (L_1 or L_2). More... | |
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. More... | |
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') More... | |
bool | use_local_branching_constraint_ |
Flag to indicate that we want to use a local branching constraint. More... | |
Data for storing the rhs of the extra constraints | |
double | cutoff_ |
Value of best solution known. More... | |
double | rhs_local_branching_constraint_ |
RHS of local branching constraint. More... | |
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.
Bonmin::TNLP2FPNLP::TNLP2FPNLP | ( | const Ipopt::SmartPtr< Ipopt::TNLP > | tnlp, |
double | objectiveScalingFactor = 100 |
||
) |
Build using tnlp as source problem.
Definition at line 17 of file BonTNLP2FPNLP.cpp.
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.
Definition at line 33 of file BonTNLP2FPNLP.cpp.
|
virtual |
Default destructor.
Definition at line 49 of file BonTNLP2FPNLP.cpp.
|
private |
Default Constructor.
|
private |
Copy Constructor.
|
inline |
Definition at line 36 of file BonTNLP2FPNLP.hpp.
|
inline |
Flag to indicate that we want to use the feasibility pump objective.
Definition at line 41 of file BonTNLP2FPNLP.hpp.
|
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.
|
inline |
Flag to indicate that we want to use a local branching constraint.
Definition at line 50 of file BonTNLP2FPNLP.hpp.
void Bonmin::TNLP2FPNLP::set_cutoff | ( | Ipopt::Number | cutoff | ) |
Set the cutoff value to use in the cutoff constraint.
Definition at line 54 of file BonTNLP2FPNLP.cpp.
|
inline |
Set the rhs of the local branching constraint.
Definition at line 60 of file BonTNLP2FPNLP.hpp.
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
n | number of coordinates on which distance is minimized |
inds | indices of the coordinates on which distance is minimized |
vals | values of the point for coordinates in ind |
Definition at line 66 of file BonTNLP2FPNLP.cpp.
|
inline |
Set the value for sigma.
Definition at line 76 of file BonTNLP2FPNLP.hpp.
|
inline |
Set the value for lambda.
Definition at line 80 of file BonTNLP2FPNLP.hpp.
Set the value for simgma.
Definition at line 84 of file BonTNLP2FPNLP.hpp.
|
virtual |
get info from nlp_ and add hessian information
Definition at line 99 of file BonTNLP2FPNLP.cpp.
|
virtual |
This call is just passed onto tnlp_.
Definition at line 129 of file BonTNLP2FPNLP.cpp.
|
inlinevirtual |
Passed onto tnlp_.
Definition at line 102 of file BonTNLP2FPNLP.hpp.
|
virtual |
overloaded to return the value of the objective function
Definition at line 158 of file BonTNLP2FPNLP.cpp.
|
virtual |
overload this method to return the vector of the gradient of the objective w.r.t.
x
Definition at line 172 of file BonTNLP2FPNLP.cpp.
|
virtual |
overload to return the values of the left-hand side of the constraints
Definition at line 200 of file BonTNLP2FPNLP.cpp.
|
virtual |
overload to return the jacobian of g
Definition at line 249 of file BonTNLP2FPNLP.cpp.
|
virtual |
Evaluate the modified Hessian of the Lagrangian.
Definition at line 376 of file BonTNLP2FPNLP.cpp.
|
virtual |
This method is called when the algorithm is complete so the TNLP can store/write the solution.
Definition at line 443 of file BonTNLP2FPNLP.cpp.
|
inlinevirtual |
Definition at line 158 of file BonTNLP2FPNLP.hpp.
|
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).
Definition at line 166 of file BonTNLP2FPNLP.hpp.
|
inline |
Definition at line 181 of file BonTNLP2FPNLP.hpp.
|
inline |
Definition at line 185 of file BonTNLP2FPNLP.hpp.
|
private |
Compute the norm-2 distance to the current point to which distance is minimized.
Compute the distance to the current point to which distance is minimized.
Definition at line 76 of file BonTNLP2FPNLP.cpp.
|
private |
Overloaded Equals Operator.
|
private |
pointer to the tminlp that is being adapted
Definition at line 215 of file BonTNLP2FPNLP.hpp.
|
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.
|
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.
|
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.
|
private |
Scaling for the original objective.
Definition at line 227 of file BonTNLP2FPNLP.hpp.
|
private |
Norm to use (L_1 or L_2).
Definition at line 229 of file BonTNLP2FPNLP.hpp.
|
private |
Scaling factor for the objective.
Definition at line 233 of file BonTNLP2FPNLP.hpp.
|
private |
Flag to indicate that we want to use the feasibility pump objective.
Definition at line 238 of file BonTNLP2FPNLP.hpp.
|
private |
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.
|
private |
Flag to indicate that we want to use a local branching constraint.
Definition at line 245 of file BonTNLP2FPNLP.hpp.
|
private |
Value of best solution known.
Definition at line 251 of file BonTNLP2FPNLP.hpp.
|
private |
RHS of local branching constraint.
Definition at line 254 of file BonTNLP2FPNLP.hpp.
|
private |
Ipopt::Index style (C++ or Fortran)
Definition at line 258 of file BonTNLP2FPNLP.hpp.