9 #ifndef __BONCUTSTRENGTHENER_HPP__
10 #define __BONCUTSTRENGTHENER_HPP__
13 #include "CoinPackedVector.hpp"
40 const CoinPackedVector& cut,
43 const Ipopt::Number* starting_point,
44 const double* x_l_orig,
45 const double* x_u_orig,
46 Ipopt::Index constr_index,
47 Ipopt::Index nvar_constr ,
48 const Ipopt::Index* jCol);
56 virtual bool get_nlp_info(Ipopt::Index& n, Ipopt::Index&
m, Ipopt::Index& nnz_jac_g,
57 Ipopt::Index& nnz_h_lag, Ipopt::TNLP::IndexStyleEnum& index_style);
60 virtual bool get_bounds_info(Ipopt::Index n, Ipopt::Number* x_l, Ipopt::Number* x_u,
61 Ipopt::Index m, Ipopt::Number* g_l, Ipopt::Number* g_u);
65 bool init_z, Ipopt::Number* z_L, Ipopt::Number* z_U,
66 Ipopt::Index m,
bool init_lambda,
67 Ipopt::Number* lambda);
70 virtual bool eval_f(Ipopt::Index n,
const Ipopt::Number* x,
bool new_x, Ipopt::Number& obj_value);
73 virtual bool eval_grad_f(Ipopt::Index n,
const Ipopt::Number* x,
bool new_x, Ipopt::Number* grad_f);
76 virtual bool eval_g(Ipopt::Index n,
const Ipopt::Number* x,
bool new_x, Ipopt::Index m, Ipopt::Number*
g);
82 virtual bool eval_jac_g(Ipopt::Index n,
const Ipopt::Number* x,
bool new_x,
83 Ipopt::Index m, Ipopt::Index nele_jac, Ipopt::Index* iRow, Ipopt::Index *jCol,
90 virtual bool eval_h(Ipopt::Index n,
const Ipopt::Number* x,
bool new_x,
91 Ipopt::Number obj_factor, Ipopt::Index m,
const Ipopt::Number* lambda,
92 bool new_lambda, Ipopt::Index nele_hess, Ipopt::Index* iRow,
93 Ipopt::Index* jCol, Ipopt::Number* values);
100 Ipopt::Index n,
const Ipopt::Number* x,
const Ipopt::Number* z_L,
const Ipopt::Number* z_U,
101 Ipopt::Index m,
const Ipopt::Number* g,
const Ipopt::Number* lambda,
102 Ipopt::Number obj_value,
103 const Ipopt::IpoptData* ip_data,
104 Ipopt::IpoptCalculatedQuantities* ip_cq);
185 const int gindex, CoinPackedVector& cut,
186 double& cut_lb,
double& cut_ub,
187 const double g_val,
const double g_lb,
189 int n,
const double*
x,
214 const CoinPackedVector& row ,
225 const double* minlp_lb,
226 const double* minlp_ub,
227 const int gindex, CoinPackedVector& cut,
228 double& cut_lb,
double& cut_ub,
229 int n,
const double*
x,
Base class for all MINLPs that use a standard triplet matrix form and dense vectors.
~StrengtheningTNLP()
Destructor.
bool have_final_bound_
Flag indicating if we TNLP has been solved successfully.
const Ipopt::SmartPtr< TMINLP > tminlp_
TMINLP (with current bounds) for which the cut it to be generated.
CutStrengthener()
Default Constructor.
StrengtheningTNLP & operator=(const StrengtheningTNLP &)
virtual bool eval_f(Ipopt::Index n, const Ipopt::Number *x, bool new_x, Ipopt::Number &obj_value)
Method to return the objective value.
Ipopt::Number * grad_f_
space for original gradient if objective function is handled
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)
Method to return the bounds for my problem.
Ipopt::Number * x_full_
Full dimentional x which is used to call the TMINLP evaluation routines.
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)
Method to return some info about the nlp.
int cut_strengthening_type_
Type of OA cut strengthener.
Ipopt::Number * starting_point_
Starting point.
Ipopt::Number * x_l_
Lower bounds for constraint variables.
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)
Method to return the starting point for the algorithm.
Ipopt::Number * x_u_
Upper bounds for constraint variables.
Ipopt::Index * var_indices_
List of variables appearing on the constraints.
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...
void operator=(const CutStrengthener &)
Overloaded Equals Operator.
const Ipopt::Index n_orig_
Dimension of original problem.
Ipopt::Index m_orig_
Ipopt::Number of constraints in original problem.
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)
Method to return: 1) The structure of the jacobian (if "values" is NULL) 2) The values of the jacobia...
bool StrengthenCut(Ipopt::SmartPtr< TMINLP > tminlp, int constr_index, const CoinPackedVector &row, int n, const double *x, const double *x_l, const double *x_u, double &lb, double &ub)
Method for strengthening one cut.
Ipopt::Number * obj_grad_
Gradient of the (linear) objective function.
const Ipopt::Index constr_index_
Ipopt::Index of the constraint.
Ipopt::SmartPtr< TNLPSolver > tnlp_solver_
Object for solving the TNLPs.
Class implementing the TNLP for strengthening one cut.
Class for strengthening OA cuts, and generating additional ones.
bool lower_bound_
Flag indicating if the cut has a lower or upper bound.
virtual bool eval_g(Ipopt::Index n, const Ipopt::Number *x, bool new_x, Ipopt::Index m, Ipopt::Number *g)
Method to return the constraint residuals.
bool HandleOneCut(bool is_tight, TMINLP *tminlp, TMINLP2TNLP *problem, const double *minlp_lb, const double *minlp_ub, const int gindex, CoinPackedVector &cut, double &cut_lb, double &cut_ub, int n, const double *x, double infty)
Method for generating one type of cut (strengthened or disjunctive)
void fint fint fint real fint real real real real real real * g
virtual bool eval_grad_f(Ipopt::Index n, const Ipopt::Number *x, bool new_x, Ipopt::Number *grad_f)
Method to return the gradient of the objective.
const Ipopt::Index nvar_constr_
Ipopt::Number of variables appearing in the constraint.
Ipopt::Number strengthened_bound_
Final strengthened bound.
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)
Method to return: 1) The structure of the hessian of the lagrangian (if "values" is NULL) 2) The valu...
This is an adapter class that converts a TMINLP to a TNLP to be solved by Ipopt.
int oa_log_level_
verbosity level for OA-related output
void update_x_full(const Ipopt::Number *x)
Auxilliary method for updating the full x variable.
Ipopt::Number StrengthenedBound() const
Method for asking for the strengthened bound.
virtual ~CutStrengthener()
Destructor.
int disjunctive_cut_type_
What kind of disjuntion should be done.
bool ComputeCuts(OsiCuts &cs, TMINLP *tminlp, TMINLP2TNLP *problem, const int gindex, CoinPackedVector &cut, double &cut_lb, double &cut_ub, const double g_val, const double g_lb, const double g_ub, int n, const double *x, double infty)
Method for generating and strenghtening all desired cuts.
void fint fint fint real fint real * x