#include <BonTNLP2FPNLP.hpp>
Collaboration diagram for Bonmin::TNLP2FPNLP:
Public Member Functions | |
Constructors/Destructors | |
TNLP2FPNLP (const SmartPtr< TNLP > tnlp, double objectiveScalingFactor=100) | |
Build using tnlp as source problem. | |
TNLP2FPNLP (const SmartPtr< TNLP > tnlp, const 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 (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_dist2point_obj (int n, const Number *vals, const 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 (Index &n, Index &m, Index &nnz_jac_g, Index &nnz_h_lag, TNLP::IndexStyleEnum &index_style) |
get info from nlp_ and add hessian information | |
virtual bool | get_bounds_info (Index n, Number *x_l, Number *x_u, Index m, Number *g_l, Number *g_u) |
This call is just passed onto tnlp_. | |
virtual bool | get_starting_point (Index n, bool init_x, Number *x, bool init_z, Number *z_L, Number *z_U, Index m, bool init_lambda, Number *lambda) |
Passed onto tnlp_. | |
virtual bool | eval_f (Index n, const Number *x, bool new_x, Number &obj_value) |
overloaded to return the value of the objective function | |
virtual bool | eval_grad_f (Index n, const Number *x, bool new_x, Number *grad_f) |
overload this method to return the vector of the gradient of the objective w.r.t. | |
virtual bool | eval_g (Index n, const Number *x, bool new_x, Index m, Number *g) |
overload to return the values of the left-hand side of the constraints | |
virtual bool | eval_jac_g (Index n, const Number *x, bool new_x, Index m, Index nele_jac, Index *iRow, Index *jCol, Number *values) |
overload to return the jacobian of g | |
virtual bool | eval_h (Index n, const Number *x, bool new_x, Number obj_factor, Index m, const Number *lambda, bool new_lambda, Index nele_hess, Index *iRow, Index *jCol, Number *values) |
Evaluate the modified Hessian of the Lagrangian. | |
Solution Methods | |
virtual void | finalize_solution (SolverReturn status, Index n, const Number *x, const Number *z_L, const Number *z_U, Index m, const Number *g, const Number *lambda, Number obj_value, const IpoptData *ip_data, 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 | dist2point (const Number *x) |
Compute the 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 | |
SmartPtr< TNLP > | tnlp_ |
pointer to the tminlp that is being adapted | |
double | objectiveScalingFactor_ |
Scaling factor for the objective. | |
TNLP::IndexStyleEnum | index_style_ |
Index style (C++ or Fortran). | |
Data for storing the point the distance to which is minimized | |
vector< Index > | inds_ |
Indices of the variables for which distance is minimized (i.e. indices of integer variables in a feasibility pump setting). | |
vector< 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. |
The extra function is set_dist2point_obj(int n, const double *, const int *)
Definition at line 22 of file BonTNLP2FPNLP.hpp.
Bonmin::TNLP2FPNLP::TNLP2FPNLP | ( | const SmartPtr< TNLP > | tnlp, | |
double | objectiveScalingFactor = 100 | |||
) |
Bonmin::TNLP2FPNLP::TNLP2FPNLP | ( | const SmartPtr< TNLP > | tnlp, | |
const SmartPtr< TNLP2FPNLP > | other | |||
) |
Build using tnlp as source problem and using other for all other parameters.
Definition at line 31 of file BonTNLP2FPNLP.cpp.
Bonmin::TNLP2FPNLP::~TNLP2FPNLP | ( | ) | [virtual] |
Bonmin::TNLP2FPNLP::TNLP2FPNLP | ( | ) | [private] |
Default Constructor.
Bonmin::TNLP2FPNLP::TNLP2FPNLP | ( | const TNLP2FPNLP & | ) | [private] |
Copy Constructor.
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 40 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 45 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 49 of file BonTNLP2FPNLP.hpp.
References use_local_branching_constraint_.
void Bonmin::TNLP2FPNLP::set_cutoff | ( | Number | cutoff | ) |
Set the cutoff value to use in the cutoff constraint.
Definition at line 52 of file BonTNLP2FPNLP.cpp.
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 59 of file BonTNLP2FPNLP.hpp.
References rhs_local_branching_constraint_.
void Bonmin::TNLP2FPNLP::set_dist2point_obj | ( | int | n, | |
const Number * | vals, | |||
const 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 64 of file BonTNLP2FPNLP.cpp.
void Bonmin::TNLP2FPNLP::setSigma | ( | double | sigma | ) | [inline] |
void Bonmin::TNLP2FPNLP::setLambda | ( | double | lambda | ) | [inline] |
void Bonmin::TNLP2FPNLP::setNorm | ( | int | norm | ) | [inline] |
bool Bonmin::TNLP2FPNLP::get_nlp_info | ( | Index & | n, | |
Index & | m, | |||
Index & | nnz_jac_g, | |||
Index & | nnz_h_lag, | |||
TNLP::IndexStyleEnum & | index_style | |||
) | [virtual] |
get info from nlp_ and add hessian information
Definition at line 97 of file BonTNLP2FPNLP.cpp.
References index_style_, norm_, tnlp_, use_cutoff_constraint_, use_feasibility_pump_objective_, use_local_branching_constraint_, and vals_.
bool Bonmin::TNLP2FPNLP::get_bounds_info | ( | Index | n, | |
Number * | x_l, | |||
Number * | x_u, | |||
Index | m, | |||
Number * | g_l, | |||
Number * | g_u | |||
) | [virtual] |
This call is just passed onto tnlp_.
Definition at line 127 of file BonTNLP2FPNLP.cpp.
References cutoff_, rhs_local_branching_constraint_, tnlp_, use_cutoff_constraint_, and use_local_branching_constraint_.
virtual bool Bonmin::TNLP2FPNLP::get_starting_point | ( | Index | n, | |
bool | init_x, | |||
Number * | x, | |||
bool | init_z, | |||
Number * | z_L, | |||
Number * | z_U, | |||
Index | m, | |||
bool | init_lambda, | |||
Number * | lambda | |||
) | [inline, virtual] |
bool Bonmin::TNLP2FPNLP::eval_f | ( | Index | n, | |
const Number * | x, | |||
bool | new_x, | |||
Number & | obj_value | |||
) | [virtual] |
overloaded to return the value of the objective function
Definition at line 152 of file BonTNLP2FPNLP.cpp.
References dist2point(), lambda_, objectiveScalingFactor_, sigma_, tnlp_, and use_feasibility_pump_objective_.
Referenced by eval_g().
bool Bonmin::TNLP2FPNLP::eval_grad_f | ( | Index | n, | |
const Number * | x, | |||
bool | new_x, | |||
Number * | grad_f | |||
) | [virtual] |
overload this method to return the vector of the gradient of the objective w.r.t.
x
Definition at line 166 of file BonTNLP2FPNLP.cpp.
References inds_, lambda_, norm_, objectiveScalingFactor_, sigma_, tnlp_, use_feasibility_pump_objective_, and vals_.
Referenced by eval_jac_g().
bool Bonmin::TNLP2FPNLP::eval_g | ( | Index | n, | |
const Number * | x, | |||
bool | new_x, | |||
Index | m, | |||
Number * | g | |||
) | [virtual] |
overload to return the values of the left-hand side of the constraints
Definition at line 194 of file BonTNLP2FPNLP.cpp.
References eval_f(), inds_, tnlp_, use_cutoff_constraint_, use_local_branching_constraint_, and vals_.
bool Bonmin::TNLP2FPNLP::eval_jac_g | ( | Index | n, | |
const Number * | x, | |||
bool | new_x, | |||
Index | m, | |||
Index | nele_jac, | |||
Index * | iRow, | |||
Index * | jCol, | |||
Number * | values | |||
) | [virtual] |
overload to return the jacobian of g
Definition at line 243 of file BonTNLP2FPNLP.cpp.
References eval_grad_f(), index_style_, inds_, k, tnlp_, use_cutoff_constraint_, use_local_branching_constraint_, and vals_.
bool Bonmin::TNLP2FPNLP::eval_h | ( | Index | n, | |
const Number * | x, | |||
bool | new_x, | |||
Number | obj_factor, | |||
Index | m, | |||
const Number * | lambda, | |||
bool | new_lambda, | |||
Index | nele_hess, | |||
Index * | iRow, | |||
Index * | jCol, | |||
Number * | values | |||
) | [virtual] |
Evaluate the modified Hessian of the Lagrangian.
Definition at line 370 of file BonTNLP2FPNLP.cpp.
References inds_, k, lambda_, norm_, objectiveScalingFactor_, sigma_, tnlp_, use_cutoff_constraint_, use_feasibility_pump_objective_, and use_local_branching_constraint_.
void Bonmin::TNLP2FPNLP::finalize_solution | ( | SolverReturn | status, | |
Index | n, | |||
const Number * | x, | |||
const Number * | z_L, | |||
const Number * | z_U, | |||
Index | m, | |||
const Number * | g, | |||
const Number * | lambda, | |||
Number | obj_value, | |||
const IpoptData * | ip_data, | |||
IpoptCalculatedQuantities * | ip_cq | |||
) | [virtual] |
This method is called when the algorithm is complete so the TNLP can store/write the solution.
Definition at line 433 of file BonTNLP2FPNLP.cpp.
References tnlp_.
void Bonmin::TNLP2FPNLP::setObjectiveScaling | ( | double | value | ) | [inline] |
double Bonmin::TNLP2FPNLP::getObjectiveScaling | ( | ) | const [inline] |
double Bonmin::TNLP2FPNLP::dist2point | ( | const Number * | x | ) | [private] |
void Bonmin::TNLP2FPNLP::operator= | ( | const TNLP2FPNLP & | ) | [private] |
Overloaded Equals Operator.
SmartPtr<TNLP> Bonmin::TNLP2FPNLP::tnlp_ [private] |
pointer to the tminlp that is being adapted
Definition at line 183 of file BonTNLP2FPNLP.hpp.
Referenced by eval_f(), eval_g(), eval_grad_f(), eval_h(), eval_jac_g(), finalize_solution(), get_bounds_info(), get_nlp_info(), and get_starting_point().
vector<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 188 of file BonTNLP2FPNLP.hpp.
Referenced by dist2point(), eval_g(), eval_grad_f(), eval_h(), eval_jac_g(), and set_dist2point_obj().
vector<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 190 of file BonTNLP2FPNLP.hpp.
Referenced by dist2point(), eval_g(), eval_grad_f(), eval_jac_g(), get_nlp_info(), and set_dist2point_obj().
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 193 of file BonTNLP2FPNLP.hpp.
Referenced by eval_f(), eval_grad_f(), eval_h(), and setLambda().
double Bonmin::TNLP2FPNLP::sigma_ [private] |
Scaling for the original objective.
Definition at line 195 of file BonTNLP2FPNLP.hpp.
Referenced by eval_f(), eval_grad_f(), eval_h(), and setSigma().
int Bonmin::TNLP2FPNLP::norm_ [private] |
Norm to use (L_1 or L_2).
Definition at line 197 of file BonTNLP2FPNLP.hpp.
Referenced by dist2point(), eval_grad_f(), eval_h(), get_nlp_info(), and setNorm().
double Bonmin::TNLP2FPNLP::objectiveScalingFactor_ [private] |
Scaling factor for the objective.
Definition at line 201 of file BonTNLP2FPNLP.hpp.
Referenced by eval_f(), eval_grad_f(), eval_h(), getObjectiveScaling(), and setObjectiveScaling().
bool Bonmin::TNLP2FPNLP::use_feasibility_pump_objective_ [private] |
Flag to indicate that we want to use the feasibility pump objective.
Definition at line 206 of file BonTNLP2FPNLP.hpp.
Referenced by eval_f(), eval_grad_f(), eval_h(), get_nlp_info(), and set_use_feasibility_pump_objective().
bool Bonmin::TNLP2FPNLP::use_cutoff_constraint_ [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 210 of file BonTNLP2FPNLP.hpp.
Referenced by eval_g(), eval_h(), eval_jac_g(), get_bounds_info(), get_nlp_info(), and set_use_cutoff_constraint().
bool Bonmin::TNLP2FPNLP::use_local_branching_constraint_ [private] |
Flag to indicate that we want to use a local branching constraint.
Definition at line 213 of file BonTNLP2FPNLP.hpp.
Referenced by eval_g(), eval_h(), eval_jac_g(), get_bounds_info(), get_nlp_info(), and set_use_local_branching_constraint().
double Bonmin::TNLP2FPNLP::cutoff_ [private] |
Value of best solution known.
Definition at line 219 of file BonTNLP2FPNLP.hpp.
Referenced by get_bounds_info(), and set_cutoff().
double Bonmin::TNLP2FPNLP::rhs_local_branching_constraint_ [private] |
RHS of local branching constraint.
Definition at line 222 of file BonTNLP2FPNLP.hpp.
Referenced by get_bounds_info(), and set_rhs_local_branching_constraint().
TNLP::IndexStyleEnum Bonmin::TNLP2FPNLP::index_style_ [private] |
Index style (C++ or Fortran).
Definition at line 226 of file BonTNLP2FPNLP.hpp.
Referenced by eval_jac_g(), and get_nlp_info().