10 #ifndef __TMINLPQuad_HPP__
11 #define __TMINLPQuad_HPP__
30 const OptionsList& options
42 printf(
"Cloning TMINLP2TNLPQuadCuts.\n");
59 Ipopt::Index
m, Ipopt::Number*
g_l, Ipopt::Number*
g_u);
66 bool init_z, Ipopt::Number* z_L, Ipopt::Number* z_U,
67 Ipopt::Index
m,
bool init_lambda,
68 Ipopt::Number* lambda);
74 bool& use_x_scaling, Ipopt::Index
n,
75 Ipopt::Number* x_scaling,
76 bool& use_g_scaling, Ipopt::Index
m,
77 Ipopt::Number* g_scaling);
81 virtual bool eval_f(Ipopt::Index
n,
const Ipopt::Number*
x,
bool new_x,
86 virtual bool eval_grad_f(Ipopt::Index
n,
const Ipopt::Number*
x,
bool new_x,
87 Ipopt::Number* grad_f);
90 virtual bool eval_g(Ipopt::Index
n,
const Ipopt::Number*
x,
bool new_x,
91 Ipopt::Index
m, Ipopt::Number*
g);
98 virtual bool eval_jac_g(Ipopt::Index
n,
const Ipopt::Number*
x,
bool new_x,
99 Ipopt::Index
m, Ipopt::Index nele_jac, Ipopt::Index* iRow,
100 Ipopt::Index *jCol, Ipopt::Number*
values);
102 virtual bool eval_gi(Ipopt::Index
n,
const Ipopt::Number*
x,
bool new_x,
103 Ipopt::Index i, Ipopt::Number& gi);
106 virtual bool eval_grad_gi(Ipopt::Index
n,
const Ipopt::Number*
x,
bool new_x,
107 Ipopt::Index i, Ipopt::Index& nele_grad_gi, Ipopt::Index* jCol,
116 virtual bool eval_h(Ipopt::Index
n,
const Ipopt::Number*
x,
bool new_x,
117 Ipopt::Number obj_factor, Ipopt::Index
m,
const Ipopt::Number* lambda,
118 bool new_lambda, Ipopt::Index nele_hess,
119 Ipopt::Index* iRow, Ipopt::Index* jCol, Ipopt::Number*
values);
133 void addCuts(
const OsiCuts &cuts);
136 virtual void addCuts(
unsigned int numberCuts,
const OsiRowCut ** cuts);
140 void removeCuts(
unsigned int number ,
const int * toRemove);
154 void addRowCuts(
const OsiCuts &cuts,
bool safe);
void printH()
print H_ for debug.
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)
Returns the jacobian of the constraints.
virtual bool eval_grad_f(Ipopt::Index n, const Ipopt::Number *x, bool new_x, Ipopt::Number *grad_f)
Returns the vector of the gradient of the objective w.r.t.
int curr_nnz_jac_
Current umber of entries in the jacobian.
double c_
constant term in objective function.
TMINLP2TNLPQuadCuts()
Default Constructor.
virtual bool eval_gi(Ipopt::Index n, const Ipopt::Number *x, bool new_x, Ipopt::Index i, Ipopt::Number &gi)
compute the value of a single constraint
A small wrap around std::vector to give easy access to array for interfacing with fortran code...
Ipopt::Index nnz_h_lag()
Get the nomber of nz in hessian.
Generalizes OsiCuts to handle quadratic cuts.
vector< double > obj_
Store user passed linear objective.
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 parent class and add bounds of quadratic cuts.
vector< QuadRow * > quadRows_
Some storage for quadratic cuts.
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)
This call is just passed onto parent class and add number of quadratic cuts.
AdjustableMat H_
Storage for the original hessian of the problem.
TMINLP2TNLPQuadCuts & operator=(const TMINLP2TNLP &)
Overloaded Equals Operator.
virtual bool eval_grad_gi(Ipopt::Index n, const Ipopt::Number *x, bool new_x, Ipopt::Index i, Ipopt::Index &nele_grad_gi, Ipopt::Index *jCol, Ipopt::Number *values)
compute the structure or values of the gradient for one constraint
Ipopt::Number obj_value() const
Get the objective value.
const Ipopt::Number * x_l()
Get the current values for the lower bounds.
const Ipopt::Number * x_u()
Get the current values for the upper bounds.
virtual bool eval_f(Ipopt::Index n, const Ipopt::Number *x, bool new_x, Ipopt::Number &obj_value)
Returns the value of the objective function in x.
void addCuts(const Cuts &cuts, bool safe)
Add some linear or quadratic cuts to the problem formulation if some of the OsiRowCuts are quadratic ...
virtual bool get_constraints_linearity(Ipopt::Index m, Ipopt::TNLP::LinearityType *const_types)
This call is just passed onto parent class and add number of quadratic cuts.
void addRowCuts(const OsiCuts &cuts, bool safe)
Add some cuts to the problem formulaiton (handles Quadratics).
const Ipopt::Number * g_l()
Get the current values for constraints lower bounds.
virtual bool get_scaling_parameters(Ipopt::Number &obj_scaling, bool &use_x_scaling, Ipopt::Index n, Ipopt::Number *x_scaling, bool &use_g_scaling, Ipopt::Index m, Ipopt::Number *g_scaling)
Method that returns scaling parameters (passed to parent all quadratic not scaled).
This is a derived class fro TMINLP2TNLP to handle adding quadratic cuts.
virtual ~TMINLP2TNLPQuadCuts()
Destructor.
void removeCuts(unsigned int number, const int *toRemove)
Remove some cuts from the formulation.
void reset_objective()
Reset objective to original one.
std::map< matEntry, matIdx > AdjustableMat
TNLP::IndexStyleEnum index_style() const
Acces index_style.
void fint fint fint real fint real real real real real real * g
virtual Bonmin::TMINLP2TNLP * clone() const
Virtual copy.
This is an adapter class that converts a TMINLP to a TNLP to be solved by Ipopt.
void set_linear_objective(int n_var, const double *obj, double c_0)
Change objective to a linear one whith given objective function.
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)
This call is just passed onto parent class and add lambda for quadratic cuts.
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)
Return the hessian of the lagrangian.
virtual bool eval_g(Ipopt::Index n, const Ipopt::Number *x, bool new_x, Ipopt::Index m, Ipopt::Number *g)
Returns the vector of constraint values in x (appends constraint values for quadratics).
const Ipopt::Number * g_u()
Get the current values for constraints upper bounds.
Ipopt::Index nnz_jac_g() const
Access number of entries in tminlp_ hessian.
void fint fint fint real fint real * x